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

Bug#652907: #652907 xterm: no UTMP/WTMP update with kfreebsd-amd64



The problem seems to be that kfreebsd-amd64 is changing ownership
of a slave device later than linux-i386 is doing. This is not
recogniced in the source of "libutempter/utempter.c".

The following output demonstrates that at the time of evaluating
ptsname(fd), the two systems differ. The call to grantpt() must
be made much earlier in Xterm for the technique to succeed.

  mats@kbsd $ ls -l $(tty)
  crw--w---- 1 mats tty 0, 106 jan  4 13:19 /dev/ttyp0

  mats@kbsd $ ./a.out
  master at fd 3
  slave pty at /dev/ttyp1
  crw--w---- 1 root root 0, 108 jan  4 13:18 /dev/ttyp1

Observe my running terminal "/dev/ttyp0" is mine, but not yet
the freshly created "/dev/ttyp1" on GNU/kFreeBSD.

  mats@linux $ ls -l $(tty)
  crw--w---- 1 mats tty 136, 0 jan  4 13:22 /dev/pts/0

  mats@linux $ ./a.out
  master at fd 3
  slave pty at /dev/pts/3
  crw--w---- 1 mats tty 136, 3 jan  4 13:21 /dev/pts/3

Here the access was adjusted on the fly with GNU/Linux.

Regards,
  Mats Erik Andersson


#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(void) {
	int f;
	char *pp, cmd[40];

	if ((f = getpt())< 0)
		return 1;

	printf("master at fd %d\n", f);
	pp = ptsname(f);
	printf("slave pty at %s\n", pp);

	snprintf(cmd, sizeof(cmd), "ls -l %s", pp);
	system(cmd);

	return 0;
}



Reply to: