Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Something rotten in tar completion



[Cc-ing PWS because mail I sent yesterday to zsh-users still hasn't
shown up there.]

On Dec 2,  3:54pm, Peter Stephenson wrote:
} Subject: Something rotten in tar completion
}
} If I try to complete after "tar xvzf ...", which is where I usually am
} completing (I don't tend to bother completing inside tar files), it's
} *incredibly* slow.  I suspect it's looking in the file, which it doesn't
} need to at this point --- it's only completing the name of the file.

Well, let's see ... _complete_debug with no zstyles at all ...

% tar xvzf <C-x ?>

It runs "tar --version" THREE TIMES to figure out which kind of tar and
what options it has.

Then:  _files -J -default- -g '*.((tar|TAR).(gz|GZ|Z)|tgz)(-.)'

... which invokes _path_files at least twice.  The result is a listing
of directory names and tar file names.

Tried the same thing with a partial file name on the line, got the same
results except directories were properly not completed.

But I don't see it examining the tarfile contents.  Looking at _tar, it
should only poke inside if it already has both a tarfile name and some
tar commands on the line.  Hmm, it IS legal to put a list of file names
to extract after "tar xf archive ..." -- it could be that it's trying
to populate that list because the "x" is present.

That does happen if I complete after "tar xvzf archive.tgz " but does
not if the cursor is still inside the word "archive.tgz".

At various places (_description, _path_files) it does look for the "fake",
"fake-always", and "fake-files" styles.  Could that have something to do
with it on your end?



Messages sorted by: Reverse Date, Date, Thread, Author