No specific user configuration
[platform/upstream/bash.git] / NOTES
1 Platform-Specific Configuration and Operation Notes
2 ===================================================
3
4 1.  configure --without-gnu-malloc on:
5
6         alpha running OSF/1, Linux, or NetBSD (malloc needs 8-byte alignment;
7         bash malloc has 8-byte alignment now, but I have no alphas to test on)
8
9         next running NeXT/OS; machines running Openstep
10
11         all machines running SunOS YP code: SunOS4, SunOS5, HP/UX, if you
12         have problems with username completion or tilde expansion for
13         usernames found via YP/NIS
14
15         linux (optional, but don't do it if you're using Doug Lea's malloc)
16
17         QNX 4.2
18         other OSF/1 machines (KSR/1, HP, IBM AIX/ESA)
19         AIX
20         sparc SVR4, SVR4.2 (ICL reference port)
21         DG/UX
22         Cray
23         Haiku OS
24
25         NetBSD/sparc (malloc needs 8-byte alignment; bash malloc has 8-byte
26         alignment now, but I have no NetBSD machines to test on)
27
28         BSD/OS 2.1, 3.x if you want to use loadable builtins
29
30         Motorola m68k machines running System V.3.  There is a file descriptor
31         leak caused by using the bash malloc because closedir(3) needs to read
32         freed memory to find the file descriptor to close
33
34 2.  Configure using shlicc2 on BSD/OS 2.1 and BSD/OS 3.x to use loadable
35     builtins
36
37 3.  Bash cannot be built in a directory separate from the source directory
38     using configure --srcdir=... unless the version of `make' you're using
39     does $VPATH handling right.  The script support/mkclone can be used to
40     create a `build tree' using symlinks to get around this.
41
42 4.  I've had reports that username completion (as well as tilde expansion
43     and \u prompt expansion) does not work on IRIX 5.3 when linking with
44     -lnsl.  This is only a problem when you're running NIS, since
45     apparently -lnsl supports only /etc/passwd and not the NIS functions
46     for retrieving usernames and passwords.  Editing the Makefile after
47     configure runs and removing the `-lnsl' from the assignment to `LIBS'
48     fixes the problem.
49
50 5.  There is a problem with the `makewhatis' script in older (pre-7.0)
51     versions of Red Hat Linux.  Running `makewhatis' with bash-2.0 or
52     later versions results in error messages like this:
53
54     /usr/sbin/makewhatis: cd: manpath: No such file or directory
55     /usr/sbin/makewhatis: manpath/whatis: No such file or directory
56     chmod: manpath/whatis: No such file or directory
57     /usr/sbin/makewhatis: cd: catpath: No such file or directory
58     /usr/sbin/makewhatis: catpath/whatis: No such file or directory
59     chmod: catpath/whatis: No such file or directory
60
61     The problem is with `makewhatis'.  Red Hat (and possibly other
62     Linux distributors) uses a construct like this in the code:
63
64         eval path=$"$pages"path
65
66     to do indirect variable expansion.  This `happened to work' in
67     bash-1.14 and previous versions, but that was more an accident
68     of implementation than anything else -- it was never supported
69     and certainly is not portable.
70
71     Bash-2.0 has a new feature that gives a new meaning to $"...".
72     This is explained more completely in item 1 in the COMPAT file.
73
74     The three lines in the `makewhatis' script that need to be changed
75     look like this:
76
77              eval $topath=$"$topath":$name
78     [...]
79        eval path=$"$pages"path
80     [...]
81     eval path=$"$pages"path
82
83     The portable way to write this code is
84
85              eval $topath="\$$topath":$name
86        eval path="\$$pages"path
87     eval path="\$$pages"path
88
89     You could also experiment with another new bash feature: ${!var}.
90     This does indirect variable expansion, making the use of eval
91     unnecessary.
92
93 6.  There is a problem with syslogd on many Linux distributions (Red Hat
94     and Slackware are two that I have received reports about).  syslogd
95     sends a SIGINT to its parent process, which is waiting for the daemon
96     to finish its initialization.  The parent process then dies due to
97     the SIGINT, and bash reports it, causing unexpected console output
98     while the system is booting that looks something like
99
100         starting daemons: syslogd/etc/rc.d/rc.M: line 29: 38 Interrupt ${NET}/syslogd
101
102     Bash-2.0 reports events such as processes dying in scripts due to
103     signals when the standard output is a tty.  Bash-1.14.x and previous
104     versions did not report such events.
105
106     This should probably be reported as a bug to whatever Linux distributor
107     people see the problem on.  In my opinion, syslogd should be changed to
108     use some other method of communication, or the wrapper function (which
109     appeared to be `daemon' when I looked at it some time ago) or script
110     (which appeared to be `syslog') should catch SIGINT, since it's an
111     expected event, and exit cleanly.
112
113 7.  Several people have reported that `dip' (a program for SLIP/PPP
114     on Linux) does not work with bash-2.0 installed as /bin/sh.
115
116     I don't run any Linux boxes myself, and do not have the dip
117     code handy to look at, but the `problem' with bash-2.0, as
118     it has been related to me, is that bash requires the `-p'
119     option to be supplied at invocation if it is to run setuid
120     or setgid. 
121
122     This means, among other things, that setuid or setgid programs
123     which call system(3) (a horrendously bad practice in any case)
124     relinquish their setuid/setgid status in the child that's forked
125     to execute /bin/sh. 
126
127     The following is an *unofficial* patch to bash-2.0 that causes it
128     to not require `-p' to run setuid or setgid if invoked as `sh'.
129     It has been reported to work on Linux.  It will make your system
130     vulnerable to bogus system(3) calls in setuid executables.
131
132 --- ../bash-2.0.orig/shell.c    Wed Dec 18 14:16:30 1996
133 +++ shell.c     Fri Mar  7 13:12:03 1997
134 @@ -347,7 +347,7 @@
135    if (posixly_correct)
136      posix_initialize (posixly_correct);
137
138 -  if (running_setuid && privileged_mode == 0)
139 +  if (running_setuid && privileged_mode == 0 && act_like_sh == 0)
140      disable_priv_mode ();
141
142    /* Need to get the argument to a -c option processed in the
143
144 8.  Some people have asked about binding all of the keys in a PC-keyboard-
145     style numeric keypad to readline functions.  Here's something I
146     received from the gnu-win32 list that may help.  Insert the following
147     lines into ~/.inputrc:
148
149 # home key
150 "\e[1~":beginning-of-line
151 # insert key
152 "\e[2~":kill-whole-line
153 # del key
154 "\e[3~":delete-char
155 # end key
156 "\e[4~":end-of-line
157 # pgup key
158 "\e[5~":history-search-forward
159 # pgdn key
160 "\e[6~":history-search-backward
161
162 9.  Hints for building under Minix 2.0 (Contributed by Terry R. McConnell,
163     <tmc@barnyard.syr.edu>)
164
165    The version of /bin/sh distributed with Minix is not up to the job of
166    running the configure script. The easiest solution is to swap /bin/sh
167    with /usr/bin/ash. Then use chmem(1) to increase the memory allocated
168    to /bin/sh. The following settings are known to work:
169
170    text         data     bss   stack  memory
171    63552  9440          3304   65536  141832  /bin/sh
172
173    If you have problems with make or yacc it may be worthwhile first to
174    install the GNU versions of these utilities before attempting to build
175    bash. (As of this writing, all of these utilities are available for the
176    i386 as pre-built binaries via anonymous ftp at math.syr.edu in the
177    pub/mcconnell/minix directory. Note that the GNU version of yacc is called
178    bison.)
179
180    Unless you want to see lots of warnings about old-style declarations,
181    do LOCAL_CFLAGS=-wo; export LOCAL_CFLAGS before running configure.
182    (These warnings are harmless, but annoying.)
183
184    configure will insist that you supply a host type. For example, do
185    ./configure --host=i386-pc-minix.
186
187    Minix does not support the system calls required for a proper 
188    implementation of ulimit().  The `ulimit' builtin will not be available.
189
190    Configure will fail to notice that many things like uid_t are indeed
191    typedef'd in <sys/types.h>, because it uses egrep for this purpose
192    and minix has no egrep. You could try making a link /usr/bin/egrep -->
193    /usr/bin/grep. Better is to install the GNU version of grep in
194    /usr/local/bin and make the link /usr/local/bin/egrep -->/usr/local/bin/grep.
195    (These must be hard links, of course, since Minix does not support
196    symbolic links.)
197
198    You will see many warnings of the form:
199    warning: unknown s_type: 98
200    I have no idea what this means, but it doesn't seem to matter.
201
202 10. If you do not have /usr/ccs/bin in your PATH when building on SunOS 5.x
203     (Solaris 2), the configure script will be unable to find `ar' and
204     `ranlib' (of course, ranlib is unnecessary).  Make sure your $PATH
205     includes /usr/ccs/bin on SunOS 5.x.  This generally manifests itself
206     with libraries not being built and make reporting errors like
207     `cr: not found' when library construction is attempted.
208
209 11. Building a statically-linked bash on Solaris 2.5.x, 2.6, 7, or 8 is
210     complicated.
211
212     It's not possible to build a completely statically-linked binary, since
213     part of the C library depends on dynamic linking.  The following recipe
214     assumes that you're using gcc and the Solaris ld (/usr/ccs/bin/ld) on
215     Solaris 2.5.x or 2.6:
216
217         configure --enable-static-link
218         make STATIC_LD= LOCAL_LIBS='-Wl,-B,dynamic -ldl -Wl,-B,static'
219
220     This should result in a bash binary that depends only on libdl.so:
221
222         thor(2)$ ldd bash
223                 libdl.so.1 =>    /usr/lib/libdl.so.1
224
225     If you're using the Sun C Compiler (Sun WorkShop C Compiler version
226     4.2 was what I used), you should be able to get away with using
227
228         configure --enable-static-link
229         make STATIC_LD=  LOCAL_LIBS='-B dynamic -ldl -B static'
230
231     If you want to completely remove any dependence on /usr, perhaps
232     to put a copy of bash in /sbin and have it available when /usr is
233     not mounted, force the build process to use the shared dl.so library
234     in /etc/lib.
235
236     For gcc, this would be something like
237
238         configure --enable-static-link
239         make STATIC_LD= LOCAL_LIBS='-Wl,-B,dynamic -Wl,-R/etc/lib -ldl -Wl,-B,static'
240
241     For Sun's WS4.2 cc
242
243         configure --enable-static-link
244         make STATIC_LD=  LOCAL_LIBS='-B dynamic -R/etc/lib -ldl -B static'
245
246     seems to work, at least on Solaris 2.5.1:
247
248         thor(2)$ ldd bash
249                 libdl.so.1 =>    /etc/lib/libdl.so.1
250
251     On Solaris 7 (Solaris 8, using the version of gcc on the free software
252     CD-ROM), the following recipe appears to work for gcc:
253
254         configure --enable-static-link
255         make STATIC_LD='-Wl,-Bstatic' LOCAL_LIBS='-Wl,-Bdynamic -Wl,-R/etc/lib -ldl -Wl,-Bstatic'
256
257         thor.ins.cwru.edu(2)$ ldd bash
258                 libdl.so.1 =>    /etc/lib/libdl.so.1
259
260     Make the analogous changes if you are running Sun's C Compiler.
261
262     I have received word that adding -L/etc/lib (or the equivalent
263     -Wl,-L/etc/lib) might also be necessary, in addition to the -R/etc/lib.
264
265     On later versions of Solaris, it may be necessary to add -lnsl before
266     -ldl; statically-linked versions of bash using libnsl are not guaranteed
267     to work correctly on future versions of Solaris.
268
269 12. Configuring bash to build it in a cross environment.  Currently only
270     two native versions can be compiled this way, cygwin32 and x86 BeOS.
271     For BeOS, you would configure it like this:
272
273         export RANLIB=i586-beos-ranlib
274         export AR=i586-beos-ar
275         export CC=i586-beos-gcc
276         configure i586-beos
277
278     Similarly for cygwin32.
279
280 13. Bash-2.05 has reverted to the bash-2.03 behavior of honoring the current
281     locale setting when processing ranges within pattern matching bracket
282     expressions ([A-Z]).  This is what POSIX.2 and SUSv2 specify.
283
284     The behavior of the matcher in bash-2.05 depends on the current LC_COLLATE
285     setting.  Setting this variable to `C' or `POSIX' will result in the
286     traditional behavior ([A-Z] matches all uppercase ASCII characters).
287     Many other locales, including the en_US locale (the default on many US
288     versions of Linux) collate the upper and lower case letters like this:
289
290         AaBb...Zz
291
292     which means that [A-Z] matches every letter except `z'.
293
294     The portable way to specify upper case letters is [:upper:] instead of
295     A-Z; lower case may be specified as [:lower:] instead of a-z.
296
297     Look at the manual pages for setlocale(3), strcoll(3), and, if it is
298     present, locale(1).  If you have locale(1), you can use it to find
299     your current locale information even if you do not have any of the
300     LC_ variables set.
301
302     My advice is to put
303
304         export LC_COLLATE=C
305
306     into /etc/profile and inspect any shell scripts run from cron for
307     constructs like [A-Z].  This will prevent things like
308
309         rm [A-Z]*
310
311     from removing every file in the current directory except those beginning
312     with `z' and still allow individual users to change the collation order.
313     Users may put the above command into their own profiles as well, of course.
314
315 14. Building on Interix (nee OpenNT), which Microsoft bought from Softway
316     Systems and has seemingly abandoned (thanks to Kevin Moore for this item).
317
318         1.  cp cross-build/opennt.cache config.cache
319
320         2.  If desired, edit pathnames.h to set the values of SYS_PROFILE and
321             DEFAULT_HOSTS_FILE appropriately.
322
323         3.  export CONFIG_SHELL=$INTERIX_ROOT/bin/sh
324
325         4.  ./configure --prefix=$INTERIX_ROOT/usr/local (or wherever you
326             want it).
327
328         5. make; make install; enjoy
329
330 15.  Configure with `CC=xlc' if you don't have gcc on AIX 4.2 and later
331      versions.  `xlc' running in `cc' mode has trouble compiling error.c.
332
333 16.  Configure --disable-multibyte on NetBSD versions (1.4 through at least
334      1.6.1) that include wctype.h but do not define wctype_t.
335
336 17.  Do NOT use bison-1.75.  It builds a non-working parser.  The most
337      obvious effect is that constructs like "for i; do echo $i; done" don't
338      loop over the positional parameters.
339
340 18.  I have received reports that using -O2 with the MIPSpro results in a
341      binary that fails in strange ways.  Using -O1 seems to work.
342
343 19.  There is special handling to ensure the shell links against static
344      versions of the included readline and history libraries on Mac OS X;
345      Apple ships inadequate dynamic libreadline and libhistory "replacements"
346      as standard libraries.
347
348 20.  If you're on a system like SGI Irix, and you get an error about not
349      being able to refer to a dynamic symbol
350      (ld: non-dynamic relocations refer to dynamic symbol PC), add
351      -DNEED_EXTERN_PC to the LOCAL_CFLAGS variable in lib/readline/Makefile.in
352      and rebuild.