[SRU] Tab completion with tar -df, -tf, and -xf don't support spaces in file name
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash-completion (Debian) |
Fix Released
|
Unknown
|
|||
bash-completion (Ubuntu) |
Fix Released
|
Medium
|
Brian Murray | ||
Precise |
Fix Released
|
Medium
|
Aditya V |
Bug Description
[Impact]
If a file has a space in its name and either -df, -tf, or -xf are used on the file while the user is using tab completion, it fails to add an escape character, so 'tar' treats it as two separate files. Because of this, tab-completion can't properly be used with the options -cf, -df, or -tf with tar. This can be a very large problem for inexperienced users, as some won't know that escape characters are supposed to be used, if they even know what they are.
-df: lists the differences between archives
-tf: lists contents of archive
-xf: extracts archive
[Stable Fix]
Running this command will fix the problem: "sed -i 's/\?(\
[Development Fix]
In the file "completions/tar", the characters 'd', 't', and 'x' were added to the regex (?) checking for the options passed to tar.
[Test Case]
1. Create the file 'test file': touch test\ file
2. Press tab after typing this: tar -cf test
It should show a "\" as an escape character preceding the space, allowing tar to correctly interpret the name as one file, not two
Result: tar -cf test\ file
3. Press tab after typing this: tar -df test
It should then show "tar -df test file", making tar interpret the archive as 'test' and 'file' as another argument.
Intended result (after applying patch): tar -df test\ file
4. Press tab after typing this: tar -tf test
It should then show "tar -tf test file", making tar interpret the archive as 'test' and 'file' as another argument.
Intended result (after applying patch): tar -tf test\ file
5. Press tab after typing this: tar -xf test
It should then show "tar -xf test file", making tar interpret the archive as 'test' and 'file' as another argument.
Intended result (after applying patch): tar -xf test\ file
Note that even pressing tab after "tar -xf test\ file" will result in "tar -xf test file"
[Regression Potential]
Small, as only one lines was changed, and only three characters were added to it ('d','t', and 'x' - each of the arguments that weren't working).
ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: bash-completion 1:1.3-1ubuntu8
ProcVersionSign
Uname: Linux 3.2.0-26-generic x86_64
ApportVersion: 2.0.1-0ubuntu10
Architecture: amd64
Date: Fri Jun 29 12:55:34 2012
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Alpha amd64 (20120319)
PackageArchitec
ProcEnviron:
TERM=xterm
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: bash-completion
UpgradeStatus: No upgrade log present (probably fresh install)
description: | updated |
Changed in bash-completion (Ubuntu Precise): | |
importance: | Undecided → Medium |
description: | updated |
summary: |
- [SRU] Tab completion with tar -cf, -df, and -tx don't support spaces in + [SRU] Tab completion with tar -df, -tf, and -xf don't support spaces in file name |
Changed in bash-completion (Ubuntu Precise): | |
status: | New → Confirmed |
description: | updated |
Changed in bash-completion (Debian): | |
status: | Unknown → New |
Changed in bash-completion (Debian): | |
status: | New → Fix Released |
This seems to do the trick, though I don't know if it is the correct (or full) fix.