Sunday, June 19, 2016

GNU screen on Mac OS X 10.4 & HP/UX 11.11

I love GNU Screen. But their maintainers are insane or lazy. Because they does not fix a bug which exists for a long long time. It affects at least Mac OS X 10.4 and HP/UX 11.11.
It compiles quite good. On Mac OS X you have to patch utmp.c changing makeuser() this way:


  (void)time(&now);
// DtZ   u->ut_tv.tv_sec = now;
  u->ut_time = now;

But when you start screen, it says "Abort trap". The problem in realpath() called in tty.c.: real = realpath(tty, NULL); On the systems mentioned, it does not work with NULL as the second argument, it wants char * resolved_path there.
So at least for Mac OS X this helps (and the code for HP/UX is very similar):

int
CheckTtyname (tty) 
char *tty;
{
  struct stat st;
//  char * real;
  int rc;
  char real[PATH_MAX]; // DtZ
 
  if (!realpath(tty,real)) return -1;
 
//  real = realpath(tty, NULL);
 
//  if (!real)
//    return -1;



UPD: In screen 4.4.0 looks like they fixed it! Great! So on HP/UX 11.11 the only thing to convince it to compile is to create empty file /usr/include/sys/select.h (because in the other case it says "Unable to use fifos and sockets" or like that)