GNOME Bugzilla – Bug 81560
Terminals do not inherit file descriptors
Last modified: 2012-05-03 19:08:49 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
This doesn't work with xterm either. Bug in the script? :)
Of course this work with xterm. See : http://bugs.debian.org/145506
This script definitely doesn't work in xterm here.
How do you have test this script ?
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
for me this work with xterm but don't with gnome-terminal
Another debian vs. Red Hat difference of opinion?
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...
Argh. Apologies for the double spam. Actually closing this time.
Of course this bug is still here.
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.
Make the summary reflect the actual problem.
Bug 320128 is a vte enhancement request for an option not to close file descriptors on forking the pty.
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?)
*** Bug 558470 has been marked as a duplicate of this bug. ***
Fixed on master. For example: $ 3<test gnome-terminal-client open --fd 3 -- sh -c 'less <&3'