Subject: bin/23776:
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kirk.russell@acm.org>
List: netbsd-bugs
Date: 12/16/2003 22:17:31
>Number: 23776
>Category: bin
>Synopsis:
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 17 03:18:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Kirk Russell
>Release: NetBSD 1.6
>Organization:
Kirk Russell Bridlewood Software Testers Guild
>Environment:
System: NetBSD greyhawk 1.6 NetBSD 1.6 (GREYHAWK) #0: Tue Nov 18 22:00:12 EST 2003 kirk@greyhawk:/usr/src/sys/arch/i386/compile/GREYHAWK i386
Architecture: i386
Machine: i386
>Description:
During August 1999 (after 1.4, but before 1.5) the leading "/" removal
feature was added to pax. This feature appears to change how the
"-s replstr" feature works. Now the NetBSD pax "-s replstr" behaviour
is different than other vendor's.
With my example, the 1st stage of the pipeline will create a tar archive of
/etc/passwd, using the "-s replstr" feature to strip "/etc/" while the
2nd stage of the pipeline views the contents of the archive. SunOS,
QNX6 and NetBSD's 1.4 pax all have the expected behaviour:
$ uname -a
SunOS saltmarsh 4.1.1_U1 2 sun3
$ pax -w -s 'T^/etc/TT' /etc/passwd | pax -v
USTAR format archive
-rw-r--r-- 0 root staff 522 Sep 29 22:48 passwd
$ uname -a
SunOS nodes 5.8 Generic sun4u sparc SUNW,Ultra-5_10
$ pax -w -s 'T^/etc/TT' /etc/passwd | pax -v
USTAR format archive
-r--r--r-- 0 root sys 761 Mar 3 2003 passwd
$ uname -a
QNX node18 6.2.1 2003/05/17-02:28:40edt x86pc x86
$ pax -w -s 'T^/etc/TT' /etc/passwd | pax -v
USTAR format archive
-rw-r--r-- 0 root root 430 Jun 17 08:32 passwd
# this is a NetBSD 1.4 pax executable running under NetBSD 1.6
$ cksum ./bin/pax ; ls -l ./bin/pax
1498629648 262144 ./bin/pax
-r-xr-xr-x 1 kirk techies 262144 Oct 31 2000 ./bin/pax
$ ./bin/pax -w -s 'T^/etc/TT' /etc/passwd | ./bin/pax -v
-rw-r--r-- 1 root wheel 1044 Nov 20 17:28 passwd
pax: ustar vol 1, 1 files, 4096 bytes read, 0 bytes written in 1 secs (4096 bytes/sec)
Now with NetBSD 1.6, the behaviour is different because the replacement
didn't happen:
$ uname -a
NetBSD greyhawk 1.6 NetBSD 1.6 (GREYHAWK) #0: Tue Nov 18 22:00:12 EST 2003 kirk@greyhawk:/usr/src/sys/arch/i386/compile/GREYHAWK i386
$ pax -w -s 'T^/etc/TT' /etc/passwd | pax -v
pax: Removing leading / from absolute path names in the archive
-rw-r--r-- 1 root wheel 1044 Nov 20 17:28 etc/passwd
pax: ustar vol 1, 1 files, 4096 bytes read, 0 bytes written in 1 secs (4096 bytes/sec)
But this works:
greyhawk$ pax -A -w -s 'T^/etc/TT' /etc/passwd | pax -v
-rw-r--r-- 1 root wheel 1044 Nov 20 17:28 passwd
pax: ustar vol 1, 1 files, 4096 bytes read, 0 bytes written in 1 secs (4096 bytes/sec)
So, it work appear the leading "/" removal is happening before the replacement
string processing. I would guess the leading "/" removal should happen
after the replacement string processing, not before. I think this is a bug
because I would expect the "-s replstr" feature work as it did before.
>How-To-Repeat:
$ pax -w -s 'T^/etc/TT' /etc/passwd | pax -v
pax: Removing leading / from absolute path names in the archive
-rw-r--r-- 1 root wheel 1044 Nov 20 17:28 etc/passwd
pax: ustar vol 1, 1 files, 4096 bytes read, 0 bytes written in 1 secs (4096 bytes/sec)
>Fix:
The work-a-round is to use the "-A" argument when using the "-s" argument.
The fix is to do the leading "/" removal after the replacement string
processing, not before.
>Release-Note:
>Audit-Trail:
>Unformatted: