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:

> Marius Vollmer <mvo@zagadka.ping.de> writes:
> 
> > 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. 
> 
> It isn't open. It's closed. 

Yes, but can you guarantee that it will stay closed?

I'm actually arguing on two different fronts here: one is about what
Guile should do when fd 0 is invalid during initialization.  I agree
now that it should be able to cope with this and I'll devise a quick
fix for this.  What about: when constructing the port for any of the
standard streams, we check whether it is valid.  When not, we `dup' it
to /dev/null and carry on.  This will eat all error messages and
probably not be very helpful, but hey.

The other thing is: is it a good idea to close fd 0 in the first
place?  I strongly think it's a bad idea.  It's like saying that Gnome
programs that might be activated in the background are not really Unix
programs any more, but live in some kind of strange environment where
some things are no longer true that used to be since times memoriam,
for no good reason.  Guile makes the same kind of mistake, btw, in my
view, in the form of scm_boot_guile.  But the fd 0 thing has no good
motivation, as far as I can see.

> All apps have to make sure that we can survive that kind of
> thing. In our case, we only have problems when we embed guile. Of
> course we can make a workaround. In fact, I already checked one
> in. But the Gnumeric maintainer asked me to disable it.

Why?  What does it break?  Maybe you have more success by promoting it
as a `bug fix' and not as a `workaround'? ;-)

> Anyway, it's better that guile works around it than that all apps
> which embed it each have to make a workaround.

Yes, but it would still be better if the situation would not occur.
What is the motivation to invalidating fd 0?  I can understand that
disconnecting the program from the console is probably needed, but
that does not mean that fd 0 must be invalid.

- Marius


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