[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-tar] Possible tar bug with -C, --from-files stdin and --null
From: |
Daryl Tester |
Subject: |
[Bug-tar] Possible tar bug with -C, --from-files stdin and --null |
Date: |
Tue, 23 Sep 2008 10:06:27 +0930 |
User-agent: |
Thunderbird 1.5.0.14ubu (X11/20080724) |
Hi.
I seem to have hit a possible bug with gnu-tar (versions 1.19 and 1.16)
trying to use the --null form of --from-files (-T) in conjunction with
-C (change directory). Apologies for not trying it on the latest tar -
I don't have a non-production system to compile that version on at the
moment.
The background is that I'm doing "programmatic backups", where I'm
selecting a set of files to be backed up under script control,
then feeding it into tar via stdin.
I'll show by examples - it's quite possible the misunderstanding is
mine.
Using -C and -T works (non-null):
$ echo 'hosts' | tar -cf - -C /etc -T - | tar -tvf -
-rw-r--r-- root/root 221 2008-06-06 11:53 hosts
Confirming null terminated string is correct:
# echo -ne 'hosts\0' | hexdump -C
00000000 68 6f 73 74 73 00 |hosts.|
00000006
Using -T and --null works:
$ echo -ne '/etc/hosts\0' | tar -cf - --null -T - | tar -tvf -
tar: Removing leading `/' from member names
-rw-r--r-- root/root 221 2008-06-06 11:53 etc/hosts
Using -T, -C and --null "fails" to archive the specified file, in that
it seems to default to a behaviour as if I has specified ".".
$ echo -ne 'hosts\0' | tar -cf - -C /etc --null -T - | tar -tvf - | head
tar: Removing leading `/' from member names
drwxr-xr-x root/root 0 2008-09-22 20:22 etc/
drwxr-xr-x root/root 0 2008-03-27 04:00 etc/gnupg/
drwxr-xr-x root/root 0 2008-04-08 07:14 etc/opt/
drwxr-xr-x root/root 0 2008-04-08 07:14 etc/news/
-rw------- root/root 1 2008-03-26 00:38 etc/at.deny
lrwxrwxrwx root/root 0 2008-06-06 11:53 etc/grub.conf ->
../boot/grub/grub.conf
-rw-r--r-- root/root 10814 2006-02-21 08:25 etc/ltrace.conf
-rw-r--r-- root/root 112 2008-02-22 09:06 etc/mail.rc
-rw-r--r-- root/root 59 2006-01-31 23:36 etc/filesystems
lrwxrwxrwx root/root 0 2008-06-06 13:45 etc/rc -> rc.d/rc
The "-C" option appears to be sensitive to where it's placed on
the command line - I had tar report that it couldn't archive
the specified file due to it not being found which was resolved
by placing -C before the --files-from option, but the documentation
didn't give (to me) any sense that this would be an issue:
$ echo 'hosts' | tar -cf - --files-from - -C /etc | tar -tvf -
tar: hosts: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors
$ echo 'hosts' | tar -cf - -C /etc --files-from - | tar -tvf -
-rw-r--r-- root/root 255 2007-12-26 18:24 hosts
I've subscribed to the list, so if there are any further requests
for clarifications or what-not feel free to either fling them my
way or back onto the list. Thanks.
--
Regards,
Daryl Tester
"A long time ago, I stopped thinking that 'User must click OK to
scary-looking message' was any sort of road bump for malware."
-- Valdis Kletnieks
- [Bug-tar] Possible tar bug with -C, --from-files stdin and --null,
Daryl Tester <=