--- Begin Message ---
Subject: |
Bug#463251: tar: --transform does not apply to symlink targets when creating or listing |
Date: |
Wed, 30 Jan 2008 15:36:13 +0000 |
Package: tar
Version: 1.19-1
Severity: normal
tar's --transform option seems to apply to symlink targets when
extracting an archive, but not when creating or listing one. (I
haven't checked other operations.)
# Create an archive with a symlink in
$ mkdir d
$ cd d
$ touch foo
$ ln -s foo bar
$ cd ..
$ ls -l d
total 0
lrwxrwxrwx 1 timb software 3 Jan 30 15:05 bar -> foo
-rw-rw-r-- 1 timb software 0 Jan 30 15:05 foo
$ tar cf d.tar d
$ tar tvf d.tar
drwxrwsr-x timb/software 0 2008-01-30 15:05 d/
-rw-rw-r-- timb/software 0 2008-01-30 15:05 d/foo
lrwxrwxrwx timb/software 0 2008-01-30 15:05 d/bar -> foo
# Listing with --transform doesn't transform the symlink target
$ tar tvf d.tar --transform=s/foo/quux/ --show-transformed-names
drwxrwsr-x timb/software 0 2008-01-30 15:05 d
-rw-rw-r-- timb/software 0 2008-01-30 15:05 d/quux
lrwxrwxrwx timb/software 0 2008-01-30 15:05 d/bar -> foo
# Extracting appears not to ...
$ rm -r d
$ tar xvvf d.tar --transform=s/foo/quux/ --show-transformed-names
drwxrwsr-x timb/software 0 2008-01-30 15:05 d
-rw-rw-r-- timb/software 0 2008-01-30 15:05 d/quux
lrwxrwxrwx timb/software 0 2008-01-30 15:05 d/bar -> foo
# ... but really does
$ ls -l d
total 0
lrwxrwxrwx 1 timb software 4 Jan 30 15:06 bar -> quux
-rw-rw-r-- 1 timb software 0 Jan 30 15:05 quux
# Restore the original and this time create with --transform
$ rm -r d
$ tar xf d.tar
$ ls -l d
total 0
lrwxrwxrwx 1 timb software 3 Jan 30 15:06 bar -> foo
-rw-rw-r-- 1 timb software 0 Jan 30 15:05 foo
$ tar cvvf d.tar d --transform=s/foo/quux/ --show-transformed-names
drwxrwsr-x timb/software 0 2008-01-30 15:05 d/
-rw-rw-r-- timb/software 0 2008-01-30 15:05 d/quux
lrwxrwxrwx timb/software 0 2008-01-30 15:06 d/bar -> foo
# This time it looks broken because it really is
$ tar tvf d.tar
drwxrwsr-x timb/software 0 2008-01-30 15:05 d/
-rw-rw-r-- timb/software 0 2008-01-30 15:05 d/quux
lrwxrwxrwx timb/software 0 2008-01-30 15:06 d/bar -> foo
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (990, 'stable'), (50, 'unstable'), (50, 'testing')
Architecture: amd64 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.22-3-amd64
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages tar depends on:
ii libc6 2.7-6 GNU C Library: Shared libraries
tar recommends no packages.
-- no debconf information
--- End Message ---