Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 363553 - sys-apps/coreutils-8.11 trashes system (binaries full of zeros)
Summary: sys-apps/coreutils-8.11 trashes system (binaries full of zeros)
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal critical
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-14 07:43 UTC by octoploid
Modified: 2011-04-14 15:32 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description octoploid 2011-04-14 07:43:57 UTC
sys-apps/coreutils-8.11 installs files full of zeros
instead of the expected binaries.
This trashes the system.

Reproducible: Always
Comment 1 Patrick Lauer gentoo-dev 2011-04-14 07:50:33 UTC
please paste emerge --info and what filesystems you use (mount output should be good)

This is possibly a duplicate of #353907
Comment 2 octoploid 2011-04-14 08:03:36 UTC
My filesystem is xfs:

% df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
rootfs      rootfs     30G   12G   19G  39% /
/dev/root      xfs     30G   12G   19G  39% /
devtmpfs  devtmpfs    4.0G  224K  4.0G   1% /dev
none         tmpfs    400M  4.0M  397M   1% /dev/shm
/dev/sda1      xfs    196G   55G  141G  29% /var
/dev/sda2      xfs    1.2T  440G  762G  37% /music
Comment 3 octoploid 2011-04-14 08:19:02 UTC
OK this turned out to be a linker problem.
There are no problems when I use GNU ld (Linux/GNU Binutils) 2.21.51.0.8.20110408.
But when I use GNU gold (Linux/GNU Binutils 2.21.51.0.8.20110408) 1.11
(this is the linker I normally use) I get files full of zeros.

(I switch between linkers with:
GNU ld:
ln -f /usr/x86_64-pc-linux-gnu/binutils-bin/2.21.51.0.8/ld.bfd /usr/x86_64-pc-linux-gnu/binutils-bin/2.21.51.0.8/ld

Gold:
ln -f /usr/x86_64-pc-linux-gnu/binutils-bin/2.21.51.0.8/ld.gold /usr/x86_64-pc-linux-gnu/binutils-bin/2.21.51.0.8/ld
)
Comment 4 octoploid 2011-04-14 09:10:15 UTC
Hmm, this is really strange.
All the binaries in /var/tmp/portage/sys-apps/coreutils-8.11/work/coreutils-8.11/src
are OK even when linked "gold".

The error apparently happens when the binaries are copied from 
there to the image dir:
./ginstall chroot hostid nice who users pinky stty df stdbuf [ base64 basename cat chcon chgrp chmod chown cksum comm cp csplit cut date dd dir dircolors dirname du echo env expand expr factor false fmt fold head id join link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nl nproc nohup od paste pathchk pr printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf sleep sort split stat sum sync tac tail tee test timeout touch tr true truncate tsort tty uname unexpand uniq unlink vdir wc whoami yes arch '/var/tmp/portage/sys-apps/coreutils-8.11/image//usr/bin'

But when I run the above command by hand, all binaries in image//usr/bin turn out to be correct...
Comment 5 octoploid 2011-04-14 12:03:31 UTC
The "gold vs. GNU ld" issue turned out to be a red herring.
This is a timing problem and gold is faster.

Now "make check" fails in both cases in exactly the same places:

for example:

FAIL: cp/fiemap-empty (exit: 1)
===============================
...
+ fallocate -l 10MiB -n unwritten.withdata
+ dd count=10 if=/dev/urandom conv=notrunc iflag=fullblock of=unwritten.withdata
10+0 records in
10+0 records out
5120 bytes (5.1 kB) copied, 0.00219578 s, 2.3 MB/s
+ cp unwritten.withdata cp.test
++ stat -c %s unwritten.withdata
++ stat -c %s cp.test
+ test 5120 = 5120
+ cmp unwritten.withdata cp.test
unwritten.withdata cp.test differ: char 1, line 1
+ fail=1
Comment 6 octoploid 2011-04-14 12:39:09 UTC
So if you're using xfs, I would recommend to skip this
coreutils release.
 
I've notified upstream here:
http://thread.gmane.org/gmane.comp.file-systems.xfs.general/37895
Comment 7 octoploid 2011-04-14 13:28:45 UTC
I've tested this further and ext4 is also affected by this bug.
Btrfs is fine.
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2011-04-14 14:49:46 UTC
(In reply to comment #1)
> please paste emerge --info and what filesystems you use (mount output should be
> good)
> 
> This is possibly a duplicate of #353907

Please comply.
Comment 9 octoploid 2011-04-14 15:03:52 UTC
(In reply to comment #8)
> (In reply to comment #1)
> > please paste emerge --info and what filesystems you use (mount output should be
> > good)
> > 
> > This is possibly a duplicate of #353907
> 
> Please comply.

Comply to what?

(You wouldn't want to see my output of "emerge --info", I assure you ;-) )

#353907 was the reason they introduced this new bug into coreutils-8.11.

Here is an excerpt of my mail exchange with Pádraig Brady, this should
make the issue clear:

> >> cp was changed in 8.11 to not bother reading
> >> an extent if it is marked as UNWRITTEN.
> >> The comment in fiemap.h says that this means that the
> >> space is allocated, but zero.
> >>
> >> We tested on XFS, on F15 x86_64, which is earlier
> >> than your 2.6.39-rc3 and didn't notice this issue.
> >>
> >> I'm guessing so that XFS is reporting the extent
> >> as UNWRITTEN, even though there is data in it now,
> >> and that it might sort itself out after a while,
> >> or after a sync I suppose (note we also stopped
> >> using sync before fiemap for 2.6.39).
> >>
> >> It would help a lot if you could insert this command
> >> into the test above (just before the failing cp)
> >> and show the test output again:
> >>
> >>   filefrag -v unwritten.withdata
> > 
> > Hi Pádraig,
> > 
> > here you go:
> > + filefrag -v unwritten.withdata                                                                                                                     
> > Filesystem type is: ef53                                                                                                                             
> > File size of unwritten.withdata is 5120 (2 blocks, blocksize 4096)                                                                                   
> >  ext logical physical expected length flags                                                                                                          
> >    0       0   274432            2560 unwritten,eof                                                                                                  
> > unwritten.withdata: 1 extent found
> > 
> > Please notice that this also happens with ext4 on the same kernel. 
> > Btrfs is fine.
> 
> That looks like a bug in XFS :(
> I presume if you change `filefrag -v` to `filefrag -vs` that
> the output will change, and the test will pass.
> I'm a bit surprised that ext4 shows the same thing
> as there was supposedly a patch for this issue already
> applied for 2.6.39.
> 
> It would be great if we got these fixed up before
> 2.6.29 was released, so that the checks in coreutils 8.11
> were valid.
Comment 10 Jeroen Roovers (RETIRED) gentoo-dev 2011-04-14 15:27:50 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #1)
> > > please paste emerge --info and what filesystems you use (mount output should be
> > > good)
> > > 
> > > This is possibly a duplicate of #353907
> > 
> > Please comply.
> 
> Comply to what?
> 
> (You wouldn't want to see my output of "emerge --info", I assure you ;-) )

I do.
Comment 11 octoploid 2011-04-14 15:32:00 UTC
Portage 2.1.9.46 (default/linux/amd64/10.0/no-multilib, gcc-4.6.1, glibc-2.12.2-r0, 2.6.39-rc3-00087-gda768a4 x86_64)
=================================================================
System uname: Linux-2.6.39-rc3-00087-gda768a4-x86_64-AMD_Phenom-tm-_II_X4_955_Processor-with-gentoo-2.0.2
Timestamp of tree: Thu, 14 Apr 2011 14:15:01 +0000
app-shells/bash:     4.2_p8
dev-lang/python:     2.7.1-r1, 3.1.3-r1
dev-util/cmake:      2.8.4
sys-apps/baselayout: 2.0.2
sys-apps/openrc:     9999
sys-apps/sandbox:    2.5
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.10.3, 1.11.1-r1
sys-devel/binutils:  2.21.51.0.8
sys-devel/gcc:       4.5.2, 4.6.0_alpha20110122::<unknown repository>
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.4-r1
sys-devel/make:      3.82
sys-kernel/linux-headers: 2.6.38
virtual/os-headers:  0
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
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/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/tmp/portage"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1,--hash-style=gnu,--as-needed"
MAKEOPTS="-j4"
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="/var/portage"
PORTDIR_OVERLAY="/var/lib/layman/pro-audio /usr/local/portage"
SYNC="rsync://rsync3.de.gentoo.org/gentoo-portage"
USE="3dnow X alsa amd64 apng audiofile bash-completion berkdb bzip2 cairo cgroup cli cracklib crypt cscope cups cxx dbus djvu dri exif extras fbcon fontconfig fortran gdbm gif gnome gpm gtk iconv jpeg kde kpathsea maildir mmx mudflap ncurses nls nptl nptlonly ogg opengl openmp pam pcre perl png pppd python qt3support qt4 readline semantic-desktop session sse sse2 sse3 ssl sysfs tcpd threads tiff truetype unicode vim-syntax xft xorg zlib zsh-completion" 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="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" 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" CAMERAS="ptp2" 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" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon" 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, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

I always install gcc by hand and use this version ATM:
gcc version 4.6.1 20110413 (prerelease) (GCC)