[konsole] [Bug 440990] New: Too many file descriptors inherited by the shell
bugzilla_noreply at kde.org
bugzilla_noreply at kde.org
Sun Aug 15 01:21:07 BST 2021
https://bugs.kde.org/show_bug.cgi?id=440990
Bug ID: 440990
Summary: Too many file descriptors inherited by the shell
Product: konsole
Version: 21.08.0
Platform: Other
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: konsole-devel at kde.org
Reporter: gus at marcais.net
Target Milestone: ---
SUMMARY
Konsole seems to start the shell with many (sometimes hundreds) file
descriptors still open, instead of just 0, 1 and 2. I presume konsole should
flag all of its file descriptors with O_CLOSEXEC so that they are not inherited
by the shell, but doesn't seem to do so.
To be fair, other terminals (but not Gnome terminal) display the same behavior.
So the problem of not closing these file descriptors may be upstream from
Konsole.
STEPS TO REPRODUCE
1. Open konsole
2. ls -l /dev/$$/fd
OBSERVED RESULT
```
gusqt at gus-laptop ~ 0 > ls -l /proc/$$/fd
total 0
lrwx------ 1 gusqt gusqt 64 Aug 14 19:58 0 -> /dev/pts/4
lrwx------ 1 gusqt gusqt 64 Aug 14 19:59 1 -> /dev/pts/4
lrwx------ 1 gusqt gusqt 64 Aug 14 19:59 10 -> /dev/pts/4
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 100 -> 'pipe:[180366]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 101 -> 'pipe:[180367]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 102 -> 'pipe:[173044]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 103 -> 'pipe:[174571]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 104 -> 'pipe:[194700]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 105 -> 'pipe:[198322]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 106 -> 'pipe:[174572]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 107 -> 'pipe:[174601]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 108 -> 'pipe:[174602]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 109 -> 'pipe:[174603]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 110 -> 'pipe:[174604]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 111 -> 'pipe:[174633]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 112 -> 'pipe:[174634]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 113 -> 'pipe:[174635]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 114 -> 'pipe:[176160]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 115 -> 'pipe:[176161]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 116 -> 'pipe:[174653]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 117 -> 'pipe:[174654]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 118 -> 'pipe:[174655]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 119 -> 'pipe:[187829]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 120 -> 'pipe:[187830]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 121 -> 'pipe:[198323]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 122 -> 'pipe:[198324]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 123 -> 'pipe:[199357]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 124 -> 'pipe:[199358]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 128 -> 'pipe:[199359]'
lrwx------ 1 gusqt gusqt 64 Aug 14 19:59 2 -> /dev/pts/4
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 25 -> 'pipe:[108056]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 26 -> 'pipe:[108071]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 27 -> 'pipe:[108072]'
lrwx------ 1 gusqt gusqt 64 Aug 14 19:59 3 -> /run/user/1008/wayland-0.lock
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 34 -> anon_inode:inotify
lrwx------ 1 gusqt gusqt 64 Aug 14 19:59 37 -> '/memfd:pulseaudio (deleted)'
lrwx------ 1 gusqt gusqt 64 Aug 14 19:59 4 -> 'socket:[84535]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 46 -> 'pipe:[114303]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 47 -> 'pipe:[117041]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 49 -> 'pipe:[117042]'
lrwx------ 1 gusqt gusqt 64 Aug 14 19:59 52 -> 'socket:[87078]'
lrwx------ 1 gusqt gusqt 64 Aug 14 19:59 56 -> 'socket:[87080]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 70 -> 'pipe:[122857]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 72 -> 'pipe:[122858]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 73 -> 'pipe:[118579]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 75 -> 'pipe:[118580]'
lrwx------ 1 gusqt gusqt 64 Aug 14 19:59 81 -> '/memfd:pulseaudio (deleted)'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 88 -> 'pipe:[154291]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 90 -> 'pipe:[154292]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 91 -> 'pipe:[174552]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 92 -> 'pipe:[175716]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 95 -> 'pipe:[173042]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 96 -> 'pipe:[173043]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 97 -> 'pipe:[194699]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 98 -> 'pipe:[175717]'
lr-x------ 1 gusqt gusqt 64 Aug 14 19:59 99 -> 'pipe:[175718]'
```
EXPECTED RESULT
Only file descriptors 0, 1 and 2, pointing to the console, should be present.
For example, something like:
```
gusqt at gus-laptop ~ 2 0 > ls -l /proc/$$/fd
total 0
lrwx------ 1 gusqt gusqt 64 Aug 14 20:12 0 -> /dev/pts/5
lrwx------ 1 gusqt gusqt 64 Aug 14 20:12 1 -> /dev/pts/5
lrwx------ 1 gusqt gusqt 64 Aug 14 20:12 2 -> /dev/pts/5
```
SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 5.22.4 (on wayland)
KDE Frameworks Version:
Qt Version: 5
ADDITIONAL INFORMATION
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the konsole-devel
mailing list