Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 890072 - net-misc/nextcloud-client-3.6.4-r2 on hardened: error: ‘_stat’ was not declared in this scope
Summary: net-misc/nextcloud-client-3.6.4-r2 on hardened: error: ‘_stat’ was not declar...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Bernard Cafarelli
URL:
Whiteboard:
Keywords:
: 850118 (view as bug list)
Depends on:
Blocks: 847148
  Show dependency tree
 
Reported: 2023-01-07 16:23 UTC by Karl-Johan Karlsson
Modified: 2023-02-10 17:37 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,45.46 KB, text/plain)
2023-01-07 16:23 UTC, Karl-Johan Karlsson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karl-Johan Karlsson 2023-01-07 16:23:19 UTC
I'm running my desktop systems on the default/linux/amd64/17.1/hardened profile. After bug 876893 set -D_FORTIFY_SOURCE=3 by default on gcc[hardened], building net-misc/nextcloud-client-3.6.4-r2 fails with:

FAILED: src/csync/CMakeFiles/nextcloud_csync.dir/vio/csync_vio_local_unix.cpp.o 
/usr/bin/x86_64-pc-linux-gnu-g++ -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DISABLE_DEPRECATED_BEFORE=0x000000 -DQT_MESSAGELOGCONTEXT -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_URL_CAST_FROM_STRING -DQT_USE_QSTRINGBUILDER -DUNICODE -D_UNICODE -Dnextcloud_csync_EXPORTS -I/var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4_build/src/csync -I/var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4/src/csync -I/var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4_build/src/csync/nextcloud_csync_autogen/include -I/var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4_build -I/var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4/src -I/var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4_build/src -I/var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4/src/csync/std -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtConcurrent  -O2 -pipe -march=native -Wall -Wextra -Wpedantic -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIC -fdiagnostics-color=always -fPIC -std=gnu++14 -MD -MT src/csync/CMakeFiles/nextcloud_csync.dir/vio/csync_vio_local_unix.cpp.o -MF src/csync/CMakeFiles/nextcloud_csync.dir/vio/csync_vio_local_unix.cpp.o.d -o src/csync/CMakeFiles/nextcloud_csync.dir/vio/csync_vio_local_unix.cpp.o -c /var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4/src/csync/vio/csync_vio_local_unix.cpp
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<built-in>: note: this is the location of the previous definition
In file included from /var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4/src/csync/vio/csync_vio_local_unix.cpp:31:
/var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4/src/csync/vio/csync_vio_local_unix.cpp: In function ‘int _csync_vio_local_stat_mb(const mbchar_t*, csync_file_stat_t*)’:
/var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4/src/csync/std/c_private.h:88:15: error: ‘_stat’ was not declared in this scope; did you mean ‘stat’?
   88 | #define lstat _stat
      |               ^~~~~
/var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4/src/csync/std/c_private.h:128:24: note: in expansion of macro ‘lstat’
  128 | #define _tstat         lstat
      |                        ^~~~~
/var/tmp/portage/net-misc/nextcloud-client-3.6.4-r2/work/desktop-3.6.4/src/csync/vio/csync_vio_local_unix.cpp:144:9: note: in expansion of macro ‘_tstat’
  144 |     if (_tstat(wuri, &sb) < 0) {
      |         ^~~~~~

Setting -D_FORTIFY_SOURCE=2 as suggested in the Gentoo news item about the GCC change makes it build.

However, these output lines made me wonder:

   <command-line>: warning: "_FORTIFY_SOURCE" redefined
   <built-in>: note: this is the location of the previous definition

Upstream has a patch, accepted for 3.6.0 six months ago, which was supposed to fix that, when openSUSE Tumbleweed switched to -D_FORTIFY_SOURCE=3 by default: https://github.com/nextcloud/desktop/pull/4703

Explicitly setting -D_FORTIFY_SOURCE=3 in CFLAGS and CXXFLAGS also makes it build. This suggests that upstream's detection of -D_FORTIFY_SOURCE=3 isn't working with Gentoo's setting of that option. Could it be that they only look at the environment variables, not the built-in GCC defaults?

Gentoo bug 850118 shows the same error message, but that's from before upstream adopted the patch to handle -D_FORTIFY_SOURCE=3 and before Hardened Gentoo adopted -D_FORTIFY_SOURCE=3 as default, so may or may not be relevant.

Reproducible: Always




Portage 3.0.43 (python 3.10.9-final-0, default/linux/amd64/17.1/hardened, gcc-12, glibc-2.36-r6, 6.1.3-gentoo-x86_64 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-6.1.3-gentoo-x86_64-x86_64-AMD_Ryzen_7_PRO_3700U_w-_Radeon_Vega_Mobile_Gfx-with-glibc2.36
KiB Mem:    14186524 total,   3115596 free
KiB Swap:   15729660 total,   9739768 free
Timestamp of repository gentoo: Fri, 06 Jan 2023 23:00:01 +0000
Head commit of repository gentoo: c4ed032cdd4aff2e5e517f0f380d2587fc53e81a
Head commit of repository creideiki: c77c22ca22ffa024520b16a9ef76f9596a862581

sh bash 5.2_p15
ld GNU ld (Gentoo 2.39 p5) 2.39.0
app-misc/pax-utils:        1.3.6::gentoo
app-shells/bash:           5.2_p15::gentoo
dev-lang/perl:             5.36.0-r1::gentoo
dev-lang/python:           3.10.9::gentoo, 3.11.1::gentoo
dev-lang/rust:             1.66.0::gentoo
dev-util/cmake:            3.25.1::gentoo
dev-util/meson:            1.0.0::gentoo
sys-apps/baselayout:       2.9::gentoo
sys-apps/openrc:           0.46::gentoo
sys-apps/sandbox:          2.30-r1::gentoo
sys-devel/autoconf:        2.13-r7::gentoo, 2.71-r5::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.39-r4::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           15.0.6-r1::gentoo
sys-devel/gcc:             12.2.1_p20221231::gentoo
sys-devel/gcc-config:      2.10::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             15.0.6::gentoo
sys-devel/llvm:            15.0.6-r1::gentoo
sys-devel/make:            4.4::gentoo
sys-kernel/linux-headers:  6.1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.36-r6::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: --ipv4

creideiki
    location: /var/db/repos/creideiki
    sync-type: git
    sync-uri: https://github.com/creideiki/portage
    masters: gentoo
    volatile: True

steam-overlay
    location: /var/lib/layman/steam-overlay
    sync-type: laymansync
    sync-uri: https://github.com/anyc/steam-overlay.git
    masters: gentoo
    priority: 50
    volatile: True

torbrowser
    location: /var/lib/layman/torbrowser
    sync-type: laymansync
    sync-uri: https://github.com/MeisterP/torbrowser-overlay.git
    masters: gentoo
    priority: 50
    volatile: True

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=native"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--alphabetical --keep-going --quiet-build=n --backtrack=30 --verbose-conflicts"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe -march=native"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg buildpkg-live compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=native"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j6"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--ipv4"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X acl alsa amd64 bzip2 cli crypt dbus dri elogind eselect-ldso ffmpeg flac gdbm gif gles2 hackrf hardened harfbuzz iconv icu ipv6 jpeg libglvnd libtirpc mp3 multilib ncurses nls nptl ogg opencl opengl openmp orc pam pcre pie plasma png qml qt5 rav1e readline screencast seccomp split-usr ssl ssp test-rust udev unicode vaapi vorbis vulkan wayland x264 xattr xtpax zlib" ABI_X86="64" ADA_TARGET="gnat_2021" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" CAMERAS="canon" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput wacom" KERNEL="linux" L10N="en en-US en-GB sv" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="BPF AMDGPU X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" QEMU_SOFTMMU_TARGETS="i386 x86_64" RUBY_TARGETS="ruby31" SANE_BACKENDS="hp" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LANG, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

net-misc/nextcloud-client-3.6.4-r2::gentoo was built with the following:
USE="-doc -dolphin -nautilus -test -webengine" ABI_X86="(64)"
CFLAGS="-O2 -pipe -march=native -D_FORTIFY_SOURCE=3"
CXXFLAGS="-O2 -pipe -march=native -D_FORTIFY_SOURCE=3"
FEATURES="buildpkg-live protect-owned config-protect-if-modified fixlafiles unmerge-logs ipc-sandbox binpkg-dostrip unmerge-orphans usersync ebuild-locks sfperms binpkg-logs compressdebug binpkg-multi-instance userfetch distlocks merge-sync binpkg-docompress strict buildpkg assume-digests parallel-fetch news multilib-strict usersandbox pid-sandbox xattr qa-unresolved-soname-deps unknown-features-warn splitdebug sandbox userpriv keeptemp preserve-libs network-sandbox"
Comment 1 Karl-Johan Karlsson 2023-01-07 16:23:39 UTC
Created attachment 847846 [details]
build.log
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-07 21:07:46 UTC
Yeah, we just need to patch it out because the way they check it isn't going to work for us.

(There's a way to check what the compiler defaults to, if they want to do that, though.)
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-08 01:22:22 UTC
(In reply to Sam James from comment #2)
> Yeah, we just need to patch it out because the way they check it isn't going
> to work for us.
> 
> (There's a way to check what the compiler defaults to, if they want to do
> that, though.)

(referring to autoconf-archive's F_S macro)
Comment 4 Attila Tóth 2023-01-11 06:39:34 UTC
Workaround works until proper solution arrives.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-06 22:13:23 UTC
ping.
Comment 6 Attila Tóth 2023-02-07 20:05:58 UTC
Happens with -3.6.6, workaround still effective.
Comment 7 Larry the Git Cow gentoo-dev 2023-02-08 04:22:52 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=992d3f3d35158fa1deaf87e928a030bcd1be6905

commit 992d3f3d35158fa1deaf87e928a030bcd1be6905
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-02-08 04:22:21 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-02-08 04:22:22 +0000

    net-misc/nextcloud-client: don't redefine _FORTIFY_SOURCE
    
    Fixes build on hardened. We already set F_S w/ level 2 as minimum even on non-
    hardened.
    
    Closes: https://bugs.gentoo.org/890072
    Signed-off-by: Sam James <sam@gentoo.org>

 ...d-client-3.6.6-no-redefine-fortify-source.patch | 31 ++++++++++++++++++++++
 .../nextcloud-client/nextcloud-client-3.6.6.ebuild |  4 +++
 2 files changed, 35 insertions(+)
Comment 8 Bernard Cafarelli gentoo-dev 2023-02-08 17:37:53 UTC
Thanks sam
Comment 9 Bernard Cafarelli gentoo-dev 2023-02-10 17:37:54 UTC
*** Bug 850118 has been marked as a duplicate of this bug. ***