Bug 1013776

Summary: bash-completion script for tar only handles dashless style cmd line args
Product: [Fedora] Fedora Reporter: Mansour Behabadi <mansour>
Component: bash-completionAssignee: Ville Skyttä <ville.skytta>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: rrakus, sheltren, ville.skytta
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-01 06:45:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch to fix the issue none

Description Mansour Behabadi 2013-09-30 18:24:04 UTC
Description of problem:

An example of a dashless (BSD?!) style tar command is:
$ tar xf somefile.tar.bz2

as opposed to:
$ tar --extract -f somefile.tar.bz2


Version-Release number of selected component (if applicable): 2.1-3


How reproducible: always


Steps to Reproduce:

1. Go to a directory where you have a tar file (e.g. archive.tar.gz) and other non tar files (e.g. face.png)

2. Type the following at the shell prompt and press <tab> twice:

   (a)$ tar xzf <tab><tab>
   (b)$ tar xf archive.tar.gz <tab><tab>
   (c)$ tar uf archive.tar.gz <tab><tab>

   (d)$ tar -x -z -f <tab><tab>
   (e)$ tar -x -f archive.tar.gz <tab><tab>
   (f)$ tar --update -f deleteme.tar <tab><tab>

Actual results:

(a) only list of dirs and archives that end with tar.gz
(b) list of files inside the tar archive
(c) list of files inside the tar archive

(d) all the files in cwd
(e) all the files in cwd
(f) bash gets stuck until ctrl+c is pressed


Expected results:

(a) and (d), (b) and (e), (c) and (f) should behave the same but they clearly do not.

Additional info:

Notice example (f): the bash is stuck and it gives the impression that some processing is going on, while in reality tar is waiting for input (due to mishandling of input), making the user waiting for no reason.

Comment 1 Mansour Behabadi 2013-09-30 18:25:46 UTC
Created attachment 805447 [details]
patch to fix the issue

I re-wrote most of tar completion script and it now handles all types of cmd line options (ie single/double dash and dashless).

Comment 2 Mansour Behabadi 2013-09-30 18:27:11 UTC
I have also reported this issue upstream at http://alioth.debian.org/tracker/index.php?func=detail&aid=314457&group_id=100114&atid=413095

Comment 3 Ville Skyttä 2013-10-01 06:45:36 UTC
Closing UPSTREAM as this is not Fedora specific and it's already in upstream BTS.