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