Blame NOTES

Packit b5e560
Platform-Specific Configuration and Operation Notes [somewhat dated]
Packit b5e560
====================================================================
Packit b5e560
Packit b5e560
1.  configure --without-gnu-malloc on:
Packit b5e560
Packit b5e560
	alpha running OSF/1, Linux, or NetBSD (malloc needs 8-byte alignment;
Packit b5e560
	bash malloc has 8-byte alignment now, but I have no alphas to test on)
Packit b5e560
Packit b5e560
	next running NeXT/OS; machines running Openstep
Packit b5e560
Packit b5e560
	all machines running SunOS YP code: SunOS4, SunOS5, HP/UX, if you
Packit b5e560
	have problems with username completion or tilde expansion for
Packit b5e560
	usernames found via YP/NIS
Packit b5e560
Packit b5e560
	linux (optional, but don't do it if you're using Doug Lea's malloc)
Packit b5e560
Packit b5e560
	QNX 4.2
Packit b5e560
	other OSF/1 machines (KSR/1, HP, IBM AIX/ESA)
Packit b5e560
	AIX
Packit b5e560
	sparc SVR4, SVR4.2 (ICL reference port)
Packit b5e560
	DG/UX
Packit b5e560
	Cray
Packit b5e560
	Haiku OS
Packit b5e560
Packit b5e560
	NetBSD/sparc (malloc needs 8-byte alignment; bash malloc has 8-byte
Packit b5e560
	alignment now, but I have no NetBSD machines to test on)
Packit b5e560
Packit b5e560
	BSD/OS 2.1, 3.x if you want to use loadable builtins
Packit b5e560
Packit b5e560
	Motorola m68k machines running System V.3.  There is a file descriptor
Packit b5e560
	leak caused by using the bash malloc because closedir(3) needs to read
Packit b5e560
	freed memory to find the file descriptor to close
Packit b5e560
Packit b5e560
2.  Configure using shlicc2 on BSD/OS 2.1 and BSD/OS 3.x to use loadable
Packit b5e560
    builtins
Packit b5e560
Packit b5e560
3.  Bash cannot be built in a directory separate from the source directory
Packit b5e560
    using configure --srcdir=... unless the version of `make' you're using
Packit b5e560
    does $VPATH handling right.  The script support/mkclone can be used to
Packit b5e560
    create a `build tree' using symlinks to get around this.
Packit b5e560
Packit b5e560
4.  I've had reports that username completion (as well as tilde expansion
Packit b5e560
    and \u prompt expansion) does not work on IRIX 5.3 when linking with
Packit b5e560
    -lnsl.  This is only a problem when you're running NIS, since
Packit b5e560
    apparently -lnsl supports only /etc/passwd and not the NIS functions
Packit b5e560
    for retrieving usernames and passwords.  Editing the Makefile after
Packit b5e560
    configure runs and removing the `-lnsl' from the assignment to `LIBS'
Packit b5e560
    fixes the problem.
Packit b5e560
Packit b5e560
5.  There is a problem with the `makewhatis' script in older (pre-7.0)
Packit b5e560
    versions of Red Hat Linux.  Running `makewhatis' with bash-2.0 or
Packit b5e560
    later versions results in error messages like this:
Packit b5e560
Packit b5e560
    /usr/sbin/makewhatis: cd: manpath: No such file or directory
Packit b5e560
    /usr/sbin/makewhatis: manpath/whatis: No such file or directory
Packit b5e560
    chmod: manpath/whatis: No such file or directory
Packit b5e560
    /usr/sbin/makewhatis: cd: catpath: No such file or directory
Packit b5e560
    /usr/sbin/makewhatis: catpath/whatis: No such file or directory
Packit b5e560
    chmod: catpath/whatis: No such file or directory
Packit b5e560
Packit b5e560
    The problem is with `makewhatis'.  Red Hat (and possibly other
Packit b5e560
    Linux distributors) uses a construct like this in the code:
Packit b5e560
Packit b5e560
        eval path=$"$pages"path
Packit b5e560
Packit b5e560
    to do indirect variable expansion.  This `happened to work' in
Packit b5e560
    bash-1.14 and previous versions, but that was more an accident
Packit b5e560
    of implementation than anything else -- it was never supported
Packit b5e560
    and certainly is not portable.
Packit b5e560
Packit b5e560
    Bash-2.0 has a new feature that gives a new meaning to $"...".
Packit b5e560
    This is explained more completely in item 1 in the COMPAT file.
Packit b5e560
Packit b5e560
    The three lines in the `makewhatis' script that need to be changed
Packit b5e560
    look like this:
Packit b5e560
Packit b5e560
             eval $topath=$"$topath":$name
Packit b5e560
    [...]
Packit b5e560
       eval path=$"$pages"path
Packit b5e560
    [...]
Packit b5e560
    eval path=$"$pages"path
Packit b5e560
Packit b5e560
    The portable way to write this code is
Packit b5e560
Packit b5e560
             eval $topath="\$$topath":$name
Packit b5e560
       eval path="\$$pages"path
Packit b5e560
    eval path="\$$pages"path
Packit b5e560
Packit b5e560
    You could also experiment with another new bash feature: ${!var}.
Packit b5e560
    This does indirect variable expansion, making the use of eval
Packit b5e560
    unnecessary.
Packit b5e560
Packit b5e560
6.  There is a problem with syslogd on many Linux distributions (Red Hat
Packit b5e560
    and Slackware are two that I have received reports about).  syslogd
Packit b5e560
    sends a SIGINT to its parent process, which is waiting for the daemon
Packit b5e560
    to finish its initialization.  The parent process then dies due to
Packit b5e560
    the SIGINT, and bash reports it, causing unexpected console output
Packit b5e560
    while the system is booting that looks something like
Packit b5e560
Packit b5e560
	starting daemons: syslogd/etc/rc.d/rc.M: line 29: 38 Interrupt ${NET}/syslogd
Packit b5e560
Packit b5e560
    Bash-2.0 reports events such as processes dying in scripts due to
Packit b5e560
    signals when the standard output is a tty.  Bash-1.14.x and previous
Packit b5e560
    versions did not report such events.
Packit b5e560
Packit b5e560
    This should probably be reported as a bug to whatever Linux distributor
Packit b5e560
    people see the problem on.  In my opinion, syslogd should be changed to
Packit b5e560
    use some other method of communication, or the wrapper function (which
Packit b5e560
    appeared to be `daemon' when I looked at it some time ago) or script
Packit b5e560
    (which appeared to be `syslog') should catch SIGINT, since it's an
Packit b5e560
    expected event, and exit cleanly.
Packit b5e560
Packit b5e560
7.  Several people have reported that `dip' (a program for SLIP/PPP
Packit b5e560
    on Linux) does not work with bash-2.0 installed as /bin/sh.
Packit b5e560
Packit b5e560
    I don't run any Linux boxes myself, and do not have the dip
Packit b5e560
    code handy to look at, but the `problem' with bash-2.0, as
Packit b5e560
    it has been related to me, is that bash requires the `-p'
Packit b5e560
    option to be supplied at invocation if it is to run setuid
Packit b5e560
    or setgid. 
Packit b5e560
Packit b5e560
    This means, among other things, that setuid or setgid programs
Packit b5e560
    which call system(3) (a horrendously bad practice in any case)
Packit b5e560
    relinquish their setuid/setgid status in the child that's forked
Packit b5e560
    to execute /bin/sh. 
Packit b5e560
Packit b5e560
    The following is an *unofficial* patch to bash-2.0 that causes it
Packit b5e560
    to not require `-p' to run setuid or setgid if invoked as `sh'.
Packit b5e560
    It has been reported to work on Linux.  It will make your system
Packit b5e560
    vulnerable to bogus system(3) calls in setuid executables.
Packit b5e560
Packit b5e560
--- ../bash-2.0.orig/shell.c    Wed Dec 18 14:16:30 1996
Packit b5e560
+++ shell.c     Fri Mar  7 13:12:03 1997
Packit b5e560
@@ -347,7 +347,7 @@
Packit b5e560
   if (posixly_correct)
Packit b5e560
     posix_initialize (posixly_correct);
Packit b5e560
Packit b5e560
-  if (running_setuid && privileged_mode == 0)
Packit b5e560
+  if (running_setuid && privileged_mode == 0 && act_like_sh == 0)
Packit b5e560
     disable_priv_mode ();
Packit b5e560
Packit b5e560
   /* Need to get the argument to a -c option processed in the
Packit b5e560
Packit b5e560
8.  Some people have asked about binding all of the keys in a PC-keyboard-
Packit b5e560
    style numeric keypad to readline functions.  Here's something I
Packit b5e560
    received from the gnu-win32 list that may help.  Insert the following
Packit b5e560
    lines into ~/.inputrc:
Packit b5e560
Packit b5e560
# home key
Packit b5e560
"\e[1~":beginning-of-line
Packit b5e560
# insert key
Packit b5e560
"\e[2~":kill-whole-line
Packit b5e560
# del key
Packit b5e560
"\e[3~":delete-char
Packit b5e560
# end key
Packit b5e560
"\e[4~":end-of-line
Packit b5e560
# pgup key
Packit b5e560
"\e[5~":history-search-forward
Packit b5e560
# pgdn key
Packit b5e560
"\e[6~":history-search-backward
Packit b5e560
Packit b5e560
9.  Hints for building under Minix 2.0 (Contributed by Terry R. McConnell,
Packit b5e560
    <tmc@barnyard.syr.edu>)
Packit b5e560
Packit b5e560
   The version of /bin/sh distributed with Minix is not up to the job of
Packit b5e560
   running the configure script. The easiest solution is to swap /bin/sh
Packit b5e560
   with /usr/bin/ash. Then use chmem(1) to increase the memory allocated
Packit b5e560
   to /bin/sh. The following settings are known to work:
Packit b5e560
Packit b5e560
   text         data     bss   stack  memory
Packit b5e560
   63552  9440          3304   65536  141832  /bin/sh
Packit b5e560
Packit b5e560
   If you have problems with make or yacc it may be worthwhile first to
Packit b5e560
   install the GNU versions of these utilities before attempting to build
Packit b5e560
   bash. (As of this writing, all of these utilities are available for the
Packit b5e560
   i386 as pre-built binaries via anonymous ftp at math.syr.edu in the
Packit b5e560
   pub/mcconnell/minix directory. Note that the GNU version of yacc is called
Packit b5e560
   bison.)
Packit b5e560
Packit b5e560
   Unless you want to see lots of warnings about old-style declarations,
Packit b5e560
   do LOCAL_CFLAGS=-wo; export LOCAL_CFLAGS before running configure.
Packit b5e560
   (These warnings are harmless, but annoying.)
Packit b5e560
Packit b5e560
   configure will insist that you supply a host type. For example, do
Packit b5e560
   ./configure --host=i386-pc-minix.
Packit b5e560
Packit b5e560
   Minix does not support the system calls required for a proper 
Packit b5e560
   implementation of ulimit().  The `ulimit' builtin will not be available.
Packit b5e560
Packit b5e560
   Configure will fail to notice that many things like uid_t are indeed
Packit b5e560
   typedef'd in <sys/types.h>, because it uses egrep for this purpose
Packit b5e560
   and minix has no egrep. You could try making a link /usr/bin/egrep -->
Packit b5e560
   /usr/bin/grep. Better is to install the GNU version of grep in
Packit b5e560
   /usr/local/bin and make the link /usr/local/bin/egrep -->/usr/local/bin/grep.
Packit b5e560
   (These must be hard links, of course, since Minix does not support
Packit b5e560
   symbolic links.)
Packit b5e560
Packit b5e560
   You will see many warnings of the form:
Packit b5e560
   warning: unknown s_type: 98
Packit b5e560
   I have no idea what this means, but it doesn't seem to matter.
Packit b5e560
Packit b5e560
10. If you do not have /usr/ccs/bin in your PATH when building on SunOS 5.x
Packit b5e560
    (Solaris 2), the configure script will be unable to find `ar' and
Packit b5e560
    `ranlib' (of course, ranlib is unnecessary).  Make sure your $PATH
Packit b5e560
    includes /usr/ccs/bin on SunOS 5.x.  This generally manifests itself
Packit b5e560
    with libraries not being built and make reporting errors like
Packit b5e560
    `cr: not found' when library construction is attempted.
Packit b5e560
Packit b5e560
11. Building a statically-linked bash on Solaris 2.5.x, 2.6, 7, or 8 is
Packit b5e560
    complicated.
Packit b5e560
Packit b5e560
    It's not possible to build a completely statically-linked binary, since
Packit b5e560
    part of the C library depends on dynamic linking.  The following recipe
Packit b5e560
    assumes that you're using gcc and the Solaris ld (/usr/ccs/bin/ld) on
Packit b5e560
    Solaris 2.5.x or 2.6:
Packit b5e560
Packit b5e560
	configure --enable-static-link
Packit b5e560
	make STATIC_LD= LOCAL_LIBS='-Wl,-B,dynamic -ldl -Wl,-B,static'
Packit b5e560
Packit b5e560
    This should result in a bash binary that depends only on libdl.so:
Packit b5e560
Packit b5e560
	thor(2)$ ldd bash
Packit b5e560
	        libdl.so.1 =>    /usr/lib/libdl.so.1
Packit b5e560
Packit b5e560
    If you're using the Sun C Compiler (Sun WorkShop C Compiler version
Packit b5e560
    4.2 was what I used), you should be able to get away with using
Packit b5e560
Packit b5e560
	configure --enable-static-link
Packit b5e560
	make STATIC_LD=  LOCAL_LIBS='-B dynamic -ldl -B static'
Packit b5e560
Packit b5e560
    If you want to completely remove any dependence on /usr, perhaps
Packit b5e560
    to put a copy of bash in /sbin and have it available when /usr is
Packit b5e560
    not mounted, force the build process to use the shared dl.so library
Packit b5e560
    in /etc/lib.
Packit b5e560
Packit b5e560
    For gcc, this would be something like
Packit b5e560
Packit b5e560
	configure --enable-static-link
Packit b5e560
	make STATIC_LD= LOCAL_LIBS='-Wl,-B,dynamic -Wl,-R/etc/lib -ldl -Wl,-B,static'
Packit b5e560
Packit b5e560
    For Sun's WS4.2 cc
Packit b5e560
Packit b5e560
	configure --enable-static-link
Packit b5e560
	make STATIC_LD=  LOCAL_LIBS='-B dynamic -R/etc/lib -ldl -B static'
Packit b5e560
Packit b5e560
    seems to work, at least on Solaris 2.5.1:
Packit b5e560
Packit b5e560
	thor(2)$ ldd bash
Packit b5e560
	        libdl.so.1 =>    /etc/lib/libdl.so.1
Packit b5e560
Packit b5e560
    On Solaris 7 (Solaris 8, using the version of gcc on the free software
Packit b5e560
    CD-ROM), the following recipe appears to work for gcc:
Packit b5e560
Packit b5e560
	configure --enable-static-link
Packit b5e560
	make STATIC_LD='-Wl,-Bstatic' LOCAL_LIBS='-Wl,-Bdynamic -Wl,-R/etc/lib -ldl -Wl,-Bstatic'
Packit b5e560
Packit b5e560
	thor.ins.cwru.edu(2)$ ldd bash
Packit b5e560
	        libdl.so.1 =>    /etc/lib/libdl.so.1
Packit b5e560
Packit b5e560
    Make the analogous changes if you are running Sun's C Compiler.
Packit b5e560
Packit b5e560
    I have received word that adding -L/etc/lib (or the equivalent
Packit b5e560
    -Wl,-L/etc/lib) might also be necessary, in addition to the -R/etc/lib.
Packit b5e560
Packit b5e560
    On later versions of Solaris, it may be necessary to add -lnsl before
Packit b5e560
    -ldl; statically-linked versions of bash using libnsl are not guaranteed
Packit b5e560
    to work correctly on future versions of Solaris.
Packit b5e560
Packit b5e560
12. Configuring bash to build it in a cross environment.  Currently only
Packit b5e560
    two native versions can be compiled this way, cygwin32 and x86 BeOS.
Packit b5e560
    For BeOS, you would configure it like this:
Packit b5e560
Packit b5e560
	export RANLIB=i586-beos-ranlib
Packit b5e560
	export AR=i586-beos-ar
Packit b5e560
	export CC=i586-beos-gcc
Packit b5e560
	configure i586-beos
Packit b5e560
Packit b5e560
    Similarly for cygwin32.
Packit b5e560
Packit b5e560
13. Bash-2.05 has reverted to the bash-2.03 behavior of honoring the current
Packit b5e560
    locale setting when processing ranges within pattern matching bracket
Packit b5e560
    expressions ([A-Z]).  This is what POSIX.2 and SUSv2 specify.
Packit b5e560
Packit b5e560
    The behavior of the matcher in bash-2.05 depends on the current LC_COLLATE
Packit b5e560
    setting.  Setting this variable to `C' or `POSIX' will result in the
Packit b5e560
    traditional behavior ([A-Z] matches all uppercase ASCII characters).
Packit b5e560
    Many other locales, including the en_US locale (the default on many US
Packit b5e560
    versions of Linux) collate the upper and lower case letters like this:
Packit b5e560
Packit b5e560
	AaBb...Zz
Packit b5e560
Packit b5e560
    which means that [A-Z] matches every letter except `z'.
Packit b5e560
Packit b5e560
    The portable way to specify upper case letters is [:upper:] instead of
Packit b5e560
    A-Z; lower case may be specified as [:lower:] instead of a-z.
Packit b5e560
Packit b5e560
    Look at the manual pages for setlocale(3), strcoll(3), and, if it is
Packit b5e560
    present, locale(1).  If you have locale(1), you can use it to find
Packit b5e560
    your current locale information even if you do not have any of the
Packit b5e560
    LC_ variables set.
Packit b5e560
Packit b5e560
    My advice is to put
Packit b5e560
Packit b5e560
        export LC_COLLATE=C
Packit b5e560
Packit b5e560
    into /etc/profile and inspect any shell scripts run from cron for
Packit b5e560
    constructs like [A-Z].  This will prevent things like
Packit b5e560
Packit b5e560
	rm [A-Z]*
Packit b5e560
Packit b5e560
    from removing every file in the current directory except those beginning
Packit b5e560
    with `z' and still allow individual users to change the collation order.
Packit b5e560
    Users may put the above command into their own profiles as well, of course.
Packit b5e560
Packit b5e560
14. Building on Interix (nee OpenNT), which Microsoft bought from Softway
Packit b5e560
    Systems and has seemingly abandoned (thanks to Kevin Moore for this item).
Packit b5e560
Packit b5e560
	1.  cp cross-build/opennt.cache config.cache
Packit b5e560
Packit b5e560
	2.  If desired, edit pathnames.h to set the values of SYS_PROFILE and
Packit b5e560
	    DEFAULT_HOSTS_FILE appropriately.
Packit b5e560
Packit b5e560
	3.  export CONFIG_SHELL=$INTERIX_ROOT/bin/sh
Packit b5e560
Packit b5e560
	4.  ./configure --prefix=$INTERIX_ROOT/usr/local (or wherever you
Packit b5e560
	    want it).
Packit b5e560
Packit b5e560
	5. make; make install; enjoy
Packit b5e560
Packit b5e560
15.  Configure with `CC=xlc' if you don't have gcc on AIX 4.2 and later
Packit b5e560
     versions.  `xlc' running in `cc' mode has trouble compiling error.c.
Packit b5e560
Packit b5e560
16.  Configure --disable-multibyte on NetBSD versions (1.4 through at least
Packit b5e560
     1.6.1) that include wctype.h but do not define wctype_t.
Packit b5e560
Packit b5e560
17.  Do NOT use bison-1.75.  It builds a non-working parser.  The most
Packit b5e560
     obvious effect is that constructs like "for i; do echo $i; done" don't
Packit b5e560
     loop over the positional parameters.
Packit b5e560
Packit b5e560
18.  I have received reports that using -O2 with the MIPSpro results in a
Packit b5e560
     binary that fails in strange ways.  Using -O1 seems to work.
Packit b5e560
Packit b5e560
19.  There is special handling to ensure the shell links against static
Packit b5e560
     versions of the included readline and history libraries on Mac OS X;
Packit b5e560
     Apple ships inadequate dynamic libreadline and libhistory "replacements"
Packit b5e560
     as standard libraries.
Packit b5e560
Packit b5e560
20.  If you're on a system like SGI Irix, and you get an error about not
Packit b5e560
     being able to refer to a dynamic symbol
Packit b5e560
     (ld: non-dynamic relocations refer to dynamic symbol PC), add
Packit b5e560
     -DNEED_EXTERN_PC to the LOCAL_CFLAGS variable in lib/readline/Makefile.in
Packit b5e560
     and rebuild.