[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] Modifying Volume Label with tar.
From: |
Ralph Corderoy |
Subject: |
Re: [Bug-tar] Modifying Volume Label with tar. |
Date: |
Wed, 25 May 2005 10:37:07 +0100 |
Hi Helmut,
> Ralph Corderoy <address@hidden> writes:
> > tar -V something -cf bar.tar dummyfile
> >
> > And is there any way to create a tar file with nothing but the
> > volume label, i.e. remove the need for dummyfile above?
>
> You could give
>
> $ tar -V something -cf bar.tar --files-from=/dev/null
>
> a try.
Thanks, that works but shows up another inconsistency.
$ tar -V foo -cf - | tar tvf -
tar: Cowardly refusing to create an empty archive
Try `tar --help' for more information.
$ tar -V foo -cf - --files-from /dev/null | tar tvf -
V--------- 0/0 0 2005-05-25 10:27:24 foo--Volume Header--
$ tar -cf - --files-from /dev/null | tar tvf -
$ tar -cf - --files-from /dev/null | wc -c
10240
$ tar -cf - --files-from /dev/null | od -c
0000000 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
*
0024000
$
If there's no files specified in argv[] then tar's a coward. But if
--files/from /dev/null is used then tar's happy to create an empty
archive.
I guess it's trying to avoid the `tar cf important_file' user error
where the tar filename has been omitted, but it makes creating an empty
archive, or an archive with just a volume label, harder in a portable
way, i.e. having to know the name of /dev/null on this platform.
Perhaps tar doesn't need to be a coward where the tar filename has been
specified as stdout?
tar -cf - # OK, won't trample anything.
tar -cf foo # Don't create empty archive in case of user error.
Although personally, I think it shouldn't be a coward at all since most
users learn through
tar cf *.c *.h
and tar's cowardlyness doesn't help them.
Cheers,
Ralph.