[gnu.bash.bug] bash 1.04 on AIX PS/2 & 370

lijewski@batcomputer.tn.cornell.edu (Mike Lijewski) (12/21/89)

This is a patchfile to get AIX/370 (tested on F44) and AIX
PS/2 (tested on Version 1.1) working with bash 1.04.  To use,
cd to the bash source directory and type:
     patch -p0 < thisFile
 
*** Makefile.orig	Wed Dec 20 10:55:29 1989
--- Makefile	Wed Dec 20 14:11:47 1989
***************
*** 33,43 ****
  #
  # The mailing address of you, the local maintainer.  This *must* be
  # enclosed in double quotes.  Until I make a better Makefile.
! MAINTAINER = '"bfox@ai.mit.edu"'
 
  # Destination installation directory.  The shell is copied here if
  # you do a `make install'.  The directory name does NOT end in a slash.
! DESTDIR = /usr/gnu/bin
 
  # The name of the target hardware.  It makes a difference.  If your
  # machine doesn't seem to be represented by one of the machines here,
--- 33,43 ----
  #
  # The mailing address of you, the local maintainer.  This *must* be
  # enclosed in double quotes.  Until I make a better Makefile.
! MAINTAINER = '"mjlx@eagle"'
 
  # Destination installation directory.  The shell is copied here if
  # you do a `make install'.  The directory name does NOT end in a slash.
! DESTDIR = /staff/mjlx/bin
 
  # The name of the target hardware.  It makes a difference.  If your
  # machine doesn't seem to be represented by one of the machines here,
***************
*** 44,56 ****
  # try one and see how well you do.
  # Use i386 for PC type 386 boxes. (Compaq, etc.)
  # SUN3, SUN4, SUN386i, VAX, SONY, CONVEX, HP, HP9KS300, i386, NeXT, AIX,
! # ATT3B, ATT386
! TARGET = SUN3
 
  # The name of the target operating system.  There isn't such a big
  # difference between SUNOS3 and Bsd.  But there might be in the future.
  # SUNOS3, SUNOS4, SYSV, Bsd, HPUX, UNIXPC
! OS = SUNOS4
 
  # You only need this if you are hacking the shell in a location
  # that doesn't do enough backups, or does a poor job.  In that
--- 44,56 ----
  # try one and see how well you do.
  # Use i386 for PC type 386 boxes. (Compaq, etc.)
  # SUN3, SUN4, SUN386i, VAX, SONY, CONVEX, HP, HP9KS300, i386, NeXT, AIX,
! # ATT3B, ATT386, AIX370, AIXPS2
! TARGET = AIX370
 
  # The name of the target operating system.  There isn't such a big
  # difference between SUNOS3 and Bsd.  But there might be in the future.
  # SUNOS3, SUNOS4, SYSV, Bsd, HPUX, UNIXPC
! OS = Bsd
 
  # You only need this if you are hacking the shell in a location
  # that doesn't do enough backups, or does a poor job.  In that
***************
*** 75,92 ****
  # Xenix requires -ldir -lx.  It is also required in the readline Makefile.
  #LOCAL_LIBS = -ldir -lx
 
! GCC_SUNOS4_FLAG = -Bstatic
  DEBUG_FLAGS = $(PROFILE_FLAGS) -g $(GCC_SUNOS4_FLAG)
  LDFLAGS	= $(DEBUG_FLAGS)
! CFLAGS	= $(DEBUG_FLAGS) -D${TARGET} -DTARGET=${TARGET} -D${OS}
  CPPFLAGS= -I$(LIBSRC)
 
  # If you don't have Bison use "yacc".  Otherwise use "bison -y".
! #BISON = yacc
! BISON = bison -y
 
  # If you don't have Gcc use cc.
! CC = gcc -traditional
 
  ####################################################################
 
--- 75,103 ----
  # Xenix requires -ldir -lx.  It is also required in the readline Makefile.
  #LOCAL_LIBS = -ldir -lx
 
! # AIX/370 and AIXPS2 both require the -lbsd library.
! LOCAL_LIBS = -lbsd
!
!
! # AIX370 and AIXPS2 both also require the _BSD flag for BSD compatibility.
! #I have defined this flag here and added it to CFLAGS, so that it is in
! # one place, instead of peppering the source files with this define.
! AIX_BSD_COMP = _BSD
!
!
! GCC_SUNOS4_FLAG = #-Bstatic
  DEBUG_FLAGS = $(PROFILE_FLAGS) -g $(GCC_SUNOS4_FLAG)
  LDFLAGS	= $(DEBUG_FLAGS)
! CFLAGS	= $(DEBUG_FLAGS) -D${TARGET} -DTARGET=${TARGET} -D${OS} -D${AIX_BSD_COMP}
  CPPFLAGS= -I$(LIBSRC)
 
  # If you don't have Bison use "yacc".  Otherwise use "bison -y".
! BISON = yacc
! #BISON = bison -y
 
  # If you don't have Gcc use cc.
! #CC = gcc -traditional
! CC = cc
 
  ####################################################################
 
***************
*** 113,120 ****
  # Our malloc.
  MALLOC = $(ALLOC_SOURCE)malloc.o
  MALLOC_FLAGS = -Drcheck -Dbotch=programming_error
! #MALLOC= $(ALLOC_SOURCE)malloc.o
! #ALLOCA= $(ALLOC_SOURCE)alloca.o
 
  ALLOC_HEADERS = $(ALLOC_SOURCE)getpagesize.h
  ALLOC_FILES = $(ALLOC_SOURCE)malloc.c $(ALLOC_SOURCE)alloca.c\
--- 124,131 ----
  # Our malloc.
  MALLOC = $(ALLOC_SOURCE)malloc.o
  MALLOC_FLAGS = -Drcheck -Dbotch=programming_error
! MALLOC= $(ALLOC_SOURCE)malloc.o
! ALLOCA= $(ALLOC_SOURCE)alloca.o
 
  ALLOC_HEADERS = $(ALLOC_SOURCE)getpagesize.h
  ALLOC_FILES = $(ALLOC_SOURCE)malloc.c $(ALLOC_SOURCE)alloca.c\
***************
*** 128,135 ****
  ALLOCA_LIB =
 
  # If your system doesn't have a sys_siglist, then define SIGLIST
! # as siglist.o
! #SIGLIST = siglist.o
 
  RM = rm -f
  AR = ar
--- 139,147 ----
  ALLOCA_LIB =
 
  # If your system doesn't have a sys_siglist, then define SIGLIST
! # as siglist.o.  AIX370 has a sys_siglist, while AIXPS2 doesn't seem
! # to have one.
! SIGLIST = #siglist.o
 
  RM = rm -f
  AR = ar
***************
*** 139,145 ****
  # We would like to use GNU's termcap library.  Where is it?
  # If you don't have -ltermcap, you might try -lcurses.
  #TERMCAP = -ltermcap
- TERMCAP=/usr/lib/libtermcap.a
  READLINE= ./readline/libreadline.a
 
  # The source code for the support libraries.
--- 151,156 ----
***************
*** 206,212 ****
 
  $(PROGRAM):	.build $(OBJECTS) $(LIBRARIES) Makefile
  	$(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJECTS) \
! 		$(LIBRARIES) $(LOCAL_LIBS) $(ALLOCA_LIB) -ltermcap
  	$(RM) -f .make
 
  .build:		.make newversion.aux
--- 217,223 ----
 
  $(PROGRAM):	.build $(OBJECTS) $(LIBRARIES) Makefile
  	$(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJECTS) \
! 		$(LIBRARIES) $(LOCAL_LIBS) $(ALLOCA_LIB) -lcurses
  	$(RM) -f .make
 
  .build:		.make newversion.aux
***************
*** 230,238 ****
  		(cd $(RLIBSRC); $(MAKE) $(MFLAGS) CC='$(CC)'\
  			CFLAGS='$(CFLAGS) -DSHELL')
 
! $(TERMCAP):	$(TERMCAP_SOURCE)
! 		(cd $(LIBSRC); $(MAKE) $(MFLAGS) CC='$(CC)'\
! 			CFLAGS='$(CFLAGS) -I.')
 
  shell.o:	shell.h flags.h shell.c
  		$(CC) $(CFG_FLAGS) $(CFLAGS) $(CPPFLAGS) -c shell.c
--- 241,249 ----
  		(cd $(RLIBSRC); $(MAKE) $(MFLAGS) CC='$(CC)'\
  			CFLAGS='$(CFLAGS) -DSHELL')
 
! #$(TERMCAP):	$(TERMCAP_SOURCE)
! #		(cd $(LIBSRC); $(MAKE) $(MFLAGS) CC='$(CC)'\
! #			CFLAGS='$(CFLAGS) -I.')
 
  shell.o:	shell.h flags.h shell.c
  		$(CC) $(CFG_FLAGS) $(CFLAGS) $(CPPFLAGS) -c shell.c
***************
*** 247,255 ****
  		$(CC) -I$(ALLOC_SOURCE) $(CFLAGS) $(MALLOC_FLAGS) -c $*.c &&\
  		mv `basename $*`.o $(MALLOC)
 
! #$(ALLOCA):	$(ALLOC_FILES)
! #		$(CC) -I$(ALLOC_SOURCE) $(CFLAGS) -o $(ALLOCA) -c $*.c
! #		mv `basename $*`.o $(ALLOCA)
 
  bashline.o:	bashline.c config.h $(RLIBSRC)readline.h variables.h builtins.h
  jobs.o:		jobs.c nojobs.c jobs.h config.h
--- 258,266 ----
  		$(CC) -I$(ALLOC_SOURCE) $(CFLAGS) $(MALLOC_FLAGS) -c $*.c &&\
  		mv `basename $*`.o $(MALLOC)
 
! $(ALLOCA):	$(ALLOC_FILES)
! 		$(CC) -I$(ALLOC_SOURCE) $(CFLAGS) -c $*.c
! 		mv `basename $*`.o $(ALLOCA)
 
  bashline.o:	bashline.c config.h $(RLIBSRC)readline.h variables.h builtins.h
  jobs.o:		jobs.c nojobs.c jobs.h config.h
*** siglist.c.orig	Wed Dec 20 13:42:57 1989
--- siglist.c	Wed Dec 20 13:56:04 1989
***************
*** 35,40 ****
--- 35,65 ----
    "write on a pipe with no one to read it", /* 13 SIGPIPE */
    "alarm clock",			/* 14 SIGALRM */
    "software termination signum",	/* 15 SIGTERM */
+ #ifdef AIXPS2
+   "urgent condition on IO channel", 	/* 16 SIGURG */
+   "stop",			 	/* 17 SIGSTOP */
+   "interactive stop signal from TTY", 	/* 18 SIGTSTP */
+   "continue if stopped", 		/* 19 SIGCONT */
+   "A child has stopped or exited", 	/* 20 SIGCHLD */
+   "Read of control TTY attempted from background", 	/* 21 SIGTTIN */
+   "Write to control TTY attempted from background", 	/* 22 SIGTTOU */
+   "input/output possible or complete", 	/* 23 SIGIO */
+   "exceeded CPU time limit", 		/* 24 SIGXCPU */
+   "exceeded file size limit", 		/* 25 SIGXFSZ */
+   "HFT input data pending", 		/* 27 SIGMSG */
+   "window size change", 		/* 28 SIGWINCH */
+   "power failure imminent (save your data)", 	/* 29 SIGPWR */
+   "user defined signal 1", 		/* 30 SIGUSR1 */
+   "user defined signal 2", 		/* 31 SIGUSR2 */
+   "profiling time alarm", 		/* 32 SIGPROF */
+   "system crash imminent", 		/* 33 SIGDANGER */
+   "virtual time alarm", 		/* 34 SIGVTALRM */
+   "migrate process to another CPU", 	/* 35 SIGMIGRATE */
+   "programming error", 			/* 36 SIGPRE */
+   "HFT monitor mode granted", 		/* 60 SIGGRANT */
+   "HFT monitor mode retracted", 	/* 61 SIGRETRACT */
+   "HFT sound sequence has completed", 	/* 62 SIGSOUND */
+  #else
    "user defined signal 1",		/* 16 SIGUSR1 */
    "user defined signal 2",		/* 17 SIGUSR2 */
    "death of a child",			/* 18 SIGCLD */
***************
*** 43,47 ****
--- 68,73 ----
    "profiling timer alarm",		/* 21 SIGPROF */
    "asynchronous I/O",			/* 22 SIGIO */
    "window change or mouse signal",	/* 23 SIGWINDOW */
+ #endif
    (char *)0x0
  };
*** readline/Makefile.orig	Wed Dec 20 09:52:20 1989
--- readline/Makefile	Wed Dec 20 13:41:00 1989
***************
*** 27,35 ****
  # Xenix compilation requires -ldir -lx
  #LOCAL_LIBS = -ldir -lx
 
  # Comment this out if you don't think that anyone will ever desire
  # the vi line editing mode and features.
! READLINE_DEFINES = -DVI_MODE
 
  DEBUG_FLAGS = -g
  LDFLAGS = $(DEBUG_FLAGS)
--- 27,38 ----
  # Xenix compilation requires -ldir -lx
  #LOCAL_LIBS = -ldir -lx
 
+ # AIX370 requires the -lbsd library.
+ #LOCAL_LIBS = -lbsd
+
  # Comment this out if you don't think that anyone will ever desire
  # the vi line editing mode and features.
! #READLINE_DEFINES = -DVI_MODE
 
  DEBUG_FLAGS = -g
  LDFLAGS = $(DEBUG_FLAGS)
***************
*** 36,43 ****
  CFLAGS = $(DEBUG_FLAGS) $(TYPE) $(SYSV) -I.
 
  # A good alternative is gcc -traditional.
! CC = gcc -traditional
! #CC = cc
  RANLIB = /usr/bin/ranlib
  AR = ar
  RM = rm
--- 39,46 ----
  CFLAGS = $(DEBUG_FLAGS) $(TYPE) $(SYSV) -I.
 
  # A good alternative is gcc -traditional.
! #CC = gcc -traditional
! CC = cc
  RANLIB = /usr/bin/ranlib
  AR = ar
  RM = rm
***************
*** 84,95 ****
  		 $(LOCAL_INCLUDES) $*.c
 
  libtest:	libreadline.a libtest.c
! 		$(CC) -o libtest $(CFLAGS) $(CPPFLAGS) -L. libtest.c -lreadline -ltermcap
 
  readline: readline.c history.o keymaps.o funmap.o readline.h chardefs.h
  	$(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
! 		$(LOCAL_INCLUDES) -DTEST -o readline readline.c funmap.o \
! 		 keymaps.o history.o -L. -ltermcap
 
  readline.tar:	$(THINGS_TO_TAR)
  		tar -cf readline.tar $(THINGS_TO_TAR)
--- 87,98 ----
  		 $(LOCAL_INCLUDES) $*.c
 
  libtest:	libreadline.a libtest.c
! 		$(CC) -o libtest $(CFLAGS) $(CPPFLAGS) -L. libtest.c -lreadline -lcurses
 
  readline: readline.c history.o keymaps.o funmap.o readline.h chardefs.h
  	$(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
! 		$(LOCAL_INCLUDES) -DTEST -D_BSD -o readline \
! 		readline.c funmap.o keymaps.o history.o -L. -lbsd -lcurses
 
  readline.tar:	$(THINGS_TO_TAR)
  		tar -cf readline.tar $(THINGS_TO_TAR)
*** readline/readline.c.orig	Wed Dec 20 09:52:36 1989
--- readline/readline.c	Wed Dec 20 13:41:11 1989
***************
*** 36,41 ****
--- 36,46 ----
  #include <sys/file.h>
  #include <signal.h>
 
+ #ifdef TEST
+ char *alloca();
+ void free();
+ #endif
+
  #ifdef __GNUC__
  #define alloca __builtin_alloca
  #else
***************
*** 199,204 ****
--- 204,212 ----
  FILE *rl_instream = stdin, *rl_outstream = stdout;
 
  /* Non-zero means echo characters as they are read. */
+ /* This is a kludge for the braindamaged AIXPS2 compiler, which
+    will not accept: extern int readline_echoing_p = 1; */
+ extern int readline_echoing_p;
  int readline_echoing_p = 1;
 
  /* Current prompt. */
***************
*** 695,701 ****
       register int key;
       Keymap map;
  {
!   extern int defining_kbd_macro;
 
    if (defining_kbd_macro)
      add_macro_char (key);
--- 703,709 ----
       register int key;
       Keymap map;
  {
!   static int defining_kbd_macro;
 
    if (defining_kbd_macro)
      add_macro_char (key);
***************
*** 990,996 ****
 
    /* Parsing of key-bindings begins in an enabled state. */
    {
!     extern unsigned char parsing_conditionalized_out;
      parsing_conditionalized_out = 0;
    }
  }
--- 998,1004 ----
 
    /* Parsing of key-bindings begins in an enabled state. */
    {
!     static unsigned char parsing_conditionalized_out;
      parsing_conditionalized_out = 0;
    }
  }
***************
*** 2592,2598 ****
 
  #ifdef VI_MODE
    {
!     extern int vi_doing_insert;
      if (vi_doing_insert)
        {
  	rl_end_undo_group ();
--- 2600,2606 ----
 
  #ifdef VI_MODE
    {
!     static int vi_doing_insert;
      if (vi_doing_insert)
        {
  	rl_end_undo_group ();
***************
*** 5517,5522 ****
--- 5525,5536 ----
  /* **************************************************************** */
 
  #ifdef TEST
+ #if !defined(__GNU__)
+ #if !defined(sun) || !defined(sparc)
+ #include "../alloc-files/alloca.c"
+ #endif
+ #endif
+
 
  main ()
  {
-- 
Mike Lijewski  (H)607/277-7623 (W)607/255-0539 (desk)607/255-2960
Cornell National Supercomputer Facility
ARPA: mjlx@cornellf.tn.cornell.edu  BITNET: mjlx@cornellf.bitnet
SMAIL:  1122 Ellis Hollow Rd. Ithaca, NY  14850

lijewski@batcomputer.tn.cornell.edu (Mike Lijewski) (12/21/89)

In article <9451@batcomputer.tn.cornell.edu> lijewski@batcomputer.tn.cornell.edu (Mike Lijewski) writes:
>
>This is a patchfile to get AIX/370 (tested on F44) and AIX
>PS/2 (tested on Version 1.1) working with bash 1.04.  To use,

Please do not apply this patch.  Brian has pointed out a subtle bug
this introduces in readline to me.  I am in the process of fixing
this and will send the patches to Brian when I'm done.

-- 
Mike Lijewski  (H)607/277-7623 (W)607/255-0539 (desk)607/255-2960
Cornell National Supercomputer Facility
ARPA: mjlx@cornellf.tn.cornell.edu  BITNET: mjlx@cornellf.bitnet
SMAIL:  1122 Ellis Hollow Rd. Ithaca, NY  14850