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

Re: apparantly konsole is unusable

reassign 573063 libc0.1
tags 573063 +pending

in libkpty (kde4libs/kpty/kpty.c), there is a call to openpty:
(this is compiled with g++)

 ::openpty( &d->masterFd, &d->slaveFd, ptsn, 0, 0)

(d is a pointer to a struct, d->masterFd is a int, d->slaveFd is a
int, ptsn is a char pointer)

which fails with EINTR (according to errno)


I'm out of clue and/or inspiration.

My possibly-clueless 2?: If EINTR is returned, the call should be
retried, which this code doesn't seem to do.

I tried with wrapping it in a bit of goto magic, and I just got a loop
that seemed infinite. I stopped it after ~50 tries.

 if (openpty( &d->masterFd, &d->slaveFd, ptsn, NULL, NULL))
    int errsv = errno;
    if(errsv == EINTR) {
      goto tryagain;

The EINTR should really be handled, but the proper place is eglibc.
The patch bellow fixes konsole for me,
I will commit it into pkg-glibc SVN after some more testing.

I expect that difference between xterm and konsole is whether SIGCHLD
does have explicit handler.

Many thanks for your investigation.


--- a/sysdeps/unix/grantpt.c
+++ b/sysdeps/unix/grantpt.c
@@ -200,9 +200,13 @@
       int w;
       if (__waitpid (pid, &w, 0) == -1)
+       {
+       if (errno == EINTR)
+           goto retry;
        goto cleanup;
+       };
       if (!WIFEXITED (w))
        __set_errno (ENOEXEC);

man waitpid:

       EINTR  WNOHANG was not set and an unblocked signal
              or a SIGCHLD was caught; see signal(7).

Reply to: