axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] Re: Bug#346552: naive methods of exiting axiom can


From: Camm Maguire
Subject: Re: [Axiom-developer] Re: Bug#346552: naive methods of exiting axiom can blow up catastrophically
Date: 06 Nov 2006 08:59:36 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings, and thanks for looking into this!

Waldek Hebisch <address@hidden> writes:

> I wrote:
> > root wrote:
> > > Apparently the ptys are opened in raw mode and do not interpret the
> > > control characters but pass them down the pipe to AXIOMsys. However
> > > the (read) from axiom simply gets the cntrl-D and tries to parse it.
> > > 
> > > I'm not really sure how this should be handled. Clearly you don't
> > > want sman to open up a pty that interprets control characters.
> > > Nor do you want lisp's (read) to interpret control characters.
> > > 
> > 
> > It is not the case.  One thing is a bug in sman: when the user
> > presses ^D\n sman passes "(1) ->\n" (more precisly AXIOMsys
> > reads what is inside quotes).  AXIOMsys reacts with an error
> > message (exactly like if user gave this input).
> 
> I tracked the problem one step further:
> 
> There is a bug in 'sockio-c.c.pamphlet'. Namely, 'remote_stdio'
> function contains the following code:
> 
>     if (FD_ISSET(0, &rd)) {
>       fgets(buf,1024,stdin);
>       len = strlen(buf);
>       /*
>           gets(buf);
>           len = strlen(buf);
>           *(buf+len) = '\n';
>           *(buf+len+1) = '\0';
>       */
>       swrite(sock, buf, len, "writing to remote stdin");
> 
> If we have EOF on stdin fgets reads nothing and the old content
> of 'buf' (containing the last AXIOMsys output!) is sent back to
> AXIOMsys.  I am not sure what the correct fix is: we can easily
> detect EOF, but we can not just exit: to exit we have kill
> the whole tree of processes spawned by 'sman'.  The code above
> is executed from 'spadclient' and it is possible to have
> more than one copy of 'spadclient' connected to one AXIOMsys,
> so we probably should track number of connected clients
> and exit AXIOMsys when number of clients goes down to zero
> (but we have to be careful at startup, as for short time
> there is no client).
> 

It seems that ^D can only be read from the AXIOMsys terminal, which I
think should cause an exit of that AXIOMsys.  This will close the
socket, so that sman or spadclient should be able to have read return
0, which should then cause it to close that connection on its end
too.  When this should cause a general exit from sman is beyond me --
perhaps there is useful work that can be done with just the hypertex
up but no console.  Personally, I don't think it too egregious to
terminate everything when the 'master' axiom sys (i.e. the first one
opened') reads EOF.

Take care,

> 
> -- 
>                               Waldek Hebisch
> address@hidden 
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]