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: Waldek Hebisch
Subject: Re: [Axiom-developer] Re: Bug#346552: naive methods of exiting axiom can blow up catastrophically
Date: Fri, 3 Nov 2006 00:31:09 +0100 (CET)

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).


-- 
                              Waldek Hebisch
address@hidden 




reply via email to

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