[Bash-completion-devel] Bug#698162: bash-completion: bash completion leaks file descriptors to child processes (commands)

Håkan Johansson f96hajo at chalmers.se
Mon Jan 14 17:49:00 UTC 2013


Package: bash-completion
Version: 1:2.0-1
Severity: normal

Dear Maintainer,

A program started from bash sometimes unexpectedly had file descriptor 3 open.
(Only 0, 1 and 2 are expected.)

Steps to reproduce:

- start new bash
- hit tab one or a few times
- execute 'cat /dev/random' (will keep the process alive)
- find its pid (ps -Af | grep cat)
- ls -l /proc/<pid>/fd

gives e.g. a list of

ls -l /proc/24629/fd
total 0
lrwx------ 1 htj f2b 64 Jan 14 18:42 0 -> /dev/pts/9
lrwx------ 1 htj f2b 64 Jan 14 18:42 1 -> /dev/pts/9
lr-x------ 1 htj f2b 64 Jan 14 18:42 10 -> /dev/random
lrwx------ 1 htj f2b 64 Jan 14 18:42 2 -> /dev/pts/9
lr-x------ 1 htj f2b 64 Jan 14 18:42 3 -> /usr/share/bash-
completion/completions
lr-x------ 1 htj f2b 64 Jan 14 18:42 4 -> /usr/share/bash-
completion/completions
lr-x------ 1 htj f2b 64 Jan 14 18:42 5 -> /usr/share/bash-
completion/completions
lr-x------ 1 htj f2b 64 Jan 14 18:42 6 -> /usr/share/bash-
completion/completions
lr-x------ 1 htj f2b 64 Jan 14 18:42 7 -> /usr/share/bash-
completion/completions
lr-x------ 1 htj f2b 64 Jan 14 18:42 8 -> /usr/share/bash-
completion/completions
lr-x------ 1 htj f2b 64 Jan 14 18:42 9 -> /usr/share/bash-
completion/completions

I would not expect cat to have file descripts 3-9 open above.  This example was
with hitting tab 7 times.



-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bash-completion depends on:
ii  bash  4.2+dfsg-0.1
ii  dpkg  1.16.9

bash-completion recommends no packages.

bash-completion suggests no packages.



More information about the Bash-completion-devel mailing list