[Bug 1312243] Re: error messages completing args inside $()

Malte Skoruppa malte.skoruppa at gmail.com
Wed Jun 24 10:46:16 UTC 2015


This bug is not upstream. This bug does not happen with the
bash_completion library provided in the upstream Git repository, neither
in its master branch nor in its 2.1 branch (most current stable
revision).

Rather, this bug is introduced by an Ubuntu patch that is applied
against the upstream 2.1 stable version to produce the bash-completion
Ubuntu package.

More precisely, the guilty patch is 00-fix_quote_readline_by_ref.patch
by Juan José Ciarlante, a Canonical dev. I have subscribed Juan to this
bug report. (Note: use 'apt-get source bash-completion' to obtain the
patch in a directory called debian/patches/)

Beside two other changes, this patch introduces the following lines:

+    # Replace double escaping ( \\ ) by single ( \ )
+    # This happens always when argument is already escaped at cmdline,
+    # and passed to this function as e.g.: file\ with\ spaces
+    [[ ${!2} == *\\* ]] && printf -v $2 %s "${1//\\\\/\\}"
+

This change is accompanied by the following comment:

Subject: fix _quote_readline_by_ref to:
...
 - replace double escaping to single (eg for completing file/paths with
   spaces)

Removing those lines fixes this bug. I am not sure what bug these
particular lines are supposed to fix: Completing files/paths with spaces
works just as well in the upstream version.

Please note that the bug we are talking about here is the error message
"unexpected EOF while looking for matching `)'" when attempting to
complete a command within $(). Generally, bash completion inside command
substitution appears to be broken with Bash 4.3, but at least the
upstream version does not output that particular annoying error mesage.

(@Peter Cordes: If you can actually reproduce this bug with an upstream
revision, let me know how. However I do not believe that this will be
possible. Hence the upstream devs cannot fix this bug. I am not sure
whether your proposed fix of slightly changing the [[ ${!2} == \$* ]]
test as you explained in
https://alioth.debian.org/tracker/?func=detail&aid=314667&group_id=100114&atid=413095
does not break some other intended functionality. If Juan's change
described above is not necessary any longer, the best option may simply
be to revert this change. Hopefully Juan can shed some light on this.)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash-completion in Ubuntu.
https://bugs.launchpad.net/bugs/1312243

Title:
  error messages completing args inside $()

Status in bash-completion package in Ubuntu:
  Confirmed
Status in bash-completion package in Debian:
  New

Bug description:
  Hello. Please observe the following transcript (only [TAB] has been
  inserted to indicate the position where I hit TAB):

  In Trusty:

  $ cat <<EOF > foo
  > Test
  > EOF
  $ echo $(< foo)
  Test
  $ echo $(< fo[TAB]bash: unexpected EOF while looking for matching `)'
  bash: syntax error: unexpected end of file
  ^C
  $ echo $(cat fo[TAB]bash: unexpected EOF while looking for matching `)'
  bash: syntax error: unexpected end of file

  In Saucy:

  $ cat <<EOF > foo
  > Test
  > EOF
  $ echo $(< foo)
  Test
  $ echo $(< fo[TAB]o^C
  $ echo $(cat fo[TAB]o^C

  Simply put, once I start a command substitution with $( I am not able
  to use the [TAB] completion in Trusty any longer while this was
  working file in Saucy. I hope this can be fixed soon since it really
  hampers use of the command-line. Thanks!

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash-completion/+bug/1312243/+subscriptions



More information about the foundations-bugs mailing list