bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] Feature request: counterpiece to option sequence "--null"


From: Helmut Waitzmann
Subject: Re: [Bug-tar] Feature request: counterpiece to option sequence "--null" "--files-from=..." for option "--list"
Date: Tue, 31 Aug 2004 16:51:28 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Sergey Poznyakoff <address@hidden> writes:

>Helmut Waitzmann <address@hidden> wrote:
>
>> So I'd like to have a "--list-null" option, which would list the contents
>> of the archive as a NUL separated list of member names:
>
>I'd rather extend the semantics of --null to cover archive listing as
>well. It won't break the existing functionality in any way.

It would make it impossible to make tar list some archive member names in
a human readable form, when the archive member names to be listed are fed
into tar with the "--files-from" and "--null" options, as it would result
in a NUL separated member list with control characters not quoted.

So there should be a way to independently request NULLifying as well the
incoming as the outgoing member list.

Also it is not clear to me, what should be done, if the "--verbose" option is
supplied, too:

tar -f archive.tar --files-from=a_list_of_NUL_terminated_member_names \
    --null --list --verbose

Should the listing be a NUL separated list of the form

<file-type>NUL<permissions>NUL<owner>NUL<group>NUL<size>NUL<mtime>NUL<name>NUL 
...

, which would I prefer to the form

<file-type-and-permissions> <owner>/<group> <size> <mtime>NUL<name>NUL ...

as it is easier to process, for example with

xargs --null -e -r -n 7 -- sh -c \
   'type="$1"; perm="$2"; ownername="$3"; groupname"$4"; size="$5";
   mtime="$6"; "name="$7"; do-what-you-like ...' sh 

or what about atime, ctime, uid, gid?  But I haven't got any idea of what
would be sensible, here.  Maybe some kind of selection could be supplied
to the "--list" option,
e.g. "--list=type,perm,ownername,groupname,size,mtime,name", which could
specify the order of the selected fields, too.  What do you think?

>> One benefit of this would be, that this list could be piped to xargs:
>> 
>> tar -f archive.tar --list-null | \
>> xargs --null -- process the archive member names as you like
>
>Well, but how will it differ from running:
>
> tar -f archive.tar --list | \
>   xargs -- process the archive member names as you like

With GNU xargs version 4.1.7, archive member names with spaces or control
characters will fail, as xargs doesn't understand the gnu tar quoting
style and splits lines with spaces in it, for example:

touch ' one leading space'
tar --create -f - ' one leading space' | tar --list -f - | \
xargs -e -r -- ls --

will fail.

Whereas

tar --create -f - ' one leading space' | tar --list-null -f - | \
xargs --null -e -r -- ls --

would work perfectly.

Regards,

Helmut
-- 
Wenn Sie mir E-Mail schreiben, stellen |  When writing me e-mail, please
Sie bitte vor meine E-Mail-Adresse     |  precede my e-mail address with
meinen Vor- und Nachnamen, etwa so:    |  my full name, like
Helmut Waitzmann <address@hidden>, (Helmut Waitzmann) address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]