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

Bug#742965: marked as done (libc0.1: openpty()/forkpty() fail on kfreebsd >=9.0)



Your message dated Thu, 17 Dec 2015 19:47:05 +0100
with message-id <20151217184705.GA9943@aurel32.net>
and subject line Re: Bug#742965: libc0.1: openpty()/forkpty() fail on kfreebsd >=9.0
has caused the Debian Bug report #742965,
regarding libc0.1: openpty()/forkpty() fail on kfreebsd >=9.0
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
742965: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=742965
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libc0.1
Version: 2.18-4
Severity: normal


If a process has a handler for SIGCHLD, openpty() fails on kfreebsd with 9.x
kernels.  It worked ok on 8.x, and works on "real" (ie, no glibc) FreeBSD.

A reduced test case attached; when commenting out the sigaction line,
openpty() starts working again.


-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 9.2-1-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libc0.1 depends on:
ii  libgcc1  1:4.8.2-16

libc0.1 recommends no packages.

Versions of packages libc0.1 suggests:
ii  debconf [debconf-2.0]  1.5.52
pn  glibc-doc              <none>
ii  locales                2.18-4

-- debconf information:
  glibc/upgrade: true
  glibc/disable-screensaver:
  glibc/restart-services:
  glibc/restart-failed:
  libraries/restart-without-asking: false
// Link with -lutil
#include <stdio.h>
#include <pty.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>

static void sigchild(int dummy)
{
    while (waitpid(-1,0,WNOHANG)>0);
}

int main()
{
    int master, slave;

    struct sigaction act;
    sigemptyset(&act.sa_mask);
    act.sa_flags=SA_RESTART;
    act.sa_handler=sigchild;
    sigaction(SIGCHLD,&act,0);
    
    if (openpty(&master, &slave, 0, 0, 0))
    {
        printf("Failed: %s\n", strerror(errno));
        return 1;
    }
    printf("Ok!\n");
    return 0;
}

--- End Message ---
--- Begin Message ---
On 2014-04-04 09:35, Petr Salinger wrote:
> >I wonder how to fix it.  Merely documenting the restriction isn't really
> >anoption, as no widespread system has it.  Saving the signal handler,
> >disabling it then restoring would work but introduces a slight race
> >condition (a child process can exit while we're in grantpt()).
> 
> In fact, it is documented:
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/grantpt.html
> 
>   The behavior of the grantpt() function is unspecified if the application
>   has installed a signal handler to catch SIGCHLD signals.

Indeed this is a possible behaviour of this function. The same will
happen on a GNU/Linux system if /dev/pts is mounted with the wrong
permissions.

I am therefore closing this bug.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

--- End Message ---

Reply to: