Shell lockup with on tab completion of tar with --acls option
Bug #1426107 reported by
Mike Matera
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash-completion (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Bash completion causes the shell to lockup when completing command lines for the TAR command. The following sequence of commands shows the problem:
# starting in an empty directory
mkdir foo
touch foo/bar
touch foo/bak
tar -cvf foo.tar <tab>
tar --acls -cvf foo.tar <tab>
After the last tab the shell is locked up permanently and is no longer usable. This only seems to happen when the --acls option is specified, though it may affect others too (I have only tried --acls).
To post a comment you must log in.
Digging into /usr/share/ bash-completion /completions/ tar I found some answers. Basically the completer doesn't understand the intent argument "-c" when the intent is not the first argument. That confused the program and it's trying to extract the index of a (nonexistant) tar file by running:
tar t foo.tar
Lacking the "f" argument TAR is reading from STDIN and that will hang us up forever. I tried CTRL-D but that didn't work.
Attached is a patch that works around the problem by blinding the completer when the first argument is --something. A better solution would be to fix the parser to understand arguments in any position but in the mean time it's better for my mental health not to crash.