← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 1390061] Re: bash-completion tilde expansion every time

 

Hello Ove, or anyone else affected,

Accepted bash-completion into trusty-proposed. The package will build
now and be available at https://launchpad.net/ubuntu/+source/bash-
completion/1:2.1-4ubuntu0.2 in a few hours, and then in the -proposed
repository.

Please help us by testing this new package.  See
https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to
enable and use -proposed.  Your feedback will aid us getting this update
out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug,
mentioning the version of the package you tested, and change the tag
from verification-needed to verification-done. If it does not fix the
bug for you, please add a comment stating that, and change the tag to
verification-failed.  In either case, details of your testing will help
us make a better decision.

Further information regarding the verification process can be found at
https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in
advance!

** Changed in: bash-completion (Ubuntu Trusty)
       Status: In Progress => Fix Committed

** Tags added: verification-needed

** Also affects: bash-completion (Ubuntu Wily)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1390061

Title:
  bash-completion tilde expansion every time

Status in bash-completion package in Ubuntu:
  Fix Released
Status in bash-completion source package in Trusty:
  Fix Committed
Status in bash-completion source package in Wily:
  New
Status in bash-completion source package in Xenial:
  In Progress

Bug description:
  [Impact]

  when authenticate AD, with bask-completion, it's very slow.

  [Testcase]

  Below command should output nothing.

  root@ubuntu1404:~# strace bash -c ". /etc/bash_completion; quote_readline '/something'; echo" 2>&1 | grep /etc/passwd
  root@ubuntu1404:~# strace bash -c ". /etc/bash_completion; quote_readline '/something'; echo" 2>&1 | grep sss

  but we have something

  root@ubuntu1404:~# strace bash -c ". /etc/bash_completion; quote_readline '/something'; echo" 2>&1 | grep /etc/passwd
  open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
  root@ubuntu1404:~# strace bash -c ". /etc/bash_completion; quote_readline '/something'; echo" 2>&1 | grep sss
  open("/lib/i386-linux-gnu/libnss_sss.so.2", O_RDONLY|O_CLOEXEC) = 3
  open("/var/lib/sss/mc/passwd", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
  connect(4, {sa_family=AF_LOCAL, sun_path="/var/lib/sss/pipes/nss"}, 110) = 0

  [Regeression Potential]

  Regression possible about
  https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1288314

  but there is no problem with ~ completion in my test

  I thested ~/<Tab>/ ~/<Tab>/<Tab> with no problem

  [Other Info]

  This is not from upstream, no need to fix for upstream.
  But fix code seems harmless. just specify special character ~

  // The original description

  1) The release of Ubuntu you are using, via 'lsb_release -rd' or System -> About Ubuntu
  root@ubuntu1404:~# lsb_release -rd
  Description:    Ubuntu 14.04.1 LTS
  Release:        14.04

  2) The version of the package you are using, via 'apt-cache policy pkgname' or by checking in Software Center
  root@ubuntu1404:~# apt-cache policy bash-completion
  bash-completion:
    Installed: 1:2.1-4
    Candidate: 1:2.1-4
    Version table:
   *** 1:2.1-4 0
          500 http://se.archive.ubuntu.com/ubuntu/ trusty/main i386 Packages
          100 /var/lib/dpkg/status

  3) What you expected to happen

  When I use bash-completion it should not read the /etc/passwd file or contact the Active directory.
  It is very hard to see this problem unless you run this on a machine with slow authentication... but the commands below will show if the /etc/passwd or sssd are used by bash_completion or not:

  root@ubuntu1404:~# strace bash -c ". /etc/bash_completion; quote_readline '/something'; echo" 2>&1 | grep /etc/passwd
  root@ubuntu1404:~# strace bash -c ". /etc/bash_completion; quote_readline '/something'; echo" 2>&1 | grep sss

  When the ~ are escaped on line 545 and 547 in /usr/share/bash-
  completion/bash_completion then bash_completion works as expected.

  4) What happened instead

  Every time you use tab-completion in bash on ubuntu 14.04 it will read
  the /etc/passwd file and if sssd are installed and configured for
  Active Directory authentication it will talk to sssd... and this can
  be slow in some environments.

  root@ubuntu1404:~# strace bash -c ". /etc/bash_completion; quote_readline '/something'; echo" 2>&1 | grep /etc/passwd
  open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
  root@ubuntu1404:~# strace bash -c ". /etc/bash_completion; quote_readline '/something'; echo" 2>&1 | grep sss
  open("/lib/i386-linux-gnu/libnss_sss.so.2", O_RDONLY|O_CLOEXEC) = 3
  open("/var/lib/sss/mc/passwd", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
  connect(4, {sa_family=AF_LOCAL, sun_path="/var/lib/sss/pipes/nss"}, 110) = 0

  I have made a small patch for this problem and I have not found any side effects:
  --- /usr/share/bash-completion/bash_completion.orig     2014-11-06 10:36:14.981888369 +0100
  +++ /usr/share/bash-completion/bash_completion  2014-11-06 10:36:25.142070963 +0100
  @@ -542,9 +542,9 @@
       elif [[ $1 == \'* ]]; then
           # Leave out first character
           printf -v $2 %s "${1:1}"
  -    elif [[ $1 == ~* ]]; then
  +    elif [[ $1 == \~* ]]; then
           # avoid escaping first ~
  -        printf -v $2 ~%q "${1:1}"
  +        printf -v $2 \~%q "${1:1}"
       else
           printf -v $2 %q "$1"
       fi

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