compgen -C Appends Extra Empty String Arguments

Bug #1265090 reported by Charles R. Harwood
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
New
Low
Unassigned

Bug Description

On Precise 12.04

When compgen is used to call an external command via -C, it adds three extra empty string arguments. While some commands are ok with that, it breaks many others.

==============================
Simple Test Case:

$ cat > /tmp/print_args <<EOF
#!/usr/bin/env python
import sys
print >>sys.stderr, sys.argv
EOF

$ chmod +x /tmp/print_args

# Without compgen
$ /tmp/print_args
['/tmp/print_args']

# With compgen
$ compgen -C '/tmp/print_args'
['/tmp/print_args', '', '', '']

==============================
Note that this was found remotely without access to a browser. From ubuntu-bug:
ProblemType: Bug
ApportVersion: 2.0.1-0ubuntu17.6
Architecture: amd64
Date: Mon Dec 30 17:39:08 2013
Dependencies:
 base-files 6.5ubuntu6.6
 bash 4.2-2ubuntu2.1
 coreutils 8.13-3ubuntu3.2
 dash 0.5.7-2ubuntu2
 debconf 1.5.42ubuntu1
 debianutils 4.2.1ubuntu2
 dpkg 1.16.1.2ubuntu7.2
 gcc-4.6-base 4.6.3-1ubuntu5
 libacl1 2.2.51-5ubuntu1
 libattr1 1:2.4.46-5ubuntu1
 libbz2-1.0 1.0.6-1
 libc-bin 2.15-0ubuntu10.5
 libc6 2.15-0ubuntu10.5
 libgcc1 1:4.6.3-1ubuntu5
 liblzma5 5.1.1alpha+20110809-3
 libselinux1 2.1.0-4.1ubuntu1
 libtinfo5 5.9-4
 multiarch-support 2.15-0ubuntu10.5
 perl-base 5.14.2-6ubuntu2.3
 sensible-utils 0.0.6ubuntu2
 tar 1.26-4ubuntu1
 tzdata 2013g-0ubuntu0.12.04
 xz-utils 5.1.1alpha+20110809-3
 zlib1g 1:1.2.3.4.dfsg-3ubuntu4
DistroRelease: Ubuntu 12.04
InstallationMedia: Kubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
MarkForUpload: True
NonfreeKernelModules: fglrx
Package: bash-completion 1:1.3-1ubuntu8.1
PackageArchitecture: all
ProcEnviron:
 TERM=screen
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 3.2.0-57.87-generic 3.2.52
SourcePackage: bash-completion
Tags: precise
Uname: Linux 3.2.0-57-generic x86_64
UpgradeStatus: Upgraded to precise on 2012-04-30 (609 days ago)

Tags: precise
Mathew Hodson (mhodson)
tags: added: precise
removed: arguments bash cli completion
Changed in bash-completion (Ubuntu):
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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