The test-mkdirat test in sys-apps/findutils-4.5.9 fails with sandbox enabled. Reproducible: Always Steps to Reproduce: 1. Use sandbox-2.4 as baseline. Apply the patches from git commit 2c90a2dd2d5be3ca593a7bcd8d79e6d0db296204 and 6103135b011da15bf85cbafa8ec069cf5b74ed4b. 2. Merge patched sandbox. 3. Merge findutils-4.5.9 Actual Results: test-mkdir.h:40: assertion failed /bin/sh: line 5: 23530 Aborted EXEEXT='' srcdir='.' LOCALE_FR='none' LOCALE_FR_UTF8='none' LOCALE_FR='none' LOCALE_TR_UTF8='none' LOCALE_FR='none' LOCALE_FR_UTF8='none' LOCALE_JA='none' LOCALE_ZH_CN='none' LOCALE_FR_UTF8='none' LOCALE_TR_UTF8='none' LOCALE_ZH_CN='none' LOCALE_FR_UTF8='none' LOCALE_FR='none' LOCALE_FR_UTF8='none' LOCALE_JA='none' LOCALE_ZH_CN='none' LOCALE_FR_UTF8='none' LOCALE_ZH_CN='none' LOCALE_FR='none' LOCALE_FR_UTF8='none' LOCALE_FR='none' LOCALE_FR_UTF8='none' PATH='/var/tmp/portage/sys-apps/findutils-4.5.9/work/findutils-4.5.9/build-aux':"$PATH" PATH='/var/tmp/portage/sys-apps/findutils-4.5.9/work/findutils-4.5.9/build-aux':"$PATH" LOCALE_FR='none' LOCALE_FR_UTF8='none' LOCALE_JA='none' LOCALE_ZH_CN='none' ${dir}$tst FAIL: test-mkdirat Expected Results: Tests pass. Tests will pass with FEATURES="-sandbox -usersandbox" added to command line. I also reproduced this with the stock sandbox-2.4 as well. This seems somewhat related to gentoo bug 297026. The specific assertion failing is: ASSERT (errno == ENOENT); which happens right after: ASSERT (func ("", 0700) == -1);
emerge --info =sys-apps/findutils-4.5.9: Portage 2.2_rc93 (default/linux/amd64/2008.0, gcc-4.4.5, glibc-2.11.2-r2, 2.6.36-gentoo-r3 x86_64) ================================================================= System Settings ================================================================= System uname: Linux-2.6.36-gentoo-r3-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9650_@_3.00GHz-with-gentoo-2.1.8 Timestamp of tree: Fri, 26 Nov 2010 19:00:01 +0000 app-shells/bash: 4.1_p9 dev-lang/python: 2.6.5-r3 dev-util/cmake: 2.8.1-r2 sys-apps/baselayout: 2.1.8-r2 sys-apps/openrc: 0.6.4-r1 sys-apps/sandbox: 2.4 sys-devel/autoconf: 2.13, 2.68 sys-devel/automake: 1.9.6-r3, 1.10.3, 1.11.1 sys-devel/binutils: 2.20.1 sys-devel/gcc: 4.4.5 sys-devel/gcc-config: 1.4.1 sys-devel/libtool: 2.4 sys-devel/make: 3.81-r2 virtual/os-headers: 2.6.32 (sys-kernel/linux-headers) Repositories: funtoo ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="* -@EULA AdobeFlash-10.1" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O3 -pipe -ggdb3 -fstack-protector-all" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d" CXXFLAGS="-march=native -O3 -pipe -ggdb3 -fstack-protector-all" DISTDIR="/usr/portage/distfiles" FEATURES="assume-digests binpkg-logs buildpkg collision-protect compress-build-logs distlocks fixlafiles fixpackages installsources mini-manifest multilib-strict news parallel-fetch preserve-libs protect-owned sandbox severe sfperms split-elog split-log splitdebug strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync" GENTOO_MIRRORS="http://gentoo.mirrors.tds.net/gentoo http://mirrors.cs.wmich.edu/gentoo http://gentoo.netnitco.net" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed" LINGUAS="en_US en" MAKEOPTS="--jobs 5" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X a52 aac aalib acl acpi adns alac alsa amd64 apache2 avahi bash-completion berkdb bzip2 cairo cdda cdr cjk cli cracklib crypt cups curl cvs cxx dbus dga djvu dri dvd dvdr dvdread eds encode esd exif expat fam ffmpeg fftw firefox flac fontconfig gd gdbm geoip gif gimp gmp gnome gnome-keyring gnutls gpm graphviz gsm gstreamer gtk hal hardened iconv icu idn imagemagick imlib ipv6 jbig jpeg jpeg2k lame lcms libcaca libnotify libsamplerate lzo mad mikmod milter mmap mmx mng modules mono mp3 mpeg msn mudflap multilib ncurses networkmanager nls nntp nptl nptlonly nsplugin offensive ogg openexr opengl openmp pam pch pcre pdf perl plotutils png policykit pppd profile pulseaudio python raw readline scanner session smp sndfile soap speex spell sqlite sse sse2 ssl startup-notification subversion svg sysfs syslog taglib tcpd theora threads tiff tk truetype unicode usb vcd vorbis wavpack wifi wmf wxwidgets x264 xattr xft xine xinerama xml xmp xorg xpm xscreensaver xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="dmix rate plug ioplug" APACHE2_MODULES="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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_US en" LIRC_DEVICES="mceusb" PHP_TARGETS="php5-2" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS ================================================================= Package Settings ================================================================= sys-apps/findutils-4.5.9 was built with the following: USE="(multilib) nls test (-selinux) -static" emerge -pqv =sys-apps/findutils-4.5.9: [ebuild R ] sys-apps/findutils-4.5.9 USE="nls (-selinux) -static"
Created attachment 255553 [details] build log This is the build.log from the build.
Created attachment 255555 [details] ebuild environment This is the ebuild environment.
sys-apps/findutils-4.5.10-r1 still fails: test-mkdir.h:40: assertion failed /bin/sh: line 5: 7170 Aborted EXEEXT='' srcdir='.' LOCALE_FR='none' LOCALE_FR_UTF8='none' LOCALE_FR='none' LOCALE_TR_UTF8='none' LOCALE_FR='none' LOCALE_FR_UTF8='none' LOCALE_JA='none' LOCALE_ZH_CN='none' LOCALE_FR_UTF8='none' LOCALE_TR_UTF8='none' LOCALE_ZH_CN='none' LOCALE_FR_UTF8='none' LOCALE_FR='none' LOCALE_FR_UTF8='none' LOCALE_JA='none' LOCALE_ZH_CN='none' LOCALE_FR_UTF8='none' LOCALE_ZH_CN='none' LOCALE_FR='none' LOCALE_FR_UTF8='none' LOCALE_FR='none' LOCALE_FR_UTF8='none' LOCALE_JA='none' LOCALE_ZH_CN='none' abs_aux_dir='/var/tmp/portage/sys-apps/findutils-4.5.10-r1/work/findutils-4.5.10/build-aux' abs_aux_dir='/var/tmp/portage/sys-apps/findutils-4.5.10-r1/work/findutils-4.5.10/build-aux' MAKE='make' LOCALE_FR='none' LOCALE_FR_UTF8='none' LOCALE_JA='none' LOCALE_ZH_CN='none' ${dir}$tst
Created attachment 311507 [details, diff] specialcase empty pathname in mkdirat This is related to, but not the same as, bug 297026. Apparently calling mkdirat with an empty pathname needs to fail with ENOENT. At least that is what is tested here, and http://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html mentions it (I have no idea which specifications I should check to confirm this). This case is special: if /foo/bar is an existing directory then (pseudocode) mkdirat("/foo/", "bar/") needs to fail with EEXIST, while mkdirat("/foo/bar/", "") needs to fail with ENOENT. So sandbox really just needs to specialcase the pathname being empty. This patch does that for just mkdirat, but if the opengroup site is to be believed other *at functions have the same feature (see http://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html ). I've not made this change as I do not know which specifications should be followed.
(In reply to comment #5) i think the issue is that pathname is specially checked for "" before any dirfd checks get processed. so if you have both pathname=="" and dirfd==BADFD, then the first one gets processed before the 2nd gets a chance to run. the current sandbox code has those inverted. i've unified the pre-at checks so this covers unlinkat & openat & mkdirat http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commitdiff;h=dd726dcc6a95355d0e0cc949018d9c8aefc89a02
*** Bug 453096 has been marked as a duplicate of this bug. ***