Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Nov 2004 18:43:56 +0200
From:      Giorgos Keramidas <keramida@freebsd.org>
To:        freebsd-current@freebsd.org
Subject:   bug of misc/screen and fifos or ours?
Message-ID:  <20041118164356.GA46185@orion.daedalusnetworks.priv>

next in thread | raw e-mail | index | archive | help
The screen-4.0.2 version that misc/screen installs is apparently the latest
version of screen available.  It also contains a zillion bugs, is written in a
very insecure style, it uses an antiquated version of autoconf script, etc.

I'm in the process of fixing some of these bugs, and mailing them back to the
screen maintainers (if they still work on screen at all, that is).  This post
is just the description of a workaround for a recent breakage I noticed.

When screen runs under xterm/X11 in recent FreeBSD 6.0-CURRENT versions,
resizing the containing xterm results in an immediate panic with:

	BLOCK fcntl

This is apparently the result of the following code from screen/socket.c:

   793	#ifdef NAMEDPIPE
   794	  debug("Ha, there was someone knocking on my fifo??\n");
   795	  if (fcntl(ServerSocket, F_SETFL, 0) == -1)
   796	    Panic(errno, "BLOCK fcntl");
   797	#else
   798	  struct sockaddr_un a;
   799	
   800	  len = sizeof(a);
   801	  debug("Ha, there was someone knocking on my socket??\n");
   802	  if ((ns = accept(ns, (struct sockaddr *) &a, &len)) < 0)
   803	    {
   804	      Msg(errno, "accept");
   805	      return;
   806	    }
   807	#endif				/* NAMEDPIPE */

At line 795, screen attempts to set blocking mode on a FIFO and fails.

I've added the following patch in my local ports tree and tested screen(1)
with (effectively forced) UNIX domain sockets instead of FIFOs:

% --- config.h.in.orig	Thu Nov 18 18:14:02 2004
% +++ config.h.in	Thu Nov 18 18:14:12 2004
% @@ -526,11 +526,6 @@
%  #undef SELECT_BROKEN
%  
%  /*
% - * Define this if your system supports named pipes.
% - */
% -#undef NAMEDPIPE
% -
% -/*
%   * Define this if your system exits select() immediatly if a pipe is
%   * opened read-only and no writer has opened it.
%   */

This seems to have solved the crashes I was seeing.  But is this correct?  Is
fcntl() really supposed to fail on FIFOs or is this a FreeBSD bug?

- Giorgos



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041118164356.GA46185>