#151419 tar --remove-files does not detect hardlinks

Package:
tar
Source:
tar
Description:
GNU version of the tar archiving utility
Submitter:
Benjamin A . Okopnik
Date:
2005-07-18 03:18:01 UTC
Severity:
wishlist
#151419#5
Date:
2002-06-27 16:11:57 UTC
From:
To:
Hi -

This isn't all that critical, but I noticed the above, and ran "diff" and
"ls -il" to make sure; yep, same file, and no reason to waste the space.
So, "rm mkfs.ext3; ln mke2fs mkfs.ext3". Hope you find this useful.


Ben Okopnik
-=-=-=-=-=-

#151419#10
Date:
2002-08-08 10:55:08 UTC
From:
To:
I use afs. This doesn't support hardlinks. So please, use softlinks for
mkfs.ext2 and mkfs.ext3.

#151419#15
Date:
2002-08-17 17:46:43 UTC
From:
To:
On Thu, 08 Aug 2002 12:55:08 +0200, joerg@alea.gnuu.de Wrote:

mke2fs.ext2 and mkfs.ext3 is in /sbin, which isn't going to be in AFS.
After all, /etc/init.d/openafs-client requires binaries in /sbin and
/usr/sbin just to get started!

						- Ted

#151419#20
Date:
2002-08-17 18:03:30 UTC
From:
To:
I'm confused.  E2fsprogs is creating mkfs.ext3 and mkfs.ext2 as a hard
link to mke2fs.  It is also creating fsck.ext3 and fsck.ext2 as a hard
link to e2fsck.  If you do a "make install" from the sources, the right
thing happens.

Yet I can't find anything in debian/* which would explain why mkfs.ext2
is getting preserved as a hard link to mke2fs, but mkfs.ext3 is not.
And the same for why fsck.ext2 is a hard link to e2fsck, but fsck.ext3
is not.  (I was looking at the sources and binary packages for e2fsprogs
1.27-2 in Woody.)

In any case, this appears to be a packaging error, since it works fine
as long as you're not trying to package debian using dpkg.  I'm really
curious what's going on here, though.  Yann?

					- Ted

#151419#25
Date:
2002-08-18 00:26:26 UTC
From:
To:
reassign 151419 tar
retitle 151419 tar --remove-files does not detect hardlinks
thanks
install-std target is stopped just before running dh_movefiles, I can see:

~/work/debian/mine/e2fsprogs/e2fsprogs-1.27+1.28-WIP-0626[560]$ ll
debian/tmp/sbin/mk*
-rwxr-xr-x    3 dwitch   users       30568 Aug 18 02:09 debian/tmp/sbin/mke2fs
-rwxr-xr-x    3 dwitch   users       30568 Aug 18 02:09 debian/tmp/sbin/mkfs.ext2
-rwxr-xr-x    3 dwitch   users       30568 Aug 18 02:09 debian/tmp/sbin/mkfs.ext3
~/work/debian/mine/e2fsprogs/e2fsprogs-1.27+1.28-WIP-0626[561]$ dh_movefiles -pe2fsprogs -v
        rm -f debian/movelist
        (cd debian/tmp >/dev/null ; find lib ! -type d -print || true) >> debian/movelist
        (cd debian/tmp >/dev/null ; find sbin ! -type d -print || true) >> debian/movelist
        (cd debian/tmp >/dev/null ; find usr/bin ! -type d -print || true) >> debian/movelist
        (cd debian/tmp >/dev/null ; find usr/sbin ! -type d -print || true) >> debian/movelist
        (cd debian/tmp >/dev/null ; find usr/share/man ! -type d -print || true) >> debian/movelist
        (cd debian/tmp >/dev/null ; tar --create --remove-files --files-from=/home/dwitch/work/debian/mine/e2fsprogs/e2fsprogs-1.27+1.28-WIP-0626/debian/movelist --file -) | (cd debian/e2fsprogs >/dev/null ;tar xpf -)
        rm -f debian/movelist
~/work/debian/mine/e2fsprogs/e2fsprogs-1.27+1.28-WIP-0626[563]$ ll debian/e2fsprogs/sbin/mk*
-rwxr-xr-x    2 dwitch   users       30568 Aug 18 02:09 debian/e2fsprogs/sbin/mke2fs
-rwxr-xr-x    2 dwitch   users       30568 Aug 18 02:09 debian/e2fsprogs/sbin/mkfs.ext2
-rwxr-xr-x    1 dwitch   users       30568 Aug 18 02:09 debian/e2fsprogs/sbin/mkfs.ext3

But well... it looks like a bug in gnu tar !

Now if I run this manually I get the debian/movelist file which I attach,
and I run the double-tar command with and without --remove-files and we see
the difference !

~/work/debian/mine/e2fsprogs/e2fsprogs-1.27+1.28-WIP-0626[572]$ (cd debian/tmp >/dev/null ; tar --create --files-from=/home/dwitch/work/debian/mine/e2fsprogs/e2fsprogs-1.27+1.28-WIP-0626/debian/movelist --file -) | (cd debian/e2fsprogs >/dev/null ;tar xpf -)
~/work/debian/mine/e2fsprogs/e2fsprogs-1.27+1.28-WIP-0626[573]$ ll debian/e2fsprogs/sbin/mk*
-rwxr-xr-x    3 dwitch   users       30568 Aug 18 02:13 debian/e2fsprogs/sbin/mke2fs
-rwxr-xr-x    3 dwitch   users       30568 Aug 18 02:13 debian/e2fsprogs/sbin/mkfs.ext2
-rwxr-xr-x    3 dwitch   users       30568 Aug 18 02:13 debian/e2fsprogs/sbin/mkfs.ext3
~/work/debian/mine/e2fsprogs/e2fsprogs-1.27+1.28-WIP-0626[574]$ (cd debian/tmp >/dev/null ; tar --create --remove-files --files-from=/home/dwitch/work/debian/mine/e2fsprogs/e2fsprogs-1.27+1.28-WIP-0626/debian/movelist --file -) | (cd debian/e2fsprogs >/dev/null ;tar xpf -)
~/work/debian/mine/e2fsprogs/e2fsprogs-1.27+1.28-WIP-0626[575]$ ll debian/e2fsprogs/sbin/mk*
-rwxr-xr-x    2 dwitch   users       30568 Aug 18 02:13 debian/e2fsprogs/sbin/mke2fs
-rwxr-xr-x    2 dwitch   users       30568 Aug 18 02:13 debian/e2fsprogs/sbin/mkfs.ext2
-rwxr-xr-x    1 dwitch   users       30568 Aug 18 02:13 debian/e2fsprogs/sbin/mkfs.ext3

And now to point at the tarball creation as the culprit:

~/work/debian/mine/e2fsprogs/e2fsprogs-1.27+1.28-WIP-0626[582]$ (cd debian/tmp >/dev/null ; tar --create --files-from=/home/dwitch/work/debian/mine/e2fsprogs/movelist --file -) | tar tvf - | grep ext3
-rwxr-xr-x dwitch/users      0 2002-08-18 02:19:50 sbin/fsck.ext3 link to sbin/e2fsck
-rwxr-xr-x dwitch/users      0 2002-08-18 02:19:50 sbin/mkfs.ext3 link to sbin/mke2fs
-rw-r--r-- dwitch/users      0 2002-08-18 02:19:50 usr/share/man/man8/fsck.ext3.8 link to usr/share/man/man8/e2fsck.8
-rw-r--r-- dwitch/users      0 2002-08-18 02:19:50 usr/share/man/man8/mkfs.ext3.8 link to usr/share/man/man8/mke2fs.8
~/work/debian/mine/e2fsprogs/e2fsprogs-1.27+1.28-WIP-0626[583]$ (cd debian/tmp >/dev/null ; tar --create --remove-files --files-from=/home/dwitch/work/debian/mine/e2fsprogs/movelist --file -) | tar tvf - | grep ext3
-rwxr-xr-x dwitch/users 102408 2002-08-18 02:19:50 sbin/fsck.ext3
-rwxr-xr-x dwitch/users  30568 2002-08-18 02:19:50 sbin/mkfs.ext3
-rw-r--r-- dwitch/users   7506 2002-08-18 02:19:50 usr/share/man/man8/fsck.ext3.8
-rw-r--r-- dwitch/users   9089 2002-08-18 02:19:50 usr/share/man/man8/mkfs.ext3.8


It looks like tar tries to do something about hardlink detection to make it
work in remove-files mode, as shown by the fact that some hardlinks are
indeed preserved, but obviously there is a bug somewhere.