[SRU] Tab completion with tar -df, -tf, and -xf don't support spaces in file name

Bug #1019217 reported by Otus on 2012-06-29
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bash-completion (Debian)
Fix Released
Unknown
bash-completion (Ubuntu)
Medium
Brian Murray
Precise
Medium
kroq-gar78

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/\?(\-)\[cr\]\*f/\?(\-)\[cdrtx\]\*f/g' /etc/bash_completion.d/tar" (run without quotes)

[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
ProcVersionSignature: Ubuntu 3.2.0-26.41-generic 3.2.19
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)
PackageArchitecture: all
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)

Otus (jan-varho) wrote :
Otus (jan-varho) wrote :

This seems to do the trick, though I don't know if it is the correct (or full) fix.

The attachment "0001-Fix-tar-xf-completion-with-spaces-in-file-names.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in bash-completion (Ubuntu):
status: New → Confirmed
kroq-gar78 (kroq-gar78) wrote :

This also happens with -tf. I'm checking other options now. I'll modify your patch and attach it.

kroq-gar78 (kroq-gar78) wrote :

Here's the debdiff with the patch updated for -c, -d, -t, and -x.

Brian Murray (brian-murray) wrote :

Thanks for you patch - I'll get this uploaded to quantal. However, it would be good to forward this patch to debian.

Changed in bash-completion (Ubuntu):
assignee: nobody → Brian Murray (brian-murray)
importance: Undecided → Medium
status: Confirmed → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bash-completion - 1:1.3-1ubuntu9

---------------
bash-completion (1:1.3-1ubuntu9) quantal; urgency=low

  * debian/patches/tar-spaces.patch: use escape characters with spaces
    for options -d, -t, and -x (LP: #1019217)
 -- Aditya Vaidya <email address hidden> Wed, 18 Jul 2012 15:43:29 -0700

Changed in bash-completion (Ubuntu):
status: In Progress → Fix Released
Brian Murray (brian-murray) wrote :

If you feel this is worth fixing in Precise I'll be happy to upload the same debdiff provided we have the information required for the SRU process. See https://wiki.ubuntu.com/StableReleaseUpdates for more details.

kroq-gar78 (kroq-gar78) wrote :

I think I'll fill out an SRU for this, so can you please target it to Precise? Also, I'll submit the patch to Debian.

kroq-gar78 (kroq-gar78) wrote :

Temporarily assigning the Debian bug to myself as a reminder to forward the patch.

Changed in bash-completion (Debian):
assignee: nobody → kroq-gar78 (kroq-gar78)
summary: - Tab completion with tar -xf doesn't support spaces in file name
+ [SRU] Tab completion with tar -cf, -df, and -tx don't support spaces in
+ file name
kroq-gar78 (kroq-gar78) on 2012-07-19
description: updated
Changed in bash-completion (Ubuntu Precise):
importance: Undecided → Medium
kroq-gar78 (kroq-gar78) on 2012-07-19
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
kroq-gar78 (kroq-gar78) on 2012-07-19
description: updated
kroq-gar78 (kroq-gar78) wrote :

Ok, I think the SRU is ready.

description: updated
kroq-gar78 (kroq-gar78) wrote :

I'll subscribe Ubuntu SRU since the form at the top is filled out.

Changed in bash-completion (Ubuntu Precise):
assignee: nobody → kroq-gar78 (kroq-gar78)
Brian Murray (brian-murray) wrote :

Wow, I totally missed this some how but have now uploaded bash-completion to the precise-proposed queue.

Hah, no problem. It looks like I also forgot to send it to Debian :P

kroq-gar78 (kroq-gar78) wrote :

Finally forwarded the bug to Debian.

Changed in bash-completion (Debian):
assignee: kroq-gar78 (kroq-gar78) → nobody
importance: Undecided → Unknown
status: New → Unknown
Changed in bash-completion (Debian):
status: Unknown → New

Hello Otus, or anyone else affected,

Accepted bash-completion into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/bash-completion/1:1.3-1ubuntu8.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in bash-completion (Ubuntu Precise):
status: Confirmed → Fix Committed
tags: added: verification-needed
Simon Déziel (sdeziel) wrote :

Works well using precise-proposed, thanks

tags: added: verification-done
removed: verification-needed

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bash-completion - 1:1.3-1ubuntu8.1

---------------
bash-completion (1:1.3-1ubuntu8.1) precise-proposed; urgency=low

  * debian/patches/tar-spaces.patch: use escape characters with spaces
    for options -d, -t, and -x (LP: #1019217)
 -- Aditya Vaidya <email address hidden> Fri, 29 Jun 2012 15:53:14 -0500

Changed in bash-completion (Ubuntu Precise):
status: Fix Committed → Fix Released
Changed in bash-completion (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.