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

Bug#45104: setsid() breakage



Package: libc0.2
Version: N/A

Hello,

the setsid() function does not behave correctly on the Hurd.

First, it returns an unconditional 0 at succesful operation, instead the
process group id.

Secondly, and this is currently the main problem with screen, it does
not disconnect properly from its controlling terminal. At least this
is how I interpret the behaviour. First, screen: screen calls setsid(), and
then does a read() on /dev/console while ignoring SIGTTIN. This leads to
a failure EIO (which means that it still has /dev/console as ctty).
Secondly, I tried to isolate a test case, which shows the errornous
behaviour.

The below program under Linux:

ulysses:/tmp# ./setsid
setsid: 360, Success
hello
read: 6, Success
world
ulysses:/tmp# world
bash: world: command not found

Under the Hurd:

hurd:/tmp# ./setsid
setsid: 0, (os/kern) successful
hello
world
hurd:/tests/setsid# hello
bash: hello: command not found
hurd:/tests/setsid# world
bash: world: command not found

Note that read() does not return.
Obviously, the keyboard input never reaches the child process.

===============================================================
#include <errno.h>
#include <sys/types.h>
#include <fcntl.h>

main()
{
   int child, fd, length; 
   pid_t p;
   char b[16];
   
   fd=open("/dev/console",O_RDONLY,0);
   if (!fd)
     printf("open: %s\n", strerror(errno));

   child=fork();
   if(!child) {
      p = setsid();
      printf("%i, %s\n", p, strerror(errno));
      length = read(fd, 16, b);
      printf("read: %i, %s\n", length, strerror(errno));
   }
   sleep(5);
}
==============================================================

Thanks,
Marcus


-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org  Check Key server 
Marcus Brinkmann              GNU    http://www.gnu.org    for public PGP Key 
Marcus.Brinkmann@ruhr-uni-bochum.de                        PGP Key ID 36E7CD09
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/


Reply to: