Subject: X11 R6 fix-11 explodes ... loose shrapnel inflicts many casualties
To: None <port-sparc@NetBSD.ORG>
From: Greg Earle <earle@isolar.Tujunga.CA.US>
List: port-sparc
Date: 02/17/1995 21:46:06
I accidentally forgot that I'd copied my patched-for-NetBSD source tree (with
Dennis' patches) to my SunOS/Solaris machines for use in building R6 on them.
Having decided to install patches fix-07 through fix-11 and do a rebuild, I
dutifully started applying them.

When I got to fix-11, the shrapnel started to fly.  I'd forgotten that the
sources had already been NetBSD-ized.  Yikes, .rej'd patch files everywhere.
(Note that none of the fix-07 through fix-10 patches conflicted with any of
 the existing NetBSD-specific patches, as far as I know.)

So, a reminder: if you've used the NetBSD/SPARC R6 patches to build X at a
previous patchlevel, beware that installing fix-11 will blow cookies all over
the place.  You might consider taking all the files from the NetBSD R6 patch
and moving them aside and moving the originals back into place before applying
fix-11, and then compare the results afterwards.  You Have Been Warned.

I then took a closer look at the fix-11 patches vs. the NetBSD/SPARC specific
ones.  Basically, it boiled down to

- Most of the NetBSD/SPARC specific patches are included ... but not all
- fix-11 includes some extra patches that the NetBSD/SPARC patches didn't
- A good portion of them are implemented, but in a slightly different manner;
  e.g. using "#ifndef __NetBSD__" instead of "#ifdef __NetBSD__" - the net
  result is the same

As far as I can determine, of the NetBSD/SPARC through-fix-05 patches, here
are the remaining ones which were not implemented by fix-11.  If anyone wants
to clarify or correct me on these - i.e., say why they weren't implemented, or
how they really were, but in a different way somewhere else that I'm just not
seeing, etc. - please drop me a line or followup.  [Blatant Kaleb troll  (-: ]

In particular, I'm interested in (a) the rgb patch; the NetBSD patch says "Yes,
use the DBM files instead of rgb.txt, and call them rgb.db", whereas the
fix-11 patch tries to say "No, use only rgb.txt", but it even botches that by
sticking a "UseRGBTxt YES" in NetBSD.cf instead of "UseRgbTxt" - note typo;
And also (b) the xdm Imakefile patch; the fix-11 version only adds crypt
support - "SYS_LIBRARIES = -lcrypt" - if "XFree86Version" is defined ... and
obviously that's not true on !i386 NetBSD architectures, but some of us have
-lcrypt nonetheless ...  The rest I just plain don't understand why they were
omitted; for example, the xterm main.c patch wasn't picked up, and without it
we don't get proper utmp[/wtmp/lastlog] entries written because the default
filenames are wrong for NetBSD (see the NetBSD <utmp.h>) ...

All comments welcome.

	- Greg

*** 1.1	1994/07/20 14:25:55
--- xc/config/cf/NetBSD.cf	1994/07/22 10:40:07
***************
*** 3,10 ****
  #define OSName		NetBSD
  #define	OSVendor	/**/
  XCOMM operating system:  OSName
! #define OSMajorVersion    0
! #define OSMinorVersion    9
  
  #define HasPutenv       YES
  #define HasBSD44Sockets YES
--- 3,10 ----
  #define OSName		NetBSD
  #define	OSVendor	/**/
  XCOMM operating system:  OSName
! #define OSMajorVersion    1
! #define OSMinorVersion    0
  
  #define HasPutenv       YES
  #define HasBSD44Sockets YES
***************
*** 61,65 ****
--- 65,74 ----
  
  #define AvoidNullMakeCommand YES
  
+ /* for xdm or anyone else to use */
+ #define DefaultSystemPath /usr/sbin:/etc:/bin:/usr/bin:$(BINDIR):/usr/ucb
+ #define InstKmemFlags	   -g kmem -m 2755	/* xload needs this */
+ 
  XCOMM Man pages need to be formatted when installed, so override the default
  XCOMM imake rules.
  
*** 1.1	1994/07/20 15:13:26
--- xc/programs/rgb/Imakefile	1994/07/22 09:57:19
***************
*** 20,26 ****
           OBJS = $(OBJS1) $(OBJS2)
       PROGRAMS = $(RGB_PROG) showrgb
  #if !UseRgbTxt
! #ifdef BSD386Architecture
      DATAFILES = rgb.db
        DATADEP = rgb.db
  #else
--- 20,27 ----
           OBJS = $(OBJS1) $(OBJS2)
       PROGRAMS = $(RGB_PROG) showrgb
  #if !UseRgbTxt
! /* Should be just BSD44Architecture */
! #if defined(BSD386Architecture) || defined(NetBSDArchitecture)
      DATAFILES = rgb.db
        DATADEP = rgb.db
  #else
*** 1.1	1994/07/20 20:33:37
--- xc/programs/Xserver/hw/sun/sunInit.c	1994/07/20 22:20:43
***************
*** 463,469 ****
  	    key.kio_station = 118;
  	    if (ioctl(sunKbdPriv.fd, KIOCGETKEY, &key) == -1) {
  		Error( "ioctl KIOCGETKEY" );
! 		FatalError("Can't KIOCGETKEY on fd %d\n", kbdFd);
  	    }
  	    if (key.kio_entry != HOLE)
  		sunKbdPriv.type = KB_SUN4;
--- 463,469 ----
  	    key.kio_station = 118;
  	    if (ioctl(sunKbdPriv.fd, KIOCGETKEY, &key) == -1) {
  		Error( "ioctl KIOCGETKEY" );
! 		FatalError("Can't KIOCGETKEY on fd %d\n", sunKbdPriv.fd);
  	    }
  	    if (key.kio_entry != HOLE)
  		sunKbdPriv.type = KB_SUN4;
*** 1.1	1994/07/22 10:06:18
--- xc/programs/xdm/dm.h	1994/07/22 10:07:20
***************
*** 352,358 ****
  #define SIGVAL void
  #endif
  
! #ifdef X_NOT_POSIX
  #ifdef SYSV
  #define SIGNALS_RESET_WHEN_CAUGHT
  #define UNRELIABLE_SIGNALS
--- 352,358 ----
  #define SIGVAL void
  #endif
  
! #if defined(X_NOT_POSIX) || defined(__NetBSD__)
  #ifdef SYSV
  #define SIGNALS_RESET_WHEN_CAUGHT
  #define UNRELIABLE_SIGNALS
*** 1.1	1994/07/22 10:07:31
--- xc/programs/xdm/Imakefile	1994/07/22 10:08:58
***************
*** 52,57 ****
--- 52,61 ----
  SYS_LIBRARIES = -ls
  #endif
  
+ #ifdef NetBSDArchitecture
+ SYS_LIBRARIES = -lcrypt
+ #endif
+ 
  #if HasBSD44Sockets
  SOCK_DEFINES = -DBSD44SOCKETS
  #endif
*** 1.1	1994/07/20 00:07:11
--- xc/programs/twm/lex.l	1994/07/20 00:10:46
***************
*** 67,73 ****
  extern char *ProgramName;
  
  extern int ParseError;
! #ifdef __bsdi__
  int yylineno;
  
  #undef YY_INPUT
--- 67,73 ----
  extern char *ProgramName;
  
  extern int ParseError;
! #if defined(__bsdi__) || defined(__NetBSD__)
  int yylineno;
  
  #undef YY_INPUT
*** 1.1	1994/04/17 17:23:29
--- xc/programs/xterm/main.c	1994/10/11 04:53:56
***************
*** 267,288 ****
--- 267,300 ----
  #ifdef UTMP_FILE
  #define UTMP_FILENAME UTMP_FILE
  #else
+ #ifdef _PATH_UTMP
+ #define UTMP_FILENAME _PATH_UTMP
+ #else
  #define UTMP_FILENAME "/etc/utmp"
  #endif
  #endif
+ #endif
  
  #ifndef LASTLOG_FILENAME
+ #ifdef _PATH_LASTLOG
+ #define LASTLOG_FILENAME _PATH_LASTLOG
+ #else
  #define LASTLOG_FILENAME "/usr/adm/lastlog"  /* only on BSD systems */
  #endif
+ #endif
  
  #ifndef WTMP_FILENAME
  #ifdef WTMP_FILE
  #define WTMP_FILENAME WTMP_FILE
  #else
+ #ifdef _PATH_WTMP
+ #define WTMP_FILENAME _PATH_WTMP
+ #else
  #ifdef SYSV
  #define WTMP_FILENAME "/etc/wtmp"
  #else
  #define WTMP_FILENAME "/usr/adm/wtmp"
+ #endif
  #endif
  #endif
  #endif
*** 1.1	1994/07/21 22:47:47
--- fonts/PEX/Imakefile	1994/07/21 22:53:12
***************
*** 33,38 ****
--- 33,42 ----
  #define PexFontDefines 
  #endif
  
+ #ifdef	NetBSDArchitecture	/* big hack here */
+ LEX = lex -l
+ #endif
+ 
  .SUFFIXES: $(SUFFIXES) .src .phont
  
  CDEBUGFLAGS = PexFontCDebugFlags