fvwm2 causes stdin to be closed when execing within tcl/tk

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Sun Jan 25 01:55:17 UTC 2004


On Sat, Jan 24, 2004 at 06:03:37PM -0500, David Tilbrook wrote:
> I have uncovered a bizarre behaviour in RH9.0 fvwm2 and tcl/tk
> that is impossible to debug.
> 
> I have a gui that contains many statements of the form:
> 
> 	[catch {eval exec ...} ...]
> 
> When this gui is invoked via a menu entry in fvwm2, the standard
> input for the program being invoked is not open (i.e., fid 0
> is not open).
> 
> Yet when invoked from an xterm window, even if detached,
> the programs are invoked with a valid fid 0.
> 
> The reason that it is impossible to debug is that the environment
> in which the problem occurs is not one that can run gdb or
> even report diagnostics in a useful manner.
> 
> Given the different behaviours are due to the gui's invocation,
> does anyone have a suggestion as to the cause?
> 
> My best guess is that somehow that tcl/tk does a:
> 
> 	fcntl(0, F_SETFD)
> 
> but why only if invoked from fvwm2?
> 
> What state information that is exported to exec'd children
> could possibly result in such a bizarre behaviour?
> 
> Any why doesn't crt0 ensure that fids 0,1,&2 are open?
> See below.

And what should they be connected to?  /dev/null?  If fvwm is silly
enough to close stdin, stdout and stderr and then uses fork/exec to
launch other programs, then fvwm is a broken window manager, since it is
reasonable to assume whoever launches an interactive application is
doing so from an interactive environment where those FIDs are available.
Well at least I think so.

> P.S.	Coincidently one of the bugs I discovered and reported in
> 	1983 w.r.t. BSD 4.1c was that a number of programs that
> 	did not work correctly when fid 0 was not open (e.g. cpp).
> 	The BSD folks actually extended crt0.o to ensure that
> 	fids 0, 1, and 2 were open.

I wonder what they decided they should connect those to if they weren't
already connected to a tty.

Lennart Sorensen
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list