Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 226475 - sys-apps/coreutils- 6.10-r2 - du hardlink/directory handling inconsistent
Summary: sys-apps/coreutils- 6.10-r2 - du hardlink/directory handling inconsistent
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-14 02:58 UTC by Arthur Hagen
Modified: 2009-03-13 18:46 UTC (History)
0 users

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 Arthur Hagen 2008-06-14 02:58:37 UTC
/usr/bin/du appears to handle reports with hardlinks inconsistently.


Reproducible: Always

Steps to Reproduce:
% dd if=/dev/zero of=foo bs=8192 count=1
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.000102171 s, 80.2 MB/s
% cp foo bar
% mkdir archive && ln foo archive/
% ls -lR
.:
total 16
drwxr-xr-x 2 art users    6 Jun 13 22:42 archive/
-rw-r--r-- 1 art users 8192 Jun 13 22:47 bar
-rw-r--r-- 2 art users 8192 Jun 13 22:41 foo

./archive:
total 8
-rw-r--r-- 2 art users 8192 Jun 13 22:41 foo
% du -sh *
8.0K    archive
8.0K    bar

Here, the file "foo" isn't listed, probably because it's tallied with the directory that contains a hardlink, and shouldn't be counted twice.  So far, so good, although it would have made more sense to list it the second time with a zero size, to indicate that there actually is a second entry for the file...

However:

% du archive archive foo foo bar bar
8.0K    archive
0       archive
8.0K    bar
8.0K    bar

Here, the non-hardlinked file is listed with the size TWICE, while the directory containing a hardlink is listed with the size ONCE.
Either the directory should be listed with the size twice, or the file should be listed with a non-zero size only once.  (And, as before, it would probably be better if the "foo" file got listed with 0 too, like the folder is, but it's really the inconsistency that's a problem)




File system:  xfs

% emerge --info
Portage 2.1.4.4 (default/linux/x86/2008.0, gcc-3.4.6, glibc-2.6.1-r0, 2.6.24-gentoo-r7 i686)
=================================================================
System uname: 2.6.24-gentoo-r7 i686 Intel(R) Pentium(R) III CPU family 1133MHz
Timestamp of tree: Wed, 11 Jun 2008 09:00:01 +0000
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p33
dev-lang/python:     2.4.4-r13
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-Os -march=pentium3 -momit-leaf-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-Os -march=pentium3 -momit-leaf-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distcc distlocks fixpackages metadata-transfer noinfo sandbox sfperms strict unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo http://open-systems.ufl.edu/mirrors/gentoo http://distro.ibiblio.org/pub/linux/distributions/gentoo/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_GB en_US en"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="gzip"
PORTAGE_COMPRESS_FLAGS="-8"
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"
SYNC="rsync://tree.lightning.broomstick.com/gentoo-portage"
USE="X acl acpi apache2 berkdb caps cli cracklib crypt cups dri eds fam fortran gdbm gif gmp icc iconv idn ipv6 isdnlog jpeg libnotify logrotate lzo mbox midi mmap mmx motif mudflap ncurses nis nls nptl nptlonly offensive openmp pam pcre perl pic png posix pppd python readline reflection spell sse ssl tcpd threads tiff truetype x86 xattr xcb xorg xulrunner zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter 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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LINGUAS="en_GB en_US en" USERLAND="GNU" VIDEO_CARDS="fglrx radeon vesa"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 SpanKY gentoo-dev 2009-03-13 18:46:58 UTC
should be fixed with coreutils-7.1