coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tests/du/slink.sh: what's the rationale?


From: Pádraig Brady
Subject: Re: tests/du/slink.sh: what's the rationale?
Date: Sun, 20 Jan 2013 11:01:14 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

On 01/19/2013 10:33 PM, Bernhard Voelker wrote:
Does anyone remember the reason for adding this test?

tests/du/slink.sh:2:
   # Ensure that the size of a long-named-symlink is > 0.

I'm asking because I'm experiencing failures on OpenSUSE's Build Service.
It uses XEN for building packages ...

   booting XEN kernel ...
   xm create -c /var/tmp/build.xen.conf-xEZDA7Af3 name=build_8 \
      disk=phy:/dev/dm-14,hda1,w disk=phy:/dev/dm-15,hda2,w \
      extra=quiet init=/.build/build elevator=noop panic=1 console=ttyS0

and the file system is an ordinary ext4:

   + df -Th .
   Filesystem     Type  Size  Used Avail Use% Mounted on
   /dev/hda1      ext4   14G  1.2G   13G   9% /

   + stat .
   File: '.'
   Size: 4096           Blocks: 8          IO Block: 4096   directory
   Device: 301h/769d    Inode: 141009      Links: 2
   Access: (0700/drwx------)  Uid: (  399/  abuild)   Gid: (  399/  abuild)
   Access: 2013-01-19 13:26:39.280020256 +0000
   Modify: 2013-01-19 13:26:39.420020256 +0000
   Change: 2013-01-19 13:26:39.420020256 +0000
   Birth: -

   + stat -f .
   File: "."
   ID: c0e637f6ae90cc28 Namelen: 255     Type: ext2/ext3
   Block size: 4096       Fundamental block size: 4096
   Blocks: Total: 3571656    Free: 3274091    Available: 3274091
   Inodes: Total: 897600     Free: 855410

However, du reports them all with 0 size:

   + grep '^[1-9]' out
   + fail=1
   + cat out
   0    1
   0    15
   0    16
   0    31
   0    32
   0    59
   0    60
   0    63
   0    64
   0    127
   0    128
   0    255
   0    256
   0    511
   0    512
   0    1024

Here's an strace output for the last symlink "1024":

   newfstatat(AT_FDCWD, "1024", {st_dev=makedev(3, 1), st_ino=141025,
     st_mode=S_IFLNK|0777, st_nlink=1, st_uid=399, st_gid=399,
     st_blksize=4096, st_blocks=0, st_size=1024,
     st_atime=2013/01/19-13:26:39, st_mtime=2013/01/19-13:26:39,
     st_ctime=2013/01/19-13:26:39}, AT_SYMLINK_NOFOLLOW) = 0


The test du/slink has been added back in 2002
   http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=92a2cc65
but I didn't find a reason for it - neither in the surrounding
commits nor in today's du.c or du.c of that time.

Is tests/du/slink.sh obsolete nowadays?

Have a nice day,
Berny

I guess the rationale is to verify the symlink is not being resolved,
though you're right that symlink allocation is dependent on the
file system. I suppose one could use a loopback ext2 file system
like in cp/cp-a-selinux.sh.

cheers,
Pádraig.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]