[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-tar] GNU tar fails to treat leading slash consistently
From: |
Stan Sieler |
Subject: |
[Bug-tar] GNU tar fails to treat leading slash consistently |
Date: |
Mon, 25 Jan 2010 11:26:21 -0800 (PST) |
Hi,
GNU tar 1.14
(This is my first email to any GNU bug report destination, so please forgive me
if I screwed up protocol-wise.)
I had a bug report from one of my users, which boils down to:
He did:
tar cvf foo.tar /fum
followed by:
tar xvf foo.tar /fum
which failed with:
tar: /fum: Not found in archive
This seems to reflect two bugs in GNU tar (one fairly important, since it
cost us a day of work, and relatively minor).
We create a backup of our NFS server by doing:
tar --totals --index-file=backup.index -cRf backup.tar /c
GNU tar responds:
tar: Removing leading `/' from member names
and proceeds to copy the files to the file "backup.tar", generating a list of
files stored in the file "backup.index".
(We know we could use -P, of course.)
Bug 1:
GNU tar fails to strip the leading slash when looking for a file to restore
(and -P
is not specified). (Example failure shown earlier.)
Argument in favor of interpreting this behavior as a bug:
If it removes it at "c" time, it should remove it at "x" time!
(I.e., consistency)
Note that fixing this will not hurt existing tar users ... I doubt any do
things like:
tar cvf ... /something (i.e., no "-P")
and then *count* on: tar xvf ... /something *FAILING*.
Thus, if tar suddenly starts treating "/something" as "something" for an "x",
it will not cause backward incompatibilities.
Bug 2 (minor, misnamed keyword)
(Background: the index file shows each file with a leading slash, even
without -P)
The "index-file" option is misnamed ... it does not create a file containing
the list of files *on* the tape, but a list of files copied *to* the tape.
The distinction is important :)
The man page correctly documents "--index-file" as:
send verbose output to FILE instead of stdout
...note the lack of the word "index".
Elsewhere, we see that "verbose output" includes a list of files
*processed* (i.e., the index file correctly has a list of the
original names, including leading slash).
I see three fixes:
1. rename the option to list-of-processed-files
(and quietly recognize "index-file" as a synonym for it)
2. have the index-file should contain the de-slashed names, and truly be
an index file.
3. fix bug 1 above, which allows filenames from the current index file
(with leading
slashes) to be provided (unedited) as input to "x" (i.e., having the
file be
a usable index file again). (With this fix, one might consider noting
in the
documentation that "index-file"is a historical mistake for the option
name,
or change the documentation to state that it *is* a list of files on
the tape,
in case we find future cases where the files-on-tape differ from
files-processed.)
thanks!
--
Stan Sieler
work: www.allegro.com
personal: www.sieler.com/wanted/index.html
- [Bug-tar] GNU tar fails to treat leading slash consistently,
Stan Sieler <=