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

Bug#297985: Bug#297980: gnat-gps: starting compilation terminates X session



Jan C. Nordholz wrote:
> - Upon the request to begin compilation, gnat-gps claims a legacy
> legacy PTY (it should really use the new mechanism and open /dev/ptmx
> instead) and forks off...

I don't think that using the legacy mechanism for allocating a pty is
the culprit, but if I have time I will patch gnat-gps to just use
/dev/ptmx.

[...]
> ... and finally closes the PTY master device. And now look
> closer...
>
> close(5) = 0
> close(5) = -1 EBADF (Bad file descriptor)
> ioctl(5, TIOCGPGRP, [1]) = -1 EBADF (Bad file descriptor)
> kill(-1, SIGINT) = 0
>
> Closing it twice isn't problematic, but ioctl()ing on the FD _after_
> closing it, and using the return value unchecked as argument for
> kill() is, well, suicidal. :-) And in the case of -1 fatal, as
> that sends SIGINT to all processes that gnat-gps is capable to
> signals to... and that includes either the Xserver itself (if you've
> started it via startx et.al.) or your favourite window manager / login
> terminal / whatever keeps your session running.
>
> I've not looked into the gnat-gps source code until now, but if
> you want, I could lend a hand there, too.

Thank you so much for your detailed investigation.  I ran gnat-gps
under strace too, but couldn't spot the problem with ioctl.  I will
investigate in the gnat-gps sources and tell you where I think the
problem is.  If you can lend a hand as you say, your help is most
welcome.

--
Ludovic Brenta.





Reply to: