Bug 633417

Summary: bash-completion with rsync, scp emits invalid commandline argument error
Product: [Fedora] Fedora EPEL Reporter: Andrew Lofthouse <loftyhauser>
Component: bash-completionAssignee: Ville Skyttä <ville.skytta>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: el5CC: sheltren, ville.skytta
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.2-4.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-25 17:27:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Andrew Lofthouse 2010-09-13 18:07:40 UTC
Description of problem:

The latest bash-completion breaks when using rsync, scp and trying to complete path names.  For example, with rsync bash pops up an error that the pidof command is not found.  Adding /sbin to the path (to find pidof) causes the following error (but the completion still seems to work):

Invalid command line argument: ?


Version-Release number of selected component (if applicable):
1.1-6.el5

How reproducible:
Every time

Steps to Reproduce:
1. install bash-completion
2. try to use commandline completion with rsync or scp
rsync -avux --delete ~/ [tab]
  
Actual results:
Without /sbin in path, bash complains that pidof is not found.
With /sbin in path, bash complains about an invalid command line error

Expected results:
No error is emitted when using tab to complete the pathname

Comment 1 Ville Skyttä 2010-09-13 18:39:42 UTC
Reproduced, except I cannot get the "Invalid command line argument: ?" error to occur when /sbin is in $PATH.

Could you do a "set -x" in a shell while /sbin is in $PATH and attach the output here (be sure to review and possibly edit it before posting in case it has something you'd rather not post in public)?


A workaround for now is to apply the latter hunk of this patch to /etc/bash_completion: http://git.debian.org/?p=bash-completion/bash-completion.git;a=commitdiff;h=bb8912b

Another workaround is to remove the avahi-tools package in case you don't need it.

Comment 2 Andrew Lofthouse 2010-09-14 13:15:34 UTC
How about I post just the part that looks useful?  I can post the rest if you need...

Here's the command line -- notice that I hit [tab] after "rsync -avux --delete ~/":

$ rsync -avux --delete ~/+ local cur prev shell i userhost path

Here's what looks to be the relevant output:

+ type avahi-browse
++ pidof avahi-daemon
+ '[' -n '4466 4465' ']'
+ COMPREPLY=("${COMPREPLY[@]}" $(
                compgen -W "$( avahi-browse -cpr _workstation._tcp |                 grep ^= | cut -d\; -f7 | sort -u )" -- "$cur" ))
+++ grep '^='
+++ cut '-d;' -f7
+++ sort -u
+++ avahi-browse -cpr _workstation._tcp
Invalid command line argument: ?

Comment 3 Ville Skyttä 2010-09-14 17:57:40 UTC
That may be enough, thanks.  Do you get the same error message if you run these commands directly?

avahi-browse -cpr _workstation._tcp

avahi-browse -cpr _workstation._tcp | grep ^= | cut -d\; -f7 | sort -u

Comment 4 Andrew Lofthouse 2010-09-14 23:49:45 UTC
Yes in both cases.

Comment 5 Ville Skyttä 2010-09-15 06:08:17 UTC
Ouch, EL5's avahi-browse doesn't support the -p option; I don't know how I missed that earlier.

While waiting for a fixed package, the workarounds in comment 1 should work, and additionally the whole "if" block that deals with avahi-daemon and avahi-browse in /etc/bash_completion can be removed or commented out.

Comment 6 Fedora Update System 2010-10-04 17:28:08 UTC
bash-completion-1.2-3.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/bash-completion-1.2-3.el5

Comment 7 Fedora Update System 2010-10-25 16:34:41 UTC
bash-completion-1.2-4.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.