[Bug 1372286] Re: unwanted space after directory completion (probably old cruft after upgrades)

Peter Cordes peter at cordes.ca
Thu Dec 18 17:13:34 UTC 2014


> Sorry for not getting back earlier.

No worries.  Glad you got your systems sorted.

Not closing this bug, because your problem wasn't this bug after all..
>.<  I still want to leave this bug here for the purpose I editted the
OP to.

> Nonetheless I'd like to know if there is way to detect if
bash_completion is already sourced other than checking the
BASH_COMPLETION variable.

Ubuntu 14.04 and git HEAD (of bash-completion) both set BASH_COMPLETION_COMPAT_DIR as a read-only shell variable.
The problematically-located /etc/profile.d/bash_completion.sh checks that.  (problematic because bash_completion needs to be sourced for every shell, not just login shells.)

Until COMPAT_DIR support goes away  (the /etc/bash_completion.d/ files
that are sourced at startup, instead of dynamically when needed), this
will be fairly foolproof, unless it was introduced too recently to be
present on your old systems.

Fairly completely foolproof would be to check if there is a completion
loaded for ls.

if ! complete -p ls &> /dev/null;
  source something
fi

-- 
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/1372286

Title:
  unwanted space after directory completion (probably old cruft after
  upgrades)

Status in bash-completion package in Ubuntu:
  Confirmed

Bug description:
  With bash-completion 2.1, some users are seeing broken completion for
  directories, with a space being added at the end, requiring a
  [BACKSPACE]/[TAB].

  Testcase copied from bug 1000470, which I'm closing because it was
  probably from acroread.sh, which is now blacklisted.

  Extra space scenario:
  find /op<TAB> ==> find /opt<Space>

  Backslash scenario:
  cd ~
  mkdir -p test\ 1/test
  find test\ 1/t<TAB>
  find test 1/test
  find: `test': No such file or directory
  find: `1/test': No such file or directory

  
  This bug can get closed when we find out what other old files get left in /etc/bash_completion.d and cause problems, so we can blacklist them, too.

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



More information about the foundations-bugs mailing list