This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Crash in scm_boot_guile if stdin isn't open.


Jon K Hellan <hellan@acm.org> writes:

> On Sat, Mar 11, 2000 at 06:06:29PM +0100, Marius Vollmer wrote:
> 
> > I think Guile should not produce a segmentation fault, but I also
> > think that one never ever should expect a program to run with a
> > invalid fd 0.  Instead, one should hook fd 0 to /dev/null or
> > something.  The standard streams should always be valid (IMO).
> 
> Hmm. We'll probably do that as a workaround. But I don't think an
> embedded interpreter should make assumptions about which streams are
> valid.

Maybe.  But I think aborting when fd 0 is invalid is acceptable
behaviour of libguile.  I think any Unix Program can make the
assumption that when any of the standard file descriptors are open,
they are used for their standard purpose.  Changing this would be like
changing the prototype of main, in my view, or rather, giving another
meaning to the environment variable HOME.

Thus, I would say that it is not safe to just close fd 0, because the
next call to open might reuse it and then fd 0 is something completely
different from stdin.  Likewise for 1 and 2.

I would not label the solution of pointing fd 0 at /dev/null as a work
around.  You just can't hope to get away with making fd 0 invalid.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]