After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 81560 - Terminals do not inherit file descriptors
Terminals do not inherit file descriptors
Status: RESOLVED FIXED
Product: gnome-terminal
Classification: Core
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
[fixed-gsettings]
: 558470 (view as bug list)
Depends on: 320128
Blocks:
 
 
Reported: 2002-05-12 16:42 UTC by Christian Marillat
Modified: 2012-05-03 19:08 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Christian Marillat 2002-05-12 16:42:29 UTC
Hi,

1) This simple script called test

#!/bin/sh

set -e

XTERM=$1

3<&0 $XTERM -x sh -c "sensible-pager <&3"

2) Using this script like:

./test gnome-terminal < /etc/motd


Doesn't work at all. A strace show a lot of "Bad file descriptor" when sh
is try to load /etc/motd
Comment 1 Kjartan Maraas 2002-08-17 14:02:59 UTC
This doesn't work with xterm either. Bug in the script? :)
Comment 2 Christian Marillat 2002-08-17 14:10:31 UTC
Of course this work with xterm. See :

http://bugs.debian.org/145506
Comment 3 Kjartan Maraas 2002-08-17 15:37:06 UTC
This script definitely doesn't work in xterm here.
Comment 4 Christian Marillat 2002-08-17 15:46:14 UTC
How do you have test this script ?
Comment 5 Kjartan Maraas 2002-08-18 21:47:16 UTC
Just like it said in the report.

./test.sh xterm </etc/motd

It gave me the exact same results as

./test.sh gnome-terminal </etc/motd
Comment 6 Christian Marillat 2002-08-18 22:11:49 UTC
for me this work with xterm but don't with gnome-terminal
Comment 7 Kjartan Maraas 2002-08-18 22:34:06 UTC
Another debian vs. Red Hat difference of opinion?
Comment 8 Luis Villa 2003-02-09 02:42:21 UTC
Because of the release of GNOME 2.0 and 2.2, and the lack of interest in
maintainership of GNOME 1.4, the gnome-core product is being closed. If y0u feel
your bug is still of relevance to GNOME 2, please reopen it and refile it
against a more appropriate component. Thanks...
Comment 9 Luis Villa 2003-02-09 02:53:00 UTC
Argh. Apologies for the double spam. Actually closing this time.
Comment 10 Christian Marillat 2003-02-09 13:58:55 UTC
Of course this bug is still here.
Comment 11 Mariano Suárez-Alvarez 2003-10-09 20:13:21 UTC
The original script does not work with xterm because -x is not one of
the (many) xterm options (see
http://www.xfree86.org/current/xterm.1.html) If you change the -x to a
-e, then it does work.

Now, when you try to use gnome-terminal (which does have a -x) it does
not work because child processes to terminals do not inherit
stdin/stdout. 
Comment 12 Mariano Suárez-Alvarez 2004-04-26 05:58:07 UTC
Make the summary reflect the actual problem.
Comment 13 Chris Wilson 2007-02-01 16:41:52 UTC
Bug 320128 is a vte enhancement request for an option not to close file descriptors on forking the pty.
Comment 14 Mariano Suárez-Alvarez 2007-02-01 22:25:15 UTC
The reason why terminals do not inherit file descriptors is in most cases the process which ends up running the terminal is not the one runs from the command line, because of our single-instance setup.

(If the command line has two --tab options, would both tabs get the same fds?)

Comment 15 Christian Persch 2008-10-30 00:01:46 UTC
*** Bug 558470 has been marked as a duplicate of this bug. ***
Comment 16 Christian Persch 2012-05-03 19:08:49 UTC
Fixed on master.

For example:

$ 3<test gnome-terminal-client open --fd 3 -- sh -c 'less <&3'