[Bash-completion-devel] GNU tar completion

Pavel Raiskup praiskup at redhat.com
Fri Apr 18 12:49:35 UTC 2014


> After: Returned mail: see transcript for details
>
> ----- The following addresses had permanent fatal errors -----
> <bash-completion-devel at lists.alioth.debian.org>
>
> .. Trying the luck once more.

On Thursday 17 of April 2014 15:14:34 Pavel Raiskup wrote:
> On Thursday 17 of April 2014 15:57:11 Ville Skyttä wrote:
> > Just one comment for now:
> >
> > > +# Everything is parsed from `tar --help` output
> > 
> > Have you tested this with tar implementations that don't do --help
> > and/or output something very different for it than GNU tar, for
> > example the Solaris and BSD tars?
> 
> Good point, I haven't test it.  I expected that it simply does not work.
> 
> > What's the expected outcome with them?  Even though the completion file
> > says "for GNU tar", in practice it is being used with other tars as
> > well.
> 
> That is fail, as I missed that the current completion code is in practice
> used against other than GNU tar implementation.  If nobody beats me, I'll
> Post yet another patch with some 'general' tar completion code.  That will
> be used for 'bsdtar', 'star' and for 'tar' if 'tar' != GNU tar.

Hmm, I give up for a moment.  Ville or others, to feel at least a little
bit sane with the 'star/bsdtar' compatibility, we need following:

  - library-like file(s), related for tar completion issues (e.g.
    completions/../lib/tar/SOMETHING).  That will share some code among..:

  - 'star', 'bsdtar', 'gtar', 'posix_tar' completion files in
    'completions' directory,

  - the 'tar' completion file will be just wrapper around all of those
    files.  Effectively using just that one which corresponds to
    underlying tar implementation.  This may be also user-configurable
    [1].

  - the 'posix_tar' completion will just work with the old-compat options
    of tar, e.g. 'tar tvvfw Archive.tar File' [2].  Will be used if non of
    known implementation is used.

These steps lets us keep the 'gtar', 'bsdtar', 'star' completions files
easily replaceable by corresponding tool's upstream guys [3].  So this
seems to be quite flexible approach, though more code is needed.  Also the
dynamic loading of completion should stay OK.

Yet another (lazier) approach is to disable 'tar' completion for non-GNU
tars, because the current status is really more-like designed just for GNU
tar and gives very little benefit for non-GNU tar users.

Any ideas?  I can come up with patch but I need to know that it is
suitable in advance,

Pavel

[1] .. by some env. variable?  May be useful if user wants to alias its
    'tar' to 'bsdtar', e.g.

[2] Side note:  I don't want to advice this by default because non of
    mentioned upstreams suggests that style of options by default these
    days.

[3] It is IMO always better if the bash-completion file is provided
    by upstream of the corresponding tool (but I don't see any policy in
    bash-completion project).




More information about the Bash-completion-devel mailing list