fix for printf with broken strtold; fix readline reading specified number of multibyte characters; fix read builtin to deal with invalid utf-8 continuation character as delimiter; turn off -n if supplied at interactive shell invocation

This commit is contained in:
Chet Ramey
2024-08-21 16:11:01 -04:00
parent cf694865de
commit e327891b52
1909 changed files with 1048473 additions and 1977 deletions
+52
View File
@@ -9989,5 +9989,57 @@ lib/readline/histexpand.c
search function, set the right flags and just call _hs_history_search
with those flags using -1 for list direction and line direction
8/13
----
builtins/printf.def
- printf_builtin: fix params to call to mklong for long double formats
if STRTOLD_BROKEN is defined
lib/sh/winsize.c
- rearrange includes to make sure <termios.h> is included if
HAVE_TCGETWINSIZE is defined
Report from Grisha Levit <grishalevit@gmail.com>
8/14
----
lib/readline/rlmbutil.h
- _rl_is_basic: adapted from gnulib is_basic; tells whether a character
is a single byte because it's guaranteed by ISO C and POSIX
lib/readline/mbutil.c
- _rl_mbstrlen: counts the number of possibly multibyte characters in a
string depending on the current locale; uses _rl_utf8_mbstrlen or
_rl_gen_mbstrlen as appropriate (or strlen for a single-byte locale)
lib/readline/readline.c
- _rl_internal_char_cleanup: if we are using multibyte characters, call
_rl_mbstrlen to determine whether or not we've read as many characters
than rl_num_chars_to_read says we should
Report from Grisha Levit <grishalevit@gmail.com>
builtins/read.def
- delim,delim_char: once again an int so we can more easily
distinguish -1 and other unsigned char values >= 0x7f; make
sure delim gets an unsigned char if passed with -d
- edit_line: now takes an int parameter for the delim char; only add
the delim to the end of the string if it's non-negative
- set_eol_delim,unset_eol_delim: now explicitly check whether or not
the delimiter character is non-negativesince it's no longer unsigned
- read_mbchar: make sure to cast the char read to unsigned before
comparing it against the delim
Report and patch from Grisha Levit <grishalevit@gmail.com>
8/15
----
include/shmbchar.h,lib/sh/shmbchar.c
- is_basic: update test for IS_BASIC_ASCII to include $, @, and `,
which ISO C guarantees to be single-byte
- is_basic_table: update bitmap to include new characters
8/21
----
shell.c
- main: make sure to set read_but_dont_execute (-n) to 0 in an
interactive shell in case it was set at invocation, but not in
cases where it was forced with -i
Report from Milana <94888u@riseup.net>
File diff suppressed because it is too large Load Diff
+466
View File
@@ -0,0 +1,466 @@
#
# Master author manifest for bash
#
# The files in lib/intl were taken from the GNU gettext distribution.
#
# Any files appearing in the bash distribution not listed in this file
# were created by Chet Ramey.
#
# Filename authors (first is original author)
#
README Brian Fox, Chet Ramey
INSTALL Brian Fox, Chet Ramey
COPYING Brian Fox, Chet Ramey
MANIFEST Brian Fox, Chet Ramey
configure Chet Ramey
Makefile.in Brian Fox, Chet Ramey
configure.in Chet Ramey
aclocal.m4 Chet Ramey
config.h.top Chet Ramey
config.h.bot Chet Ramey
config.h.in Chet Ramey
array.c Chet Ramey
print_cmd.c Brian Fox, Chet Ramey
general.c Brian Fox, Chet Ramey
variables.c Brian Fox, Chet Ramey
make_cmd.c Brian Fox, Chet Ramey
copy_cmd.c Brian Fox, Chet Ramey
unwind_prot.c Brian Fox, Chet Ramey
dispose_cmd.c Brian Fox, Chet Ramey
getcwd.c Roland McGrath, Brian Fox, Chet Ramey
bashhist.c Chet Ramey
hash.c Brian Fox, Chet Ramey
parse.y Brian Fox, Chet Ramey
subst.c Brian Fox, Chet Ramey
shell.c Brian Fox, Chet Ramey
sig.c Chet Ramey
trap.c Brian Fox, Chet Ramey
siglist.c Brian Fox, Chet Ramey
version.c Brian Fox, Chet Ramey
flags.c Brian Fox, Chet Ramey
jobs.c Brian Fox, Chet Ramey
input.c Chet Ramey
mailcheck.c Brian Fox, Chet Ramey
pathexp.c Chet Ramey
test.c Brian Fox, Chet Ramey
expr.c Chet Ramey, Brian Fox
alias.c Brian Fox, Chet Ramey
execute_cmd.c Brian Fox, Chet Ramey
bashline.c Brian Fox, Chet Ramey
braces.c Brian Fox, Chet Ramey
bracecomp.c Brian Fox, Chet Ramey, Tom Tromey
nojobs.c Brian Fox, Chet Ramey
vprint.c Chet Ramey
oslib.c Chet Ramey
error.c Brian Fox, Chet Ramey
xmalloc.c Brian Fox, Chet Ramey
alias.h Brian Fox, Chet Ramey
array.h Chet Ramey
builtins.h Brian Fox, Chet Ramey
parser.h Brian Fox, Chet Ramey
variables.h Brian Fox, Chet Ramey
machines.h Brian Fox, Chet Ramey
jobs.h Brian Fox, Chet Ramey
maxpath.h Brian Fox, Chet Ramey
pathexp.h Chet Ramey
mailcheck.h Chet Ramey
filecntl.h Brian Fox, Chet Ramey
hash.h Brian Fox, Chet Ramey
quit.h Brian Fox, Chet Ramey
flags.h Brian Fox, Chet Ramey
shell.h Brian Fox, Chet Ramey
bashjmp.h Chet Ramey
sig.h Chet Ramey
trap.h Brian Fox, Chet Ramey
general.h Brian Fox, Chet Ramey
unwind_prot.h Brian Fox, Chet Ramey
input.h Brian Fox, Chet Ramey
error.h Brian Fox, Chet Ramey
command.h Brian Fox, Chet Ramey
externs.h Chet Ramey
siglist.h Chet Ramey
subst.h Brian Fox, Chet Ramey
dispose_cmd.h Brian Fox, Chet Ramey
bashansi.h Brian Fox, Chet Ramey
make_cmd.h Brian Fox, Chet Ramey
bashhist.h Chet Ramey
bashline.h Chet Ramey
execute_cmd.h Chet Ramey
bashtypes.h Chet Ramey
bashtty.h Chet Ramey
pathnames.h Chet Ramey
y.tab.c Brian Fox, Chet Ramey
y.tab.h Brian Fox, Chet Ramey
parser-built Brian Fox, Chet Ramey
posixstat.h Brian Fox, Chet Ramey
stdc.h Chet Ramey
ansi_stdlib.h Brian Fox, Chet Ramey
memalloc.h Chet Ramey
builtins/ChangeLog Brian Fox, Chet Ramey
builtins/Makefile.in Brian Fox, Chet Ramey
builtins/alias.def Brian Fox, Chet Ramey
builtins/bind.def Brian Fox, Chet Ramey
builtins/break.def Brian Fox, Chet Ramey
builtins/builtin.def Brian Fox, Chet Ramey
builtins/caller.def Rocky Bernstein, Chet Ramey
builtins/cd.def Brian Fox, Chet Ramey
builtins/colon.def Brian Fox, Chet Ramey
builtins/command.def Brian Fox, Chet Ramey
builtins/common.c Brian Fox, Chet Ramey
builtins/declare.def Brian Fox, Chet Ramey
builtins/echo.def Brian Fox, Chet Ramey
builtins/enable.def Brian Fox, Chet Ramey
builtins/eval.def Brian Fox, Chet Ramey
builtins/exec.def Brian Fox, Chet Ramey
builtins/exit.def Brian Fox, Chet Ramey
builtins/fc.def Brian Fox, Chet Ramey
builtins/fg_bg.def Brian Fox, Chet Ramey
builtins/getopt.c Roland McGrath, Brian Fox, Chet Ramey
builtins/getopt.h Roland McGrath, Brian Fox, Chet Ramey
builtins/getopts.def Brian Fox, Chet Ramey
builtins/hash.def Brian Fox, Chet Ramey
builtins/hashcom.h Brian Fox, Chet Ramey
builtins/help.def Brian Fox, Chet Ramey
builtins/let.def Chet Ramey, Brian Fox
builtins/history.def Brian Fox, Chet Ramey
builtins/jobs.def Brian Fox, Chet Ramey
builtins/kill.def Brian Fox, Chet Ramey
builtins/mapfile.def Rocky Bernstein
builtins/mkbuiltins.c Brian Fox, Chet Ramey
builtins/pushd.def Brian Fox, Chet Ramey
builtins/read.def Brian Fox, Chet Ramey
builtins/reserved.def Brian Fox, Chet Ramey
builtins/return.def Brian Fox, Chet Ramey
builtins/set.def Brian Fox, Chet Ramey
builtins/setattr.def Brian Fox, Chet Ramey
builtins/shift.def Brian Fox, Chet Ramey
builtins/shopt.def Chet Ramey
builtins/source.def Brian Fox, Chet Ramey
builtins/suspend.def Brian Fox, Chet Ramey
builtins/test.def Brian Fox, Chet Ramey
builtins/times.def Brian Fox, Chet Ramey
builtins/trap.def Brian Fox, Chet Ramey
builtins/type.def Brian Fox, Chet Ramey
builtins/ulimit.def Chet Ramey, Brian Fox
builtins/umask.def Brian Fox, Chet Ramey
builtins/wait.def Brian Fox, Chet Ramey
builtins/psize.c Chet Ramey, Brian Fox
builtins/psize.sh Chet Ramey, Brian Fox
builtins/inlib.def Chet Ramey
builtins/bashgetopt.c Chet Ramey
builtins/common.h Chet Ramey
builtins/bashgetopt.h Chet Ramey
lib/doc-support/texindex.c bug-texinfo@prep.ai.mit.edu, Chet Ramey
lib/doc-support/Makefile.in Chet Ramey
lib/doc-support/getopt.h Roland McGrath
lib/doc-support/getopt.c Roland McGrath
lib/doc-support/getopt1.c Roland McGrath
lib/glob/ChangeLog Brian Fox, Chet Ramey
lib/glob/Makefile.in Brian Fox, Chet Ramey
lib/glob/strmatch.c Roland McGrath, Brian Fox, Chet Ramey
lib/glob/strmatch.h Roland McGrath, Brian Fox, Chet Ramey
lib/glob/glob.c Richard Stallman, Roland McGrath, Brian Fox, Chet Ramey
lib/glob/glob.h Chet Ramey
lib/glob/ndir.h Doug Gwyn, Richard Stallman
lib/glob/doc/Makefile.in Brian Fox, Chet Ramey
lib/glob/doc/glob.texi Brian Fox, Chet Ramey
lib/malloc/Makefile.in Chet Ramey
lib/malloc/alloca.c Doug Gwyn, Richard Stallman, Brian Fox, Chet Ramey
lib/malloc/getpagesize.h Brian Fox, Chet Ramey
lib/malloc/malloc.c Chris Kingsley, Mike Muuss, Richard Stallman, Brian Fox, Chet Ramey
lib/malloc/gmalloc.c Mike Haertel, Roland McGrath
lib/malloc/stub.c Chet Ramey
lib/malloc/i386-alloca.s Richard Stallman
lib/malloc/x386-alloca.s Chip Salzenberg, Richard Stallman
lib/malloc/xmalloc.c Brian Fox, Chet Ramey
lib/posixheaders/posixstat.h Brian Fox, Chet Ramey
lib/posixheaders/ansi_stdlib.h Brian Fox, Chet Ramey
lib/posixheaders/stdc.h Chet Ramey
lib/posixheaders/memalloc.h Chet Ramey
lib/posixheaders/filecntl.h Brian Fox, Chet Ramey
lib/readline/Makefile.in Brian Fox, Chet Ramey
lib/readline/COPYING Brian Fox, Chet Ramey
lib/readline/ChangeLog Brian Fox, Chet Ramey
lib/readline/readline.c Brian Fox, Chet Ramey
lib/readline/vi_mode.c Brian Fox, Chet Ramey
lib/readline/emacs_keymap.c Brian Fox, Chet Ramey
lib/readline/vi_keymap.c Brian Fox, Chet Ramey
lib/readline/funmap.c Brian Fox, Chet Ramey
lib/readline/keymaps.c Brian Fox, Chet Ramey
lib/readline/xmalloc.c Brian Fox, Chet Ramey
lib/readline/search.c Brian Fox, Chet Ramey
lib/readline/isearch.c Brian Fox, Chet Ramey
lib/readline/parens.c Brian Fox, Chet Ramey
lib/readline/rltty.c Brian Fox, Chet Ramey
lib/readline/complete.c Brian Fox, Chet Ramey
lib/readline/bind.c Brian Fox, Chet Ramey
lib/readline/display.c Brian Fox, Chet Ramey
lib/readline/signals.c Brian Fox, Chet Ramey
lib/readline/kill.c Brian Fox, Chet Ramey
lib/readline/undo.c Brian Fox, Chet Ramey
lib/readline/input.c Brian Fox, Chet Ramey
lib/readline/macro.c Brian Fox, Chet Ramey
lib/readline/util.c Brian Fox, Chet Ramey
lib/readline/callback.c Chet Ramey
lib/readline/readline.h Brian Fox, Chet Ramey
lib/readline/chardefs.h Brian Fox, Chet Ramey
lib/readline/keymaps.h Brian Fox, Chet Ramey
lib/readline/rldefs.h Brian Fox, Chet Ramey
lib/readline/posixstat.h Brian Fox, Chet Ramey
lib/readline/ansi_stdlib.h Brian Fox, Chet Ramey
lib/readline/memalloc.h Chet Ramey
lib/readline/rlconf.h Chet Ramey
lib/readline/rltty.h Chet Ramey
lib/readline/history.c Brian Fox, Chet Ramey
lib/readline/histexpand.c Brian Fox, Chet Ramey
lib/readline/histfile.c Brian Fox, Chet Ramey
lib/readline/histsearch.c Brian Fox, Chet Ramey
lib/readline/history.h Brian Fox, Chet Ramey
lib/readline/histlib.h Brian Fox, Chet Ramey
lib/readline/tilde.c Brian Fox, Chet Ramey
lib/readline/tilde.h Brian Fox, Chet Ramey
lib/readline/doc/texindex.c bug-texinfo@prep.ai.mit.edu, Chet Ramey
lib/readline/doc/Makefile Brian Fox, Chet Ramey
lib/readline/doc/rlman.texinfo Brian Fox, Chet Ramey
lib/readline/doc/rltech.texinfo Brian Fox, Chet Ramey
lib/readline/doc/rluser.texinfo Brian Fox, Chet Ramey
lib/readline/doc/hist.texinfo Brian Fox, Chet Ramey
lib/readline/doc/hstech.texinfo Brian Fox, Chet Ramey
lib/readline/doc/hsuser.texinfo Brian Fox, Chet Ramey
lib/readline/examples/Makefile Brian Fox
lib/readline/examples/fileman.c Brian Fox
lib/readline/examples/manexamp.c Brian Fox
lib/readline/examples/histexamp.c Brian Fox, Chet Ramey
lib/readline/examples/rltest.c Brian Fox, Chet Ramey
lib/readline/examples/Inputrc Brian Fox, Chet Ramey
lib/termcap/Makefile.in David MacKenzie, Chet Ramey
lib/termcap/termcap.c David MacKenzie
lib/termcap/termcap.h David MacKenzie
lib/termcap/tparam.c David MacKenzie
lib/termcap/version.c David MacKenzie
lib/termcap/grot/termcap.info David MacKenzie
lib/termcap/grot/termcap.info-1 David MacKenzie
lib/termcap/grot/termcap.info-2 David MacKenzie
lib/termcap/grot/termcap.info-3 David MacKenzie
lib/termcap/grot/termcap.info-4 David MacKenzie
lib/termcap/grot/NEWS David MacKenzie
lib/termcap/grot/INSTALL David MacKenzie
lib/termcap/grot/ChangeLog David MacKenzie
lib/termcap/grot/texinfo.tex David MacKenzie
lib/termcap/grot/termcap.texi David MacKenzie
lib/termcap/grot/Makefile.in David MacKenzie
lib/termcap/grot/configure David MacKenzie
lib/termcap/grot/configure.in David MacKenzie
lib/termcap/grot/COPYING David MacKenzie
lib/termcap/grot/README David MacKenzie
lib/tilde/ChangeLog Brian Fox, Chet Ramey
lib/tilde/Makefile.in Brian Fox, Chet Ramey
lib/tilde/doc/tilde.texi Brian Fox, Chet Ramey
lib/tilde/doc/Makefile Brian Fox, Chet Ramey
lib/tilde/tilde.c Brian Fox, Chet Ramey
lib/tilde/tilde.h Brian Fox, Chet Ramey
lib/tilde/memalloc.h Brian Fox, Chet Ramey
CWRU/misc/open-files.c Chet Ramey
CWRU/misc/sigs.c Chet Ramey
CWRU/misc/pid.c Chet Ramey
CWRU/misc/sigstat.c Chet Ramey
CWRU/misc/bison Chet Ramey
CWRU/misc/aux-machine-desc Chet Ramey
CWRU/PLATFORMS Chet Ramey
CWRU/README Chet Ramey
CWRU/CWRU.CHANGES.051093 Chet Ramey
CWRU/POSIX.NOTES Chet Ramey
CWRU/CWRU.CHANGES.071193 Chet Ramey
CWRU/CWRU.CHANGES.090393 Chet Ramey
doc/Makefile.in Brian Fox, Chet Ramey
doc/bash.1 Chet Ramey
doc/builtins.1 Chet Ramey
doc/bash.ps Chet Ramey
doc/bash.txt Chet Ramey
doc/readline.3 Chet Ramey
doc/readline.ps Chet Ramey
doc/readline.txt Chet Ramey
doc/texinfo.tex Richard Stallman
doc/features.texi Brian Fox, Chet Ramey
doc/features.ps Brian Fox, Chet Ramey
doc/features.info Brian Fox, Chet Ramey
doc/features.dvi Brian Fox, Chet Ramey
doc/bash_builtins.1 Chet Ramey
doc/bash_builtins.ps Chet Ramey
doc/bash_builtins.txt Chet Ramey
doc/bash_builtins.readme Chet Ramey
doc/article.ms Chet Ramey
doc/FAQ Chet Ramey
support/cat-s Brian Fox, Chet Ramey
support/mksysdefs Brian Fox, Chet Ramey
support/mkversion.c Brian Fox, Chet Ramey
support/mksignames.c Brian Fox, Chet Ramey
support/getcppsyms.c Brian Fox, Chet Ramey
support/cppmagic Brian Fox, Chet Ramey
support/pagesize.sh Chet Ramey, Brian Fox
support/pagesize.c Chet Ramey, Brian Fox
support/bash.xbm Brian Fox
support/FAQ Brian Fox
support/PORTING Brian Fox
support/mklinks Brian Fox
support/fixlinks Chet Ramey
support/mkdirs Chet Ramey
support/clone-bash Chet Ramey
support/bashbug.sh Chet Ramey
support/mkmachtype Chet Ramey
support/recho.c Chet Ramey
support/config.guess Per Bothner, Chet Ramey
support/config.sub Richard Stallman, Chet Ramey
support/install.sh MIT X Consortium (X11R5)
support/endian.c Chet Ramey
support/printenv Chet Ramey
examples/precedence-tester Brian Fox, Chet Ramey
examples/functions/substr Brian Fox, Chet Ramey
examples/functions/kshenv Chet Ramey
examples/functions/autoload Chet Ramey
examples/functions/csh-compat Brian Fox, Chet Ramey
examples/functions/shcat Chet Ramey
examples/functions/substr2 Chet Ramey
examples/functions/term Chet Ramey
examples/functions/whatis Chet Ramey
examples/functions/whence Chet Ramey
examples/functions/func Chet Ramey
examples/functions/dirname Brian Fox, Noah Friedman
examples/functions/basename Brian Fox, Noah Friedman
examples/functions/exitstat Noah Friedman, Roland McGrath
examples/functions/external Noah Friedman
examples/functions/fact Brian Fox
examples/functions/manpage Tom Tromey
examples/functions/fstty Chet Ramey
examples/functions/jj.bash Chet Ramey
examples/functions/notify.bash Chet Ramey
examples/loadables/getconf.c J.T. Conklin
examples/scripts/shprompt Chet Ramey
examples/scripts/adventure.sh Chet Ramey, Doug Gwyn
examples/scripts/bcsh.sh Chris Robertson, Chet Ramey
examples/startup-files/Bashrc Brian Fox
examples/startup-files/Bash_aliases Brian Fox
examples/startup-files/Bash_profile Brian Fox
examples/startup-files/bash-profile Brian Fox
examples/startup-files/bashrc Chet Ramey
examples/suncmd.termcap Brian Fox, Chet Ramey
examples/alias-conv.sh Brian Fox, Chet Ramey
tests/README Chet Ramey
tests/arith.tests Chet Ramey
tests/arith.right Chet Ramey
tests/array.tests Chet Ramey
tests/array.right Chet Ramey
tests/dollar-at.sh Chet Ramey
tests/dollar-star.sh Chet Ramey
tests/dollar.right Chet Ramey
tests/exp-tests Chet Ramey
tests/exp.right Chet Ramey
tests/glob-test Chet Ramey
tests/glob.right Chet Ramey
tests/ifs-test-1.sh Chet Ramey
tests/ifs-test-2.sh Chet Ramey
tests/ifs-test-3.sh Chet Ramey
tests/ifs.1.right Chet Ramey
tests/ifs.2.right Chet Ramey
tests/ifs.3.right Chet Ramey
tests/input-line.sh Chet Ramey
tests/input-line.sub Chet Ramey
tests/input.right Chet Ramey
tests/minus-e Chet Ramey
tests/minus-e.right Chet Ramey
tests/new-exp.tests Chet Ramey
tests/new-exp.right Chet Ramey
tests/prec.right Chet Ramey
tests/precedence Chet Ramey
tests/run-all Chet Ramey
tests/run-dollars Chet Ramey
tests/run-exp-tests Chet Ramey
tests/run-glob-test Chet Ramey
tests/run-ifs-tests Chet Ramey
tests/run-input-test Chet Ramey
tests/run-minus-e Chet Ramey
tests/run-new-exp Chet Ramey
tests/run-precedence Chet Ramey
tests/run-set-e-test Chet Ramey
tests/run-strip Chet Ramey
tests/run-varenv Chet Ramey
tests/set-e-test Chet Ramey
tests/set-e.right Chet Ramey
tests/strip.tests Chet Ramey
tests/strip.right Chet Ramey
tests/tilde-tests Chet Ramey
tests/tilde.right Chet Ramey
tests/unicode1.sub Chet Ramey, John Kearney
tests/varenv.right Chet Ramey
tests/varenv.sh Chet Ramey
tests/misc/chld-trap.sh Chet Ramey
tests/misc/dot-test-1.sh Chet Ramey
tests/misc/dot-test-1.sub Chet Ramey
tests/misc/gotest Chet Ramey
tests/misc/perf-script Chet Ramey
tests/misc/redir.t1.sh Chet Ramey
tests/misc/redir.t2.sh Chet Ramey
tests/misc/redir.t3.sh Chet Ramey
tests/misc/redir.t3.sub Chet Ramey
tests/misc/redir.t4.sh Chet Ramey
tests/misc/run.r1.sh Chet Ramey
tests/misc/run.r2.sh Chet Ramey
tests/misc/run.r3.sh Chet Ramey
tests/misc/sigint.t1.sh Chet Ramey
tests/misc/sigint.t2.sh Chet Ramey
tests/misc/sigint.t3.sh Chet Ramey
tests/misc/sigint.t4.sh Chet Ramey
tests/misc/test-minus-e.1 Chet Ramey
tests/misc/test-minus-e.2 Chet Ramey
lib/sh/Makefile.in Chet Ramey
lib/sh/clktck.c Chet Ramey
lib/sh/clock.c Chet Ramey
lib/sh/fmtullong.c Chet Ramey
lib/sh/fmtulong.c Chet Ramey
lib/sh/getcwd.c Chet Ramey, Roland McGrath
lib/sh/getenv.c Chet Ramey, Brian Fox
lib/sh/inet_aton.c Chet Ramey, Ulrich Drepper, Paul Vixie
lib/sh/itos.c Chet Ramey
lib/sh/mailstat.c Chet Ramey
lib/sh/makepath.c Chet Ramey
lib/sh/mktime.c Chet Ramey, Paul Eggert
lib/sh/netconn.c Chet Ramey
lib/sh/netopen.c Chet Ramey
lib/sh/oslib.c Chet Ramey, Brian Fox
lib/sh/pathcanon.c Chet Ramey
lib/sh/pathphys.c Chet Ramey
lib/sh/rename.c Chet Ramey
lib/sh/setlinebuf.c Chet Ramey, Brian Fox
lib/sh/shquote.c Chet Ramey
lib/sh/shtty.c Chet Ramey
lib/sh/snprintf.c Chet Ramey, Unknown
lib/sh/spell.c Chet Ramey
lib/sh/strcasecmp.c Chet Ramey, Brian Fox
lib/sh/strerror.c Chet Ramey, Brian Fox
lib/sh/strftime.c Arnold Robbins
lib/sh/strindex.c Chet Ramey
lib/sh/stringlist.c Chet Ramey
lib/sh/stringvec.c Chet Ramey
lib/sh/strpbrk.c Roland McGrath
lib/sh/strtod.c Chet Ramey, Roland McGrath
lib/sh/strtoimax.c Chet Ramey, Paul Eggert
lib/sh/strtol.c Chet Ramey, Paul Eggert
lib/sh/strtoll.c Chet Ramey, Paul Eggert
lib/sh/strtoul.c Chet Ramey, Paul Eggert
lib/sh/strtoull.c Chet Ramey, Paul Eggert
lib/sh/strtoumax.c Chet Ramey, Paul Eggert
lib/sh/strtrans.c Chet Ramey
lib/sh/times.c Chet Ramey, Brian Fox
lib/sh/timeval.c Chet Ramey
lib/sh/tmpfile.c Chet Ramey
lib/sh/vprint.c Chet Ramey, Brian Fox
lib/sh/xstrchr.c Chet Ramey, Mitsuru Chinen
lib/sh/zread.c Chet Ramey
lib/sh/zwrite.c Chet Ramey
tests/posix-ifs.sh Glenn Fowler
support/checkbashisms Julian Gilbey, Debian Linux team
lib/readline/colors.c Richard Stallman, David MacKenzie
lib/readline/parse-colors.c Richard Stallman, David MacKenzie
+11495
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+815
View File
@@ -0,0 +1,815 @@
This document details the changes between this version, bash-5.0-release, and
the previous version, bash-5.0-rc1.
1. Changes to Bash
a. Tilde expansion isn't performed on indexed array subscripts, even for
backwards compatibility.
b. The shell doesn't exit in posix mode if the eval builtin gets a parse
error when run by the command builtin.
c. Fixed a bug that caused a shell comment in an alias to not find the end
of the alias properly.
d. Reverted a change from April, 2018 that caused strings containing
backslashes to be flagged as glob patterns.
2. Changes to Readline
3. New Features in Bash
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.0-rc1, and
the previous version, bash-5.0-beta2.
1. Changes to Bash
a. Fix to initial word completion detection code.
b. Fixed a bug that caused issues with assignment statements containing ^A in
the value assigned when IFS contains ^A.
c. Added a fallback to fnmatch() when strcoll can't correctly deal with
bracket expression character equivalence classes.
d. Fixed a bug that caused $BASH_COMMAND to contain the trap handler command
when running a trap handler containing [[ or (( commands.
e. Fixed a bug that caused nameref assignments in the temporary environment
to potentially create variables with invalid names.
f. Fixed a bug that caused `local -' to turn off alias expansion in scripts.
g. Fixed a parser issue with a command string containing EOF after an invalid
command as an argument to a special builtin not causing a posix-mode shell
to exit.
h. Made a slight change to the FNV-1 string hash algorithm used for associative
arrays (corrected the initial seed).
2. Changes to Readline
3. New Features in Bash
a. The `select' command now supports command forms without a word list
following `in'.
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.0-beta2, and
the previous version, bash-5.0-beta.
1. Changes to Bash
a. Fixed a bug that could cause a seg fault while parsing a subshell command
inside a command substitution.
b. Fixed several small memory leaks uncovered by coverity.
c. Fixed a problem with command substitution inside an interactive shell that
could cause the parent to receive a SIGHUP.
d. Fixed a problem with using `*' and `@' as subscripts when assigning values
to an associative array with assoc_expand_once enabled.
e. Fixed a bug that could cause a huge memory allocation when completing a
word beginning with an invalid tilde expansion.
f. Cleaned up some incompatiblities with bash-4.4 when expanding indexed array
subscripts used in arithmetic expansions when assoc_expand_once is enabled.
g. The ${parameter@a} expansion will display attributes even if `parameter' is
unset.
h. Fixed a bug that caused the output of `set' to cut off some variables before
printing the value.
i. Treat a failure to assign a variable when using the ${x:=value} expansion
as an expansion error, so non-interactive posix-mode shells exit
j. Fixed a problem when expanding $* in a context where word splitting is not
performed when IFS is NULL.
k. Temp files used to store here documents are forced readable, no matter what
the user's umask says.
l. Fixed a problem where an interrupted brace expansion could cause the shell
to attempt to free an invalid memory location.
m. Make sure to check for any terminating signals after running a trap
handler; don't wait until the next time we process traps.
n. Fixed a bug that caused "return" to act like a special builtin with respect
to variable assignments even when preceded by "command".
o. POSIX-mode shells now return failure if the cd builtin fails due to the
absolute directory name being longer than PATH_MAX, instead of trying
again with a relative pathname.
p. Fixed a problem with FUNCNAME occasionally being visible when not executing
a shell function.
q. Fixed a problem with the expansions performed on the WORD in the case
command.
r. Fixed a slight POSIX compatibility when removing "IFS whitespace" during
word splitting and the read builtin.
s. Fixed a problem with expanding an array with subscript `*' when all the
elements expand to the empty string, and making sure the expansion honors
the `:' specifier.
2. Changes to Readline
a. Fixed a bug with adding multibyte characters to an incremental search string.
b. Fixed a bug with redoing text insertions in vi mode.
c. Fixed a bug with pasting text into an incremental search string if bracketed
paste mode is enabled. ESC cannot be one of the incremental search
terminator characters for this to work.
d. Fixed a bug with anchored search patterns when performing searches in vi
mode.
3. New Features in Bash
a. Associative and indexed arrays now allow subscripts consisting solely of
whitespace.
b. `checkwinsize' is now enabled by default.
c. The `localvar_unset' shopt option is now visible and documented.
d. The `progcomp_alias' shopt option is now visible and documented.
e. The signal name processing code now understands `SIGRTMIN+n' all the way
up to SIGRTMAX.
f. There is a new `seq' loadable builtin.
g. Trap execution now honors the (internal) max invocations of `eval', since
traps are supposed to be executed as if using `eval'.
h. The $_ variable doesn't change when the shell executes a command that forks.
i. The `kill' builtin now supports -sSIGNAME and -nSIGNUM, even though
conforming applications aren't supposed to use them.
j. POSIX mode now enables the `shift_verbose' option.
4. New Features in Readline
a. Readline now allows application-defined keymap names; there is a new public
function, rl_set_keymap_name(), to do that.
b. The "Insert" keypad key, if available, now puts readline into overwrite
mode.
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.0-beta, and
the previous version, bash-5.0-alpha.
1. Changes to Bash
a. Fixed a bug that allowed subshells to "inherit" enclosing loops -- this
is where POSIX says the subshell is not "enclosed" by the loop.
b. Added more UTF-8-specific versions of multibyte functions, and optimized
existing functions if the current locale uses UTF-8 encoding.
c. In POSIX mode, assignments preceding regular builtins should not persist
when the builtin completes.
d. Added additional checks to special array assignment (e.g., BASH_ALIASES)
so it can't be used to bypass validity checks performed in other places.
e. The `!!' history expansion now refers to the previous history entry as
expected, even if used on the second or subsequent line of a multi-line
history entry.
f. Fixed a bug that could cause the shell to dereference a NULL pointer if
the environment (`environ') is set to NULL.
g. Bash uses slightly better integer overflow handling for brace sequence
expansion on systems where ints are 32 bits and intmax_t is 64 bits.
h. Fixed a bug setting attributes for a variable named as an argument to
`declare' that also appears as a nameref in the temporary environment.
i. Fixed several bugs that could cause assignments to namerefs to create
variables with invalid names.
j. Fixed a bug that could result in the SIGINT handler being set incorrectly
in asynchronous subshells.
k. Fixed a bug that could cause `bash -t' to not execute the specified command.
l. Fixed several bugs that caused the shell to operate on the wrong variable
when using namerefs with the same name as a global variable in shell
functions.
m. Internal changes to how the shell handles variables with invalid names in
the initial environment and to prevent variables with invalid names from
being added to the environment instead of passing them on to children.
n. Changes to make sure that an expansion that results in a quoted null string
is reflected in the expansion, even if the word expands to nothing.
o. Changes to make sure that $* and ${array[*]} (and $@/${array[@]}) expand
the same way after the recent changes for POSIX interpretation 888.
p. Saving and restoring the positional parameters at function entry and exit
is considerably more efficient; noticeably so when there are large numbers
of positional parameters.
q. Fixed a bug that caused `lastpipe' and `pipefail' to return an incorrect
status for the pipeline if there was more than one external command in a
loop body appearing in the last pipeline element.
r. Fixed a bug that caused value conversion errors with the printf builtin's
%u and %f conversion specifications and invalid constants.
2. Changes to Readline
a. Added more UTF-8-specific versions of multibyte functions, and optimized
existing functions if the current locale uses UTF-8 encoding.
b. Fixed a problem with bracketed-paste inserting more than one character and
interacting with other readline functions.
c. Fixed a bug that caused the history library to attempt to append a history
line to a non-existent history entry.
d. If using bracketed paste mode, output a newline after the \r that is the
last character of the mode disable string to avoid overwriting output.
e. Fixes to the vi-mode `b', `B', `w', `W', `e', and `E' commands to better
handle multibyte characters.
f. Fixed a redisplay problem that caused an extra newline to be generated on
accept-line when the line length is exactly the screenwidth.
3. New Features in Bash
a. Bash no longer allows variable assignments preceding a special builtin that
changes variable attributes to propagate back to the calling environment
unless the compatibility level is 44 or lower.
b. You can set the default value for $HISTSIZE at build time in config-top.h.
c. The `complete' builtin now accepts a -I option that applies the completion
to the initial word on the line.
d. The internal bash malloc now uses mmap (if available) to satisfy requests
greater than 128K bytes, so free can use mfree to return the pages to the
kernel.
e. The shell doesn't automatically set BASH_ARGC and BASH_ARGV at startup
unless it's in debugging mode, as the documentation has always said, but
will dynamically create them if a script references them at the top level
without having enabled debugging mode.
f. The localvar_inherit option will not attempt to inherit a value from a
variable of an incompatible type (indexed vs. associative arrays, for
example).
g. The `globasciiranges' option is now enabled by default; it can be set to
off by default at configuration time.
4. New Features in Readline
a. The history expansion library now understands command and process
substitution and extended globbing and allows them to appear anywhere in a
word.
b. The history library has a new variable that allows applications to set the
initial quoting state, so quoting state can be inherited from a previous
line.
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.0-alpha, and
the previous version, bash-4.4-release.
1. Changes to Bash
a. Fixed a bug that could cause traps in background jobs to give the terminal
to the wrong process group.
b. Fixed a bug that caused `kill -l 0' to print an out-of-range error.
c. Fixed a problem that could result in here-documents being displayed in
the wrong order.
d. Fixed a number of out-of-bounds and free memory read errors found via
fuzzing.
e. Fixed a subshell inheritance problem that could cause a subshell to wait for
the wrong process.
f. Fixed a bug that caused SHLVL to be incremented one too many times when
creating subshells.
g. A job dying due to SIGINT can now interrupt sourcing a file in a shell with
job control enabled.
h. Fixed a spurious warning about unterminated ${ or $( constructs during
word completion.
i. The shell no longer runs traps if a signal arrives while reading command
substitution output.
j. Fixed an arithmetic expansion error that could allow ++var++ as valid
syntax.
k. Fixed an error that allowed out-of-bounds references to the directory stack.
l. The shell does a better job of saving multi-line history entries with
embedded comments.
m. Fixed a bug that could cause quoted bracket expressions in regular expression
arguments to `[[' to not match correctly.
n. Fixed a bug that could cause an IFS character in a word to result in an
extra '\001' character in the expansion.
o. A trailing backslash in a glob pattern can match a trailing backslash in the
string.
p. Fixed a memory leak in the process creation code path when job control is
enabled.
q. Fixed a bug that caused `printf' to output broken surrogate pairs for
Japanese locales.
r. Fixed a bug that caused a SIGINT generated from `kill' in a dot script to
kill an interactive shell.
s. Fixed a bug that could cause the `read' builtin to not fully read a
multibyte character.
t. Fixed a bug that could cause identifiers to be evaluated in conditional
arithmetic expressions even when evaluation is suppressed.
u. Fixed a bug that could result in command substitution, when executed in a
context where word splitting is not performed, to leave a stray '\001'
character in the string.
v. Fixed a bug that could cause history expansion to be disabled in a non-
interactive shell even if `-o histexpand' is supplied at startup.
w. Fixed a bug that caused `read -N' to strip leading whitespace IFS characters.
x. Fixed a bug that caused spurious tilde expansion in arithmetic expressions.
y. If indirect expansion attempts to indirectly reference through an unset
variable, report an error.
z. Added a guard to prevent the shell from looping while receiving an endless
stream of SIGTTIN at shell startup.
aa. Fixed a bug with parsing here documents inside a command substitution when
looking for the closing delimiter.
bb. Fixed a bug that caused printf to not quote all <blank> characters in the
current locale when using the `%q' format specifier.
cc. Fixed a bug with bash's internal buffered I/O system that caused the input
pointer to not be reset when read(2) returned an EOF.
dd. Bash now installs its SIGWINCH signal handler with SA_RESTART, so it will
not interrupt open/read/write system calls.
ee. The ERR trap now reports line numbers more reliably.
ff. The shell no longer tries to manipulate the terminal process group if a
command or process substitution is killed by SIGTERM when job control is
enabled.
gg. Fixed a bug that caused extglob patterns to match filenames beginning with
a period.
hh. File descriptors open for writing to here documents are no longer available
to subshells.
ii. Make sure word completion doesn't perform command or process substitution.
jj. Fixed a bug with parsing $$'...' inside a command substitution.
kk. Fixed a bug that caused bash to remove backslash-newline pairs from the
body of a here-document with a quoted delimiter inside a command
substitution.
ll. Fixed a bug that could cause the shell to hang when adding a pid to the
table of background process exit statuses.
mm. Fixed a bug that could cause 0x01 characters to be doubled in the output
of process substitution.
nn. Restricted shells now clear the hash table before making the PATH variable
read-only.
oo. There are a number of changes to the expansion of $* and $@ in contexts
where word splitting does not occur (quoted and unquoted), with IFS set
to NULL or a non-standard value, mostly to deal with the consequences of
the behavior defined in Posix interpretation 888.
pp. There are a number of changes to nameref variable handling to avoid
creating variables with invalid names.
qq. A non-interactive posix mode shell no longer exits when an assignment
statement fails if the assignment is utimately being performed by the
`command' builtin.
rr. When using character class names for globbing, don't allow case
insensitivity, even if nocaseglob is enabled.
ss. Fixed a bug that allowed some redirections to stay in place if a later
redirection failed.
tt. Fixed a bug in how command and process substitutions are recognized within
other parameter expansions.
uu. Fixed a bug that caused bash to loop under certain circumstances when
performing arithmetic expansion on a variable whose value is an invalid
expression.
vv. Fixed a bug that could cause bash to expand aliases inappropriately while
parsing compound commands like `case'.
ww. Fixed a bug that could cause `read -N' to fail to read complete multibyte
characters, even when the sequences are incomplete or invalid, with or
without readline.
xx. Fixed a bug that could cause `case' to fail to match patterns containing
0x01 characters.
yy. Fixed a bug that caused exported functions to contain stray 0x01 characters.
zz. Fixed some inconsistencies with how the history number is handled in the
various prompt strings.
aaa. Fixed a bug that could cause a core dump if READLINE_LINE was unset
inside a shell function bound to a key sequence with `bind -x'.
bbb. Fixed a bug that could cause bash to not read a token terminator correctly
if a command substitution was used inside an arithmetic `for' command.
ccc. Fixed problems that could occur with a fatal arithmetic expansion error
in a context (like prompt expansion) where you can't jump back to the
top level.
ddd. Expression errors in arithmetic `for' commands are treated more like
shell syntax errors.
eee. Fixed a parser synchronization error resulting from a syntax error
followed immediately by an EOF.
fff. When executing a shell function, the first line in the function ($LINENO)
is line 1 instead of line 0, as Posix requires.
ggg. In Posix mode, bash will canonicalize the value of PWD it inherits from
the environment and use that to set its idea of the current directory.
hhh. If LINENO is exported, bash needs to regenerate its value each time it
constructs the environment.
iii. Fixed a bug with restoring the SIGINT handler when using `wait -n'.
jjj. Make sure the `coproc' command returns an appropriate status if the NAME
argument is invalid.
kkk. Fixed a problem with arithmetic expressions containing array references
that contain arithmetic expressions with syntax errors.
lll. The `select' command and help builtin will use $COLUMNS before the window
size returned from the kernel as the terminal width.
mmm. `read -n 0' and `read -N 0' now try a zero-length read in an attempt to
detect file descriptor errors.
nnn. The `read' builtin now does a better job of acting on signals that don't
interrupt read(2).
ooo. Fixed some cases where `printf -v' did not return failure status on a
variable assignment error.
ppp. Fixed temporary environment propagation back to the current environment
so that it doesn't happen for special builtins run by the `command'
builtin.
qqq. Fixed a bug when searching for the end of a here-document delimiter in a
command substitution.
rrr. Fixed a bug that could cause `cd ${DIRSTACK[0]}' to fail.
sss. Fixed a bug that could cause reserved words to not be recognized in a
for statement without the `in' inside a command substitution.
ttt. Fixed a bug that could cause a double-free in a timed command with an
expansion error.
uuu. Fixed a bug that could cause a core dump if a script switches from a UTF-8
locale to a different locale after displaying a lone surrogate character.
vvv. Fixed cases where bash prematurely removed FIFOs attached to process
substitutions.
www. Fixed a problem with calculating the size of the table that stores exit
statuses from background processes when the child process resource limit
is very large.
xxx. Fixed a memory leak with functions using `return' when using FIFOs for
standard input.
yyy. `wait' without arguments attempts to wait for all active process
substitution processes.
zzz. Fixed a bug where an indirect parameter was subjected to word splitting
when trying to find the indirected variable name.
aaaa. Fixed a bug that could allow restricted shell users to add commands to
the hash table.
bbbb. When using the `!(patlist)' extended globbing operator, a filename
beginning with a `.' that doesn't match any of the patterns is not
returned as a match if leading dots must be matched explicitly.
cccc. Fixed a bug that could cause line number and source file information for
a function definition to be incorrect if there are multiple definitions.
dddd. Fixed a bug that could cause builtins like `readonly' to behave
differently when applied to arrays and scalar variables within functions.
eeee. Fixed a bug that could cause alias expansion to add an extra space to
a quoted string that begins outside the alias expansion.
ffff. Fixed a bug that could result in unwanted alias expansion after timing
the null command.
gggg. Fixed a bug that could cause a core dump if a timestamp in a history
file overflowed a time_t.
hhhh. Restricted shells can no longer redirect from /dev/tcp or /dev/udp, since
the kernel calls make those file descriptors read-write.
iiii. Fixed a problem with splitting double-quoted words for programmable
completion when the double quote immediately follows another word
delimiter.
jjjj. Fixed a bug resulting in a use-after-free if two file descriptors share
the same input buffer.
kkkk. The error message resulting from ${x:?} and ${x?} now differs depending
on whether the variable is null or unset.
llll. In Posix mode, the shell exits if a variable assignment fails and precedes
an empty simple command (after expansion).
mmmm. Fixed a timing problem with SIGALRM that could cause the read builtin to
drop characters.
nnnn. Added code to deal with kill(2) failing to send the shell a fatal signal
due to Linux pid namespace peculiarities.
oooo. Fixed a bug that made \C-@ (NUL) unusable in key sequences used for
`bind -x' commands.
pppp. Fixed a bug that could cause SIGINT recursion when running an external
command in a trap the shell takes after a command exits due to SIGINT.
qqqq. Make sure the shell turns off job control before running the command-
not-found handle, so the command doesn't try to manipulate process
groups.
rrrr. Fixed a problem with timing process substitutions that caused the shell
to print timing information for the calling command.
ssss. Fixed a bug that caused backquotes in a here-document delimiter to mark
the delimiter as quoted (inhibiting expansion of the here-document
contents).
tttt. Fixed several problems with 0x01 and 0x177 in case pattern lists and
conditional command pattern matches.
uuuu. Fixed a bug that could cause the pattern matching engine to not recognize
locale-specific character classes.
vvvv. The auto-configuration now tests for /dev/stdin and /dev/fd independently.
wwww. The `globstar' code now skips over symbolic links to directories,
preventing them from being scanned twice.
xxxx. When running `bind -x' commands, bash now sets READLINE_POINT based on
the number of characters in the readline line buffer, not the number of
bytes.
yyyy. Fixed a problem that could cause recursive trap evaluation of the RETURN
trap when using `eval return'.
zzzz. Fixed a bug with expanding 0x01 in an unquoted here-document.
aaaaa. The process substitution code now closes and unlinks FIFOs when the
process on the other side exits, in order to prevent SIGPIPE or
waiting until a FIFO opened for read has a writer.
bbbbb. Fixed a bug with recursive calls to the parser overwriting the token in
an {id}>foo construct.
ccccc. After a Posix discussion, the pattern matching engine just skips over
invalid character classes in bracket expressions, instead of matching
them like individual characters in the expression.
ddddd. Fixed a posix-mode problem with variable scoping when creating variables
from assignment statements preceding special builtins.
eeeee. Fixed a bug that could cause patterns containing backslashes to not be
run through the pattern matching engine.
fffff. Fixed a bug that could cause redirections to compound commands to not
be `undone' if the file descriptor in the redirection was closed when
the redirection was initially processed.
ggggg. Fixed a bug that could cause buffer corruption when using `bind -x' in
a command execute as a result of a key binding installed by `bind -x'.
2. Changes to Readline
a. Added a guard to prevent nested macros from causing an infinite expansion
loop.
b. Instead of allocating enough history list entries to hold the maximum list
size, cap the number allocated initially.
c. Added a strategy to avoid allocating huge amounts of memory if a block of
history entries without timestamps occurs after a block with timestamps.
d. Added support for keyboard timeouts when an ESC character is the last
character in a macro.
e. There are several performance improvements when in a UTF-8 locale.
f. Readline does a better job of preserving the original set of blocked
signals when using pselect() to wait for input.
g. Fixed a bug that caused multibyte characters in macros to be mishandled.
h. Fixed several bugs in the code that calculates line breaks when expanding
prompts that span several lines, contain multibyte characters, and contain
invisible character seqeuences.
i. Fixed several bugs in cursor positioning when displaying lines with prompts
containing invisible characters and multibyte characters.
j. When performing case-insensitive completion, Readline no longer sorts the
list of matches unless directed to do so.
k. Fixed a problem with key sequences ending with a backslash.
l. Fixed out-of-bounds and free memory read errors found via fuzzing.
m. Fixed several cases where the mark was set to an invalid value.
n. Fixed a problem with the case-changing operators in the case where the
lower and upper case versions of a character do not have the same number
of bytes.
o. Handle incremental and non-incremental search character reads returning EOF.
p. Handle the case where a failing readline command at the end of a multi-key
sequence could be misinterpreted.
q. The history library now prints a meaningful error message if the history
file isn't a regular file.
r. Fixed a problem with vi-mode redo (`.') on a command when trying to replace
a multibyte character.
s. The key binding code now attempts to remove a keymap if a key unbinding
leaves it empty.
t. Fixed a line-wrapping issue that caused problems for some terminal
emulators.
u. If there is a key bound to the tty's VDISCARD special character, readline
disables VDISCARD while it is active.
v. Fixed a problem with exiting bracketed paste mode on terminals that assume
the bracketed paste mode character sequence contains visible characters.
w. Fixed a bug that could cause a key binding command to refer to an
uninitialized variable.
3. New Features in Bash
a. The `wait' builtin can now wait for the last process substitution created.
b. There is an EPOCHSECONDS variable, which expands to the time in seconds
since the Unix epoch.
c. There is an EPOCHREALTIME variable, which expands to the time in seconds
since the Unix epoch with microsecond granularity.
d. New loadable builtins: rm, stat, fdflags.
e. BASH_ARGV0: a new variable that expands to $0 and sets $0 on assignment.
f. When supplied a numeric argument, the shell-expand-line bindable readline
command does not perform quote removal and suppresses command and process
substitution.
g. `history -d' understands negative arguments: negative arguments offset from
the end of the history list.
h. The `name' argument to the `coproc' reserved word now undergoes word
expansion, so unique coprocs can be created in loops.
i. A nameref name resolution loop in a function now resolves to a variable by
that name in the global scope.
j. The `wait' builtin now has a `-f' option, which signfies to wait until the
specified job or process terminates, instead of waiting until it changes
state.
k. There is a define in config-top.h that allows the shell to use a static
value for $PATH, overriding whatever is in the environment at startup, for
use by the restricted shell.
l. Process substitution does not inherit the `v' option, like command
substitution.
m. If a non-interactive shell with job control enabled detects that a foreground
job died due to SIGINT, it acts as if it received the SIGINT.
n. The SIGCHLD trap is run once for each exiting child process even if job
control is not enabled when the shell is in Posix mode.
o. A new shopt option: localvar_inherit; if set, a local variable inherits the
value of a variable with the same name at the nearest preceding scope.
p. `bind -r' now checks whether a key sequence is bound before binding it to
NULL, to avoid creating keymaps for a multi-key sequence.
q. A numeric argument to the line editing `operate-and-get-next' command
specifies which history entry to use.
r. The positional parameters are now assigned before running the shell startup
files, so startup files can use $@.
s. There is a compile-time option that forces the shell to disable the check
for an inherited OLDPWD being a directory.
t. The `history' builtin can now delete ranges of history entries using
`-d start-end'.
u. The `vi-edit-and-execute-command' bindable readline command now puts readline
back in vi insertion mode after executing commands from the edited file.
v. The command completion code now matches aliases and shell function names
case-insensitively if the readline completion-ignore-case variable is set.
w. There is a new `assoc_expand_once' shell option that attempts to expand
associative array subscripts only once.
x. The shell only sets up BASH_ARGV and BASH_ARGC at startup if extended
debugging mode is active. The old behavior of unconditionally setting them
is available as part of the shell compatibility options.
y. The `umask' builtin now allows modes and masks greater than octal 777.
z. The `times' builtin now honors the current locale when printing a decimal
point.
aa. There is a new (disabled by default, undocumented) shell option to enable
and disable sending history to syslog at runtime.
4. New Features in Readline
a. Non-incremental vi-mode search (`N', `n') can search for a shell pattern, as
Posix specifies (uses fnmatch(3) if available).
b. There are new `next-screen-line' and `previous-screen-line' bindable
commands, which move the cursor to the same column in the next, or previous,
physical line, respectively.
c. There are default key bindings for control-arrow-key key combinations.
d. A negative argument (-N) to `quoted-insert' means to insert the next N
characters using quoted-insert.
e. New public function: rl_check_signals(), which allows applications to
respond to signals that readline catches while waiting for input using
a custom read function.
f. There is new support for conditionally testing the readline version in an
inputrc file, with a full set of arithmetic comparison operators available.
g. There is a simple variable comparison facility available for use within an
inputrc file. Allowable operators are equality and inequality; string
variables may be compared to a value; boolean variables must be compared to
either `on' or `off'; variable names are separated from the operator by
whitespace.
+628
View File
@@ -0,0 +1,628 @@
This document details the changes between this version, bash-5.1-rc3, and
the previous version, bash-5.1-rc2.
1. Changes to Bash
a. The `assoc_expand_once' option now affects the evaluation of the -v primary
to test and the [[ compound command.
2. Changes to Readline
a. Fixed a bug that could cause point to be set beyond the end of the line
buffer when aborting an incremental search.
3. New Features in Bash
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.1-rc2, and
the previous version, bash-5.1-rc1.
1. Changes to Bash
a. Process substitutions started from an interactive shell no longer have their
standard input implicitly redirected from /dev/null.
b. Fixed an issue with setting the SIGINT trap handler in an interactive shell
when temporarily running $PROMPT_COMMAND non-interactively.
2. Changes to Readline
a. Terminals that are named "dumb" or unknown do not enable bracketed paste
by default.
b. Ensure that disabling bracketed paste turns off highlighting the incremental
search string when the search is successful.
3. New Features in Bash
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.1-rc1, and
the previous version, bash-5.1-beta.
1. Changes to Bash
a. Fixed an inconsistency in the way HISTCMD is calculated when it's expanded
during a multi-line command.
b. Modified the change to here-document expansion containing backslash-quoted
double quotes.
c. Fixed a case where the shells's exit status could be greater than 255.
d. Modified changed to process substitution so the executed command has its
stdin redirected from /dev/null if it was previously interactive and
reading commands from the terminal.
2. New Features in Bash
a. There is a new contributed loadable builtin: asort.
3. Changes to Readline
a. Fixed a bug that could cause an application with an application-specific
redisplay function to crash if the line data structures had not been
initialized.
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.1-beta, and
the previous version, bash-5.1-alpha.
1. Changes to Bash
a. Fixed a bug that caused name references to variables to not update the
referenced variable's assignment side effects.
b. Tightened up the parameter transformation error checking for invalid
transformation operators.
c. System-specific changes for: FreeBSD
d. A few minor changes to move potential uses of stdio functions out of signal
handling paths.
e. Make sure SIGCHLD is blocked in all cases where waitchld() is not called
from a signal handler.
f. Changed `command' builtin processing so it no longer starts an extra process
when run asynchronously (command x &).
g. Avoid performing tilde expansion after `:' in words that look like assignment
statements when in posix mode.
h. Slight changes to how the `complete' builtin prints out options and actions
for completion specifications.
i. Several changes to how `local -' restores the values of options and
$SHELLOPTS.
j. Don't treat a word in a compound assignment as an assignment statement
unless it has a valid subscript before the `='.
k. Fixed a bug with the DEBUG trap and process substitution that caused the
terminal's process group to be set incorrectly.
l. Fixed a bug that left readline's signal handlers installed while running a
shell command from a bindable readline command.
m. Fixed the `fc' builtin to clamp out of range history specifications at the
boundaries of the history list for POSIX conformance.
n. Fixed a bug that caused ${foo@a} to treat foo as an unset variable if it
was an array without a value for subscript 0/"0" but had other set
elements.
o. Fixed a bug that caused the history code to attempt to parse command
substitutions looking for shell comments before adding them to the history,
even while parsing here-documents.
p. Fixed a bug that could cause a syntax error in a command read by `eval' to
exit an interactive shell.
2. New Features in Bash
a. If the hash builtin is listing hashed filenames portably, don't print
anything if the table is empty.
b. GLOBIGNORE now ignores `.' and `..' as a terminal pathname component.
c. Bash attempts to optimize away forks in the last command in a function body
under appropriate circumstances.
d. The globbing code now uses fnmatch(3) to check collation elements (if
available) even in cases without multibyte characters.
e. The `fg' and `bg' builtins now return an error in a command substitution
when asked to restart a job inherited from the parent shell.
f. The shell now attempts to unlink all FIFOs on exit, whether a consuming
process has finished with them or not.
3. Changes to Readline
a. Make sure that all undo groups are closed when leaving vi insertion mode.
b. Make sure that the vi-mode `C' and `c' commands enter insert mode even if
the motion command doesn't have any effect.
c. Fixed several potential memory leaks in the callback mode context handling.
d. If readline is handling a SIGTTOU, make sure SIGTTOU is blocked while
executing the terminal cleanup code, since it's no longer run in a signal
handling context.
4. New Features in Readline
a. The signal cleanup code now blocks SIGINT while processing after a SIGINT.
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.1-alpha, and
the previous version, bash-5.0-release.
1. Changes to Bash
a. Fixed a bug that caused a posix-mode shell to not exit if the return builtin
was executed outside a function or dot script.
b. Fixed a bug where `declare +f' could potentially turn off the function
attribute.
c. Restored bash-4.4 pathname expansion behavior when a word to be expanded had
only backslashes, not any of the other globbing characters. This came after
an extensive POSIX group discussion (interp #1234).
d. There are more changes to avoid performing word expansions multiple times on
arithmetic expressions.
e. Fixed a bug with alias expansion when the alias ends with a TAB.
f. Fixed a bug that caused programmable completion to return an error if the
shell function name supplied as an argument to `complete -F' was invalid.
g. There are several fixes to buffer overflows found as the result of fuzzing
with random input.
h. Fixed a bug that caused the edit-and-execute-command editing command to
start with the previous history line if invoked on an empty line.
i. Fixed a bug that potentially caused `bind --help' to change readline's
output stream.
j. Turning off posix mode now restores the vi-insertion mode binding for TAB
that was in effect when posix mode was enabled.
k. Restore the previous state of job control being enabled if `exec' fails in
an interactive shell.
l. Fixed a bug that caused the terminal's process group to be set incorrectly
if job control was turned off before starting an interactive shell.
m. Fixed a bug that caused a crash when HISTSIZE=0.
n. Fixed a word expansion bug that caused null strings on the rhs of expansions
to be discarded incorrectly.
o. History list management does a better job of handling the situation where
the number of history entries from the current shell session is greater than
the number of entries in the history list.
p. Fixed a bug that caused the `fc' builtin to attempt to dereference a newly-
freed history entry.
q. Fixed a bug that made the `Q' variable transformation not work well with
`set -u'.
r. There are several word expansion fixes for expanding $* and $@ in contexts
where word splitting is not going to be performed, since each positional
parameter must expand to a separate word.
s. Fixed a bug that could cause ^D to exit bash immediately even if there were
stopped jobs.
t. Fixed a bug with double-quoting and backslash-quoting strings containing
multibyte characters for reuse.
u. Fixed a bug that caused the line number to be reported incorrectly if the
shell executed a (command) subshell.
v. Fixed a bug that caused the shell to fail to reap process substitutions
when they went out of scope, which had unpredictable results.
w. Fixed a bug that caused null strings in arguments to [[ conditional command
operators to compare incorrectly.
x. Changed the behavior of `wait' without arguments to only wait for background
processes the current shell instance started, not background children it may
have inherited.
y. Fixed a bug that could cause command substitution to leave file descriptors
open if the shell received many SIGINTs.
z. Bash now behaves better if the `**' filename expansion operator encounters a
symbolic link to a directory, avoiding more cases where it might return
duplicate pathnames.
aa. Programmable completion now canonicalizes directory names in the same way
as bash word completion, so `..' is handled consistently.
bb. Fixed a bug when using RETURN as the delimiter to the read builtin; it
caused readline to set the binding for RETURN incorrectly.
cc. Fixed a bug that caused `history -d' to delay printing an out-of-range
error message.
dd. Fixed a bug with `bash -c command' where `command' ends with an expanded
alias.
ee. Fixed a bug that could result in `history -n' adding spurious line feeds to
commands in the history list.
ff. The $RANDOM random number generator now XORs the top and bottom halves of
the internal 32-bit value to introduce more randomness. Setting the shell
compatibility level to 50 or lower undoes this.
gg. Fixed several problems caused by running the DEBUG trap on simple commands
executed as part of a pipeline.
ii. Fixed a bug that didn't allow `bind -r' to remove the binding for \C-@.
jj. Several fixes to the bash-backward-shellword bindable readline command to
behave better when at the last character on the line.
kk. If `set -x' is enabled, bash doesn't print a command twice if it's run by
the `command' builtin.
ll. Fixed a bug with printing function definitions containing here documents.
mm. Fixed a bug that could cause the `bind' builtin to set $? to -1.
nn. Fixed a bug that didn't reset the timezone information correctly when the
TZ variable was unset.
oo. Fixed several issues with assigning an associative array variable using a
compound assignment that expands the value of the same variable.
pp. Fixed several places where the shell set $? without setting PIPESTATUS.
qq. Fixed a problem with glob bracket expressions containing invalid character
classes, collating symbols, or equivalence classes -- they should not
require a closing right bracket.
rr. Fixed a bug where running a builtin in a subshell did not run the EXIT trap.
ss. Fixed several problems with posix-mode variable assignments preceding
shell function calls and posix special builtins, so that they create and
modify variables at the current scope.
tt. Fix history initialization so `bash +o history' works as expected.
uu. Fixed a bug in the bindable edit-and-execute-command command that could
interfere with the shell's parsing state.
vv. Fixed an issue with nested traps running command substitutions in command
lines with command substitutions.
ww. Fixed a bug with globbing pathnames that contain invalid multibyte
characters (sequences that don't correspond to a character in the current
locale).
xx. Fixed a bug that caused the shell not to exit if a function definition
failed while errexit was enabled.
yy. Process substitution processes now get their input from /dev/null, since
they are asynchronous, not interactive, and not jobs.
zz. Setting nocaseglob no longer turns on case-insensitive regexp matching.
aaa. Fixed a bug that resulted in extra blank lines being added to some history
entries containing here-documents.
bbb. Fixed a bug that resulted in incorrect matching of some patterns in word
expansion if they expanded to the empty string.
ccc. Fixed here-string expansion so it behaves the same as expansion of the
rhs of an assignment statement.
ddd. Changed here-document parsing to no longer allow the end of the here
document to delimit a command substitution.
eee. Several fixes to history expansion: multiple :p modifiers work, a ^ word
designator works as part of a range, and a `-' is treated as part of a
search string if it immediately follows a `!'.
fff. Fixed a bug in pattern substitution with null matches in a string
containing multibyte characters.
ggg. Unbinding a key sequence bound with `bind -x' now removes the key sequence
from the additional keymap `bind -x' uses.
hhh. Fixed a bug with command start detection for completion so that it doesn't
mistake brace expansion for the start of a command.
iii. Fixed a bug that caused local variables with the same name as variables
appearing in a function's temporary environment to not be marked as local.
jjj. Fixed a bug that could cause SIGCHLD to be blocked when executing return
or exec in the rightmost pipeline element with lastpipe enabled.
kkk. Fixed a bug that could result in commands without the execute bit set
being added to the command hash table.
lll. Fixed a bug that allowed non-digits to follow the `#' in a `base#number'
integer constant.
mmm. Fixed a bug that made `time -- command' attempt to execute `--'.
nnn. Fixed a couple of bugs with variable transformation using arrays
subscripted with `*' or `@'.
ooo. A failure to create a variable using `declare' in a function no longer
causes the function to return immediately.
ppp. Fixed a bug that could cause the := word expansion to add a non-null
value if attempting to assign a null string when double-quoted.
qqq. Fixed a bug that could cause backslashes quoting double quotes in here
document bodies to not be removed when expanding the body.
rrr. Fixed a bug that caused commands following a subshell while the shell is
reading input from stdin but not interactive, while job control is
enabled, to be executed twice.
sss. Fixed a bug where receiving SIGTERM from a different process while
readline was active could cause the shell to terminate.
ttt. In posix mode, running a trap after the read builtin now sees the exit
status of the read builtin (e.g., 130 after a SIGINT) in $?.
uuu. Fixed a bug with nameref variables referencing array subscripts used in
arithmetic expressions.
vvv. Fixed a bug that caused the pipeline process group id to be reset in the
middle of a command list run by a shell started to run a command
substitution.
www. Restricted shells can no longer read and write history files with pathnames
containing slashes.
xxx. Fixed a couple of problems with 0 and -0 used as arguments to `fc' when
not listing commands from the history.
yyy. When `test' is supplied four or more arguments, treat an argument that
looks like an operator (e.g., -e), but is in a place where only a string
is valid, as a string, as it would be when using the POSIX rules, instead
of an operator with a missing argument.
zzz. There is no `compat50' shopt option. Changes to the shell compatibility
level should use the BASH_COMPAT variable.
aaaa. Redirection failures with compound commands are now treated as errors
that cause the shell to exit if `errexit' is enabled.
bbbb. Redirection failure error messages no longer expand the word in the
redirection again.
cccc. History expansion is no longer performed while parsing a here-document
inside a command substitution.
2. Changes to Readline
a. There are a number of fixes that were found as the result of fuzzing with
random input.
b. Changed the revert-all-at-newline behavior to make sure to start at the end
of the history list when doing it, instead of the line where the user hit
return.
c. When parsing `set' commands from the inputrc file or an application, readline
now allows trailing whitespace.
d. Fixed a bug that left a file descriptor open to the history file if the
file size was 0.
e. Fixed a problem with binding key sequences containing meta characters.
f. Fixed a bug that caused the wrong line to be displayed if the user tried to
move back beyond the beginning of the history list, or forward past the end
of the history list.
g. If readline catches SIGTSTP, it now sets a hook that allows the calling
application to handle it if it desires.
h. Fixed a redisplay problem with a prompt string containing embedded newlines.
i. Fixed a problem with completing filenames containing invalid multibyte
sequences when case-insensitive comparisons are enabled.
j. Fixed a redisplay problem with prompt strings containing invisible multibyte
characters.
k. Fixed a problem with multibyte characters mapped to editing commands that
modify the search string in incremental search.
l. Fixed a bug with maintaining the key sequence while resolving a bound
command in the presence of ambiguous sequences (sequences with a common
prefix), in most cases while attempting to unbind it.
m. Fixed several buffer overflows found as the result of fuzzing.
n. Reworked backslash handling when translating key sequences for key binding
to be more uniform and consistent, which introduces a slight backwards
incompatibility.
o. Fixed a bug with saving the history that resulted in errors not being
propagated to the calling application when the history file is not writable.
p. Readline only calls chown(2) on a newly-written history file if it really
needs to, instead of having it be a no-op.
q. Readline now behaves better when operate-and-get-next is used when the
history list is `full': when there are already $HISTSIZE entries.
r. Fixed a bug that could cause vi redo (`.') of a replace command not to work
correctly in the C or POSIX locale.
3. New Features in Bash
a. `bind -x' now supports different bindings for different editing modes and
keymaps.
b. Bash attempts to optimize the number of times it forks when executing
commands in subshells and from `bash -c'.
c. Here documents and here strings now use pipes for the expanded document if
it's smaller than the pipe buffer size, reverting to temporary files if it's
larger.
d. There are new loadable builtins: mktemp, accept, mkfifo, csv, cut/lcut
e. In posix mode, `trap -p' now displays signals whose disposition is SIG_DFL
and those that were SIG_IGN when the shell starts.
f. The shell now expands the history number (e.g., in PS1) even if it is not
currently saving commands to the history list.
g. `read -e' may now be used with arbitrary file descriptors (`read -u N').
h. The `select' builtin now runs traps if its internal call to the read builtin
is interrupted by a signal.
i. SRANDOM: a new variable that expands to a 32-bit random number that is not
produced by an LCRNG, and uses getrandom/getentropy, falling back to
/dev/urandom or arc4random if available. There is a fallback generator if
none of these are available.
j. shell-transpose-words: a new bindable readline command that uses the same
definition of word as shell-forward-word, etc.
k. The shell now adds default bindings for shell-forward-word,
shell-backward-word, shell-transpose-words, and shell-kill-word.
l. Bash now allows ARGV0 appearing in the initial shell environment to set $0.
m. If `unset' is executed without option arguments, bash tries to unset a shell
function if a name argument cannot be a shell variable name because it's not
an identifier.
n. The `test -N' operator uses nanosecond timestamp granularity if it's
available.
o. Bash posix mode now treats assignment statements preceding shell function
definitions the same as in its default mode, since POSIX has changed and
no longer requires those assignments to persist after the function returns
(POSIX interp 654).
p. BASH_REMATCH is no longer readonly.
q. wait: has a new -p VARNAME option, which stores the PID returned by `wait -n'
or `wait' without arguments.
r. Sorting the results of pathname expansion now uses byte-by-byte comparisons
if two strings collate equally to impose a total order; the result of a
POSIX interpretation (#963 and #1070).
s. Bash now allows SIGINT trap handlers to execute recursively.
t. Bash now saves and restores state around setting and unsetting posix mode,
instead of having unsetting posix mode set a known state.
u. Process substitution is now available in posix mode.
v. READLINE_MARK: a new variable available while executing commands bound with
`bind -x', contains the value of the mark.
w. Bash removes SIGCHLD from the set of blocked signals if it's blocked at shell
startup.
x. `test -v N' can now test whether or not positional parameter N is set.
y. `local' now honors the `-p' option to display all local variables at the
current context.
z. The `@a' variable transformation now prints attributes for unset array
variables.
aa. The `@A' variable transformation now prints a declare command that sets a
variable's attributes if the variable has attributes but is unset.
bb. `declare' and `local' now have a -I option that inherits attributes and
value from a variable with the same name at a previous scope.
cc. When run from a -c command, `jobs' now reports the status of completed jobs.
dd. New `U', `u', and `L' parameter transformations to convert to uppercase,
convert first character to uppercase, and convert to lowercase,
respectively.
ee. PROMPT_COMMAND: can now be an array variable, each element of which can
contain a command to be executed like a string PROMPT_COMMAND variable.
ff. `ulimit' has a -R option to report and set the RLIMIT_RTTIME resource.
gg. Associative arrays may be assigned using a list of key-value pairs within
a compound assignment. Compound assignments where the words are not of
the form [key]=value are assumed to be key-value assignments. A missing or
empty key is an error; a missing value is treated as NULL. Assignments may
not mix the two forms.
hh. New `K' parameter transformation to display associative arrays as key-
value pairs.
ii. Writing history to syslog now handles messages longer than the syslog max
length by writing multiple messages with a sequence number.
jj. SECONDS and RANDOM may now be assigned using arithmetic expressions, since
they are nominally integer variables. LINENO is not an integer variable.
kk. Bash temporarily suppresses the verbose option when running the DEBUG trap
while running a command from the `fc' builtin.
ll. `wait -n' now accepts a list of job specifications as arguments and will
wait for the first one in the list to change state.
mm. The associative array implementation can now dynamically increase the
size of the hash table based on insertion patterns.
nn. HISTFILE is now readonly in a restricted shell.
oo. The bash malloc now returns memory that is 16-byte aligned on 64-bit
systems.
4. New Features in Readline
a. If a second consecutive completion attempt produces matches where the first
did not, treat it as a new completion attempt and insert a match as
appropriate.
b. Bracketed paste mode works in more places: incremental search strings, vi
overstrike mode, character search, and reading numeric arguments.
c. Readline automatically switches to horizontal scrolling if the terminal has
only one line.
d. Unbinding all key sequences bound to a particular readline function now
descends into keymaps for multi-key sequences.
e. rl-clear-display: new bindable command that clears the screen and, if
possible, the scrollback buffer (bound to emacs mode M-C-l by default).
f. New active mark and face feature: when enabled, it will highlight the text
inserted by a bracketed paste (the `active region') and the text found by
incremental and non-incremental history searches. This is tied to bracketed
paste and can be disabled by turning off bracketed paste.
g. Readline sets the mark in several additional commands.
h. Bracketed paste mode is enabled by default.
i. Readline tries to take advantage of the more regular structure of UTF-8
characters to identify the beginning and end of characters when moving
through the line buffer.
j. The bindable operate-and-get-next command (and its default bindings) are
now part of readline instead of a bash-specific addition.
+544
View File
@@ -0,0 +1,544 @@
This document details the changes between this version, bash-5.2-release, and
the previous version, bash-5.2-rc4.
1. Changes to Bash
2. Changes to Readline
a. When replacing a history entry, make sure the existing entry has a non-NULL
timestamp before copying it; it may have been added by the application, not
the history library.
3. New Features in Bash
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.2-rc4, and
the previous version, bash-5.2-rc3.
1. Changes to Bash
a. Changed how the compatibility mode enabling of extglob works in conjunction
with parsing conditional commands.
b. Fixed a problem with aliases containing command substitutions.
2. Changes to Readline
3. New Features in Bash
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.2-rc3, and
the previous version, bash-5.2-rc2.
1. Changes to Bash
a. Added a compatibility mode feature that causes the parser to parse command
substitutions as if extglob were enabled. If it is enabled before execution,
parse at execution will succeed. If not, the subsequent execution parse will
fail.
b. Fixed an issue with handling a `return' executed in a trap action if the
trap is executed while running in a shell function.
2. Changes to Readline
3. New Features in Bash
4. New Features in Readline
a. Readline now checks for changes to locale settings (LC_ALL/LC_CTYPE/LANG)
each time it is called, and modifies the appropriate locale-specific display
and key binding variables when the locale changes.
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.2-rc2, and
the previous version, bash-5.2-rc1.
1. Changes to Bash
a. Fixed a bug that could disable history saving after a compound array
assignment in an interactive shell.
b. Fixed a bug that could cause incorrect error messages when running a DEBUG
trap during a conditional or arithmetic command.
c. Fixed a bug that caused test to print an error message when given ! ! arg
as arguments.
d. Fixed a bug that resulted in incorrect error messages when completing a
backquoted command substitution.
e. Changed command substitution parsing to reproduce the original text more
closely when reconsituting the command string from the parsed command.
f. Fixed a bug that could cause an EXIT trap to use the wrong variable context
when the errexit option is set.
g. Fixed a bug that could cause the parser to incorrectly delimit a token when
an alias expansion ended with a multibyte character.
2. Changes to Readline
3. New Features in Bash
a. Since there is no `declare -' equivalent of `local -', make sure to use
`local -' in the output of `local -p'.
b. Null anchored matches in pattern substitution now process `&' in the
replacement string, like sed.
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.2-rc1, and
the previous version, bash-5.2-beta.
1. Changes to Bash
a. Changes to `wait -p' and how it sets the variable name in the presence of
valid and invalid PID arguments.
b. Fixed a bug that caused compgen to dump core if the completion engine was
not initialized.
c. Fixed a memory leak in the variable name programmable completion code.
d. Here-documents and here-strings use tempfiles if the shell compatibility
level is 50 or lower.
e. Non-interactive shells exit on a syntax error encountered while parsing a
command substitution.
f. Fixed a bug with inherited parser state while parsing a command substitution.
g. Fixed a bug that caused the shell not to check for terminating signals
after executing the command_string supplied with `-c' and before executing
the exit trap.
h. Changes to avoid a make race condition while generating builtins.c.
i. Make it explicit that BASH_REMATCH is always a global variable, and that
local copies are (currently) ignored.
j. Fixed a bug that caused an ambiguous redirection (>&word) to be printed
incorrectly (>&word) if no file descriptor was supplied.
2. Changes to Readline
a. Fixed a bug that caused rl_eof_found to be set prematurely while reading a
multi-character key sequence in callback mode.
3. New Features in Bash
a. In posix mode, the `printf' builtin checks for the `L' length modifier and
uses long double for floating point conversion specifiers if it's present,
double otherwise.
b. The `globbing' completion code now takes the `globstar' option into account.
c. `suspend -f' now forces the shell to suspend even if job control is not
currently enabled.
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.2-beta, and
the previous version, bash-5.2-alpha.
1. Changes to Bash
a. Fixed a problem with command-oriented history and multi-line commands that
caused embedded blank lines to be run together.
b. Changed the way `&' is quoted when performing pattern substitution and
`patsub_replacement' is enabled.
c. Fixed some integer overflows when expanding strings or reading the output
of command substitution larger than 2GB.
d. `wait -p' without the `-n' option now does something useful if there are no
jobs.
e. Fixed an issue with read timeouts in posix mode.
f. Changed here-document processing to process $'...' and $"..." only when they
appear in the WORD portion of ${PARAM OP WORD} in the here-document body
and the body is being expanded.
g. Changed alias expansion in command substitution to be posix-conformant
(performed while initially parsing the command substitution) when in posix
mode.
h. Bash optimizes away more forks in subshells.
i. Here-document construction now performs quote removal on the here-document
delimiter only if it's marked as quoted, which prevents quote characters in
command substitutions from being removed.
j. Prompt string expansion now gives invisible characters in the expansion of
the \w, \W, and \s escape sequences a visible representation to avoid
problems with redisplay.
k. Fixed a problem with SIGINT during the execution of a command bound with
`bind -x' affecting the saved terminal settings.
l. Fixed an inconsistency with how $@ expands in a construct like ${@:+set}
or ${array[@]:+set} in the presence of null positional parameters or
array elements.
2. Changes to Readline
a. Prevent some display problems when running a command as the result of a
trap or one bound using `bind -x' and the command generates output.
b. Fixed an issue with multi-line prompt strings that have one or more
invisible characters at the end of a physical line.
c. Fixed an issue that caused a history line's undo list to be cleared when
it should not have been.
3. New Features in Bash
a. There is a new bindable readline command name: `vi-edit-and-execute-command'.
4. New Features in Readline
a. Two new bindable string variables: active-region-start-color and
active-region-end-color. The first sets the color used to display the
active region; the second turns it off. If set, these are used in place
of terminal standout mode.
b. New readline state (RL_STATE_EOF) and application-visible variable
(rl_eof_found) to allow applications to detect when readline reads EOF
before calling the deprep-terminal hook.
c. There is a new configuration option: --with-shared-termcap-library, which
forces linking the shared readline library with the shared termcap (or
curses/ncurses/termlib) library so applications don't have to do it.
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.2-alpha, and
the previous version, bash-5.1-release.
1. Changes to Bash
a. Fixed a bug that assigned a value to the variable name supplied as an
argument to `wait -p' when there were no jobs.
b. Fixed a bug that resulted in performing incorrect word expansion on the
key/value pairs in a compound array assignment.
c. Fixed a bug that could put the child forked to run a command substitution
into the wrong process group.
d. Fixed a problem that could cause the lastpipe option to work incorrectly if
file descriptor 0 was closed.
e. Bash tries to suppress traps if a forked child receives a trapped signal
before it has a chance to reset its signal handlers.
f. Fixed several memory leaks in compound array assignments.
g. Fixed a problem with performing an assignment with `+=' to an array element
that was the value of a nameref.
h. Fixed a bug that could cause a nameref containing an array reference using
`@' or `*' not to expand to multiple words.
i. Fixed a bug where extended glob functions could match `.' or `..' when it
wasn't explicitly specified, even if dotglob was set.
j. Fixed a bug that caused non-interactive posix-mode shells not to exit on a
variable assignment error while assigning into the temporary environment.
k. Fixed a bug that caused parsing errors if an alias contained a compound
array assignment.
l. Fixed a couple of instances where bash checked syntax too aggressively when
trying to determine how to add a partial command to command-oriented
history.
m. Fixed a parser problem that caused it not to allow reserved words to follow
the `((' and `[[' commands.
n. Fixed a bad offset calculation when using negative offsets to `history -d'.
o. Fixed an off-by-one error that caused a read past the end of a buffer when
reading a multibyte character from the output of a command substitution.
p. Fixed a problem with a failed `exec' command not setting $? to the right
value for an exit trap.
q. Fixed a problem that caused bash not to unlink FIFOs created as part of
expanding redirections for an external command.
r. Fixed a bug that could cause aliases not to be expanded in case statements.
s. Fixed a bug that could cause word completion to attempt programmable
completion for the target of a redirection, instead of filename completion.
t. Fixed a bug that could result in errors after rebinding a key sequence with
`bind -x' multiple times.
u. Fixed a problem that could result in not quoting the result when performing
command name completion with a glob pattern in the command name.
v. `mapfile' now uses fully-buffered reads in more cases, which should improve
bulk read performance.
w. Fixed a bug that caused `wait -n' to not reset its internal state when
interrupted by a signal, resulting in subsequent calls failing.
x. Fixed a bug with parsing numeric arguments to readline key sequences
installed with `bind -x'.
y. Bash suppresses forking in several additional cases, including most uses
of $(<file).
z. If there are multiple `!' tokens in a [[ command, toggle the invert state
instead of setting it unconditionally.
aa. Fixed a bug where running `fc' on an empty history list would cause the
shell to crash.
bb. Word completion now checks whether or not a quote character closes a
quoted string begun on a previous line, so readline doesn't interpret the
quote as starting a new quoted string.
cc. Fixed a typo that translated \UNNNNNNNN characters that were not valid in
the current locale encoding as \uNNNNNNNN.
dd. Fixed an issue that could cause bash to print timing statistics for the
wrong command when `set -e' causes a command to fail.
ee. Bash now runs the exit trap in function context if a failed command in
the function causes the shell to exit.
ff. Some fixes to how subshells modify $SHLVL.
gg. Fixed a bug that caused `mapfile -t' not to remove the delimiter when the
delimiter is > 128 in the current encoding.
hh. Fixed a problem that could cause the shell to attempt to free unallocated
memory if an expansion error occurred.
ii. Fixed a bug in the bash malloc implementation of malloc_usable_size. Bash
did not use it, but it could cause problems with library functions that
did.
jj. If the `exec' builtin fails, and the shell does not exit, it restores
trapped signals to their trapped state.
kk. Fixed a bug that could cause variable assignment arguments to `declare' to
expand variables using attributes that the call to declare was turning off.
ll. Fixed a bug with LINENO and arithmetic for commands.
mm. Fixed a posix-mode bug that caused tildes not to be expanded after an
unquoted colon on the right side of an assignment statement.
nn. Fixed a problem with `caller' and line numbers when executing an ERR trap.
oo. Fixed a problem that could make the value returned by ${a:=b} not be the
final value assigned to a (e.g., if `a' has an attribute that modifies
the value on assignment).
pp. Fixed a problem with saving multi-line here-documents to the history list
where the here-document delimiter does not appear on the first line.
qq. Fixed a bug with using += to assign to dynamic variables like RANDOM.
rr. Fixed a bug that caused `set -n' to modify $? if set after execution had
started.
ss. Builtins like printf/read/wait now behave more consistently when assigning
arbitrary keys to associative arrays (like `]'. when appropriately quoted).
tt. Fixed a problem with here-document collection printing the wrong prompt
when parsing a compound list in an interactive shell.
uu. Fixed a problem with quoting shell expansion characters (like `$') when
they appear in a tab-completed word along with characters that do need
quoting (e.g.. $HOME/VirtualBox VMs).
2. Changes to Readline
a. Fixed a problem with cleaning up active marks when using callback mode.
b. Fixed a problem with arithmetic comparison operators checking the version.
c. Fixed a problem that could cause readline not to build on systems without
POSIX signal functions.
d. Fixed a bug that could cause readline to crash if the application removed
the callback line handler before readline read all typeahead.
e. Added additional checks for read errors in the middle of readline commands.
f. Fixed a redisplay problem that occurred when switching from the digit-
argument prompt `(arg: N)' back to the regular prompt and the regular
prompt contained invisible characters.
g. Fixed a problem with restoring the prompt when aborting an incremental
search.
h. Fix a problem with characters > 128 not being displayed correctly in certain
single-byte encodings.
i. Fixed a problem with unix-filename-rubout that caused it to delete too much
when applied to a pathname consisting only of one or more slashes.
j. Fixed a display problem that caused the prompt to be wrapped incorrectly if
the screen changed dimensions during a call to readline() and the prompt
became longer than the screen width.
k. Fixed a problem that caused the \r output by turning off bracketed paste
to overwrite the line if terminal echo was disabled.
l. Fixed a bug that could cause colored-completion-prefix to not display if
completion-prefix-display-length was set.
m. Fixed a problem with line wrapping prompts when a group of invisible
characters runs to the right edge of the screen and the prompt extends
longer then the screen width.
n. Fixed a couple problems that could cause rl_end to be set incorrectly by
transpose-words.
3. New Features in Bash
a. The bash malloc returns memory that is aligned on 16-byte boundaries.
b. There is a new internal timer framework used for read builtin timeouts.
c. Rewrote the command substitution parsing code to call the parser recursively
and rebuild the command string from the parsed command. This allows better
syntax checking and catches errors much earlier. Along with this, if
command substitution parsing completes with here-documents remaining to be
read, the shell prints a warning message and reads the here-document bodies
from the current input stream.
d. The `ulimit' builtin now treats an operand remaining after all of the options
and arguments are parsed as an argument to the last command specified by
an option. This is for POSIX compatibility.
e. Here-document parsing now handles $'...' and $"..." quoting when reading the
here-document body.
f. The `shell-expand-line' and `history-and-alias-expand-line' bindable readline
commands now understand $'...' and $"..." quoting.
g. There is a new `spell-correct-word' bindable readline command to perform
spelling correction on the current word.
h. The `unset' builtin now attempts to treat arguments as array subscripts
without parsing or expanding the subscript, even when `assoc_expand_once'
is not set.
i. There is a default value for $BASH_LOADABLES_PATH in config-top.h.
j. Associative array assignment and certain instances of referencing (e.g.,
`test -v') now allow `@' and `*' to be used as keys.
k. Bash attempts to expand indexed and associative array subscripts only
once when executing shell constructs and word expansions.
l. The `unset' builtin allows a subscript of `@' or `*' to unset a key with
that value for associative arrays instead of unsetting the entire array
(which you can still do with `unset arrayname'). For indexed arrays, it
removes all elements of the array without unsetting it (like `A=()').
m. Additional builtins (printf/test/read/wait) do a better job of not
parsing array subscripts if array_expand_once is set.
n. New READLINE_ARGUMENT variable set to numeric argument for readline commands
defined using `bind -x'.
o. The new `varredir_close' shell option causes bash to automatically close
file descriptors opened with {var}<fn and other styles of varassign
redirection unless they're arguments to the `exec' builtin.
p. The `$0' special parameter is now set to the name of the script when running
any (non-interactive) startup files such as $BASH_ENV.
q. The `enable' builtin tries to load a loadable builtin using the default
search path if `enable name' (without any options) attempts to enable a
non-existent builtin.
r. The `printf' builtin has a new format specifier: %Q. This acts like %q but
applies any specified precision to the original unquoted argument, then
quotes and outputs the result.
s. The new `noexpand_translations' option controls whether or not the translated
output of $"..." is single-quoted.
t. There is a new parameter transformation operator: @k. This is like @K, but
expands the result to separate words after word splitting.
u. There is an alternate array implementation, selectable at `configure' time,
that optimizes access speed over memory use (use the new configure
--enable-alt-array-implementation option).
v. If an [N]<&WORD- or [N]>&WORD- redirection has WORD expand to the empty
string, treat the redirection as [N]<&- or [N]>&- and close file descriptor
N (default 0).
w. Invalid parameter transformation operators are now invalid word expansions,
and so cause fatal errors in non-interactive shells.
x. New shell option: patsub_replacement. When enabled, a `&' in the replacement
string of the pattern substitution expansion is replaced by the portion of
the string that matched the pattern. Backslash will escape the `&' and
insert a literal `&'.
y. `command -p' no longer looks in the hash table for the specified command.
z. The new `--enable-translatable-strings' option to `configure' allows $"..."
support to be compiled in or out.
aa. The new `globskipdots' shell option forces pathname expansion never to
return `.' or `..' unless explicitly matched. It is enabled by default.
bb. Array references using `@' and `*' that are the value of nameref variables
(declare -n ref='v[@]' ; echo $ref) no longer cause the shell to exit if
set -u is enabled and the array (v) is unset.
4. New Features in Readline
a. There is now an HS_HISTORY_VERSION containing the version number of the
history library for applications to use.
b. History expansion better understands multiple history expansions that may
contain strings that would ordinarily inhibit history expansion (e.g.,
`abc!$!$').
c. There is a new framework for readline timeouts, including new public
functions to set timeouts and query how much time is remaining before a
timeout hits, and a hook function that can trigger when readline times
out. There is a new state value to indicate a timeout.
d. Automatically bind termcap key sequences for page-up and page-down to
history-search-backward and history-search-forward, respectively.
e. There is a new `fetch-history' bindable command that retrieves the history
entry corresponding to its numeric argument. Negative arguments count back
from the end of the history.
f. `vi-undo' is now a bindable command.
g. There is a new option: `enable-active-region'. This separates control of
the active region and bracketed-paste. It has the same default value as
bracketed-paste, and enabling bracketed paste enables the active region.
Users can now turn off the active region while leaving bracketed paste
enabled.
h. rl_completer_word_break_characters is now `const char *' like
rl_basic_word_break_characters.
i. Readline looks in $LS_COLORS for a custom filename extension
(*.readline-colored-completion-prefix) and uses that as the default color
for the common prefix displayed when `colored-completion-prefix' is set.
+635
View File
@@ -0,0 +1,635 @@
This document details the changes between this version, bash-5.3-alpha, and
the previous version, bash-5.2-release.
1. Changes to Bash
a. Stop checking for new mail if an interactive shell is in the middle of
programmable completion or readline command dispatching.
b. Changes to multibyte character translation to handle shift states better.
c. Fixed a bug with subshell command execution that caused it to set LINENO
incorrectly.
d. Fixed a bug that caused some array subscript references in arithmetic
expansions to seg fault.
e. Don't report on foreground jobs that we won't notify the user about if
jobs is run from a trap handler or a `bind -x' command.
f. Fixed a bug where temporarily turning on `extglob' while parsing a command
substitution in compatibility mode could leave it set.
g. Fixed a bug where nested word expansions confused the state parser and
resulted in quotes being required where they should not have been.
h. Fixed a bug where nested function definitions resulted in `display -F'
printing incorrect line numbers.
i. Fixed the message printed when the shell gets ENOENT from execve: specific
message about a bad interpreter before the generic error message.
j. Fixed a spurious debug message when errexit is set and the shell is
exiting from an eval command in a shell function.
k. Fixed a bug where a pending signal would cause pattern matching to fail in
an exit trap.
l. Fixed a crash caused by a null replacement string in pattern replacement.
m. Fixed a bug in interactive shells where a SIGINT received while parsing a
command substitution would leave the expand_aliases option disabled.
n. Fixed a bug with command printing when printing multiple shell functions
with here-documents inside a command substitution.
o. Fixed a bug with expanding aliases while parsing command substitutions
inside another word expansion.
p. Fixed a bug with alias expansion in posix mode in an eval command inside a
command substitution.
q. Fixed a bug that caused the parser not to reset correctly if it encountered
a syntax error while trying to read a WORD token.
r. Fixed a bug that caused `<(' and `>(' to trigger process substitution inside
an arithmetic expression.
s. Fixed a bug that caused the shell to unlink FIFOs used for process
substitution before a compound command completes.
t. Fixed a bug that caused the read builtin to not recognize some negative
fractional arguments.
u. Fixed a bug that caused subshells not to run the EXIT trap if a signal
arrived after the command and before returning to the caller.
v. Fixed a bug where `wait' without arguments could wait for inherited
process substitutions, which are not children of this shell.
w. Fixed a bug with expanding $* in a here-document body.
x. Fixed a bug where `declare -p' in a shell function would show the wrong
command for `local -'.
y. Change for POSIX interpretation 1602 about the default return status for
`return' in a trap command.
z. Fixed a bug that caused double evaluation of a dynamic variable like
$RANDOM when using certain parameter expansions.
aa. Fixed a bug where `read -e -t' would cause an interactive shell to exit.
bb. Fixed a number of bugs with pathname expansion/pattern matching and
slashes in bracket expressions.
cc. Fixed several bugs with optimizing out forks.
dd. Fixed a memory leak when referencing unset associative array elements.
ee. System-specific changes for: WIN32
ff. Perform more cleanup if the shell exceeds maximum function nesting level.
gg. Fixed a bug that caused `eval' to run the ERR trap in commands where it
should not.
hh. Fixed nameref expansion where nameref values are valid length expansion
expressions but invalid identifiers.
ii. Fixed an error that caused syntax errors when expanding nested word
expansions inside a here-document.
jj. POSIX special builtins now exit the shell in posix mode on more failure
cases.
kk. Brace expansion is interruptible at more spots, so long expansions can
be interrupted more quickly.
ll. Fixed a crash caused by running `set -o emacs' in `bash -c command'.
mm. Fixed a bug that caused bash to reset the terminal process group before
a command exited if it received a SIGINT in a non-interactive shell.
nn. Significant changes to the source code to make it C23-conformant, including
C23 undefined behavior.
oo. Treat read(2) errors while reading input as immediately fatal errors
instead of the traditional EOF; POSIX interp 1629
pp. Fix to allow asynchronous commands to use `trap' to reset signals that
are ignored during the command; POSIX interp 751.
qq. Fix a posix-mode bug with alias expansion when checking for reserved
words and the previous alias expansion ends with a space.
rr. Programmable completion now creates empty elements in COMP_WORDS if the
cursor is on whitespace just preceding a word.
ss. Fixed a bug that prevented aliases ending with a space from alias
expanding the next word if more than two aliases are expanded from a
single word.
tt. Fixed a bug that caused the shell to give the terminal to the shell's
process group when reaping a background job.
uu. Command printing is more consistent when to print `function' before a
shell function name.
vv. Fixed a bug that caused unset not to remove a function named a[b] if
there was no array variable a.
ww. Posix mode doesn't perform function lookup for function names containing
a slash.
xx. <( and >( can now be used in funtion names.
yy. Fixed a bug that caused tilde expansion not to be performed on some
array subscripts.
zz. Fixed key-value pair associative array assignment to be more consistent
with compound array assignment, and indexed array assignment (a=(zero one))
to be more consistent with explicitly assigning indices one by one.
aaa. In posix mode, extra arguments to `fc' are now an error.
bbb. The bash readline commands that perform history and alias expansion try
to place point closer to where it was in the unexpanded line.
ccc. Fixed multiple invocations of `local -' in the same shell function to
have the same effect as one.
ddd. Don't export $_ if allexport is set.
eee. Don't add extra newlines to the history if parsing a delimited construct.
fff. Dynamically-loaded builtins cannot have slashes in their names, since
they'll never be called.
ggg. Fixed a bug that could cause reading EOF while parsing a quoted string
to terminate the shell.
hhh. Fixed a bug that caused local variables with the same name as variables
in `declare's temporary environment to be propagated back to the caller.
iii. Don't try to perform brace expansion on assignment statements in compound
assignments.
jjj. Fixed a bug that could cause a crash while evaluating an arithmetic for
command if one of the expressions expands to NULL.
kkk. In posix mode, cd tries to change to what the user typed if the
canonicalized version of that pathname is longer than PATH_MAX.
lll. Fixes for some errors revealed by address sanitizer.
mmm. If fork(2) fails, kill the current pipeline processes with SIGKILL after
SIGTERM, in case they're ignoring SIGTERM.
nnn. Fix to adding command substitutions to history to avoid adding semicolons
where they shouldn't be.
ooo. Programmable completion and compgen honor the setting of `dotglob'.
ppp. Use gettimeofday(2) to get time information instead of using time(3).
qqq. Save and restore readline variables affecting filename completions in
case someone runs `compgen' in the foreground.
rrr. Treat the failure to open file in $(<file) as a non-fatal expansion
error instead of a fatal redirection error.
sss. In posix mode, command substitution doesn't affect $? except when
specified for commands consisting solely of assignment statements.
ttt. Fix {var}>&- so it doesn't silently close stdin if var is not a number.
uuu. Follow namerefs in ${name=word} so the shell can implement the POSIX
semantics of returning "the final value of parameter."
vvv. Bash performs better nameref loop detection in several lookup cases.
www. SIGINT will now break out of loops if a process executed in the loop dies
due to SIGINT, not just if the loop body is a list. This is no longer
dependent on the compatibility level.
xxx. FIGNORE suffixes can now match the entire pathname, like tcsh, instead
of requiring a non-empty prefix.
yyy. Fix bug that caused FUNCNAME not to be reset after a parse error with
compound assignments to local variables.
zzz. Fix bug that caused `jobs' not to remove jobs from the list in a SIGCHLD
trap.
aaaa. Fix bug that caused `ignoreeof' to be ignored if EOF is read at a
secondary prompt or while parsing a command substitution.
bbbb. Fixes to removing jobs from the jobs table when the user isn't notified;
has effects of fixing issues with `wait -n' not finding jobs.
cccc. Fixes to loadable builtin processing so that we never pass a null
pathname or try to load a builtin that's not found if the -n option is
supplied.
dddd. Work around system-specific problems (macOS) where isblank(3) returns
true for characters >= 0x80 in a UTF-8 locale.
eeee. Fix for crash while parsing alias expansions that include compound
assignments.
ffff. Fixe for non-interactive shells reading a script file that ends with
backslash preceding EOF.
gggg. Fix to command printing when here-documents are attached to compound
commands in lists.
hhhh. Fix bug with sourcing `files' created by process substitutions inside
a `.' script.
iiii. Fixes to declare builtin to treat arguments to declare -f that look like
assignment statements or array references as function names.
jjjj. Fixed a variable conversion problem when exporting a variable in the
temporary environment back to the calling scope.
kkkk. BASH_REMATCH can now be a local variable.
llll. Subshell commands clear process substitutions so anything created by a
redirection doesn't affect the subshell.
mmmm. Fixes for several small memory leaks.
nnnn. The shell simply ignores attempts to assign to `noassign' variables
instead of treating them as an assignment error and possibly causing
the shell to exit.
oooo. If the cd builtin uses $OLDPWD, allow it to use $CDPATH if the user has
set it to something that's not a full pathname.
pppp. The test builtin only supports the optional argument to -t if parsing
an expression with more than four aguments and not in posix mode.
qqqq. Changes to filename quoting and rewriting to deal with NFC and NFD
Unicode forms (primarily for macOS).
rrrr. Send SIGCONT to a job we've just restarted with fg or bg, even if we
think it's already running.
ssss. Fixes for setting the line number associated with a simple command.
tttt. Many changes for integer overflow and out-of-range arguments to printf.
uuuu. Fixes for the read builtin and unescaped backslashes preceding NULs or
the end of the input.
vvvv. The -[anrw] options to the history builtin should have no effect if
HISTFILE is unset or null.
wwww. If programmable completion uses something different than what the user
typed as the command name (full pathname, alias, etc.), display what's
actually used in `compopt' output.
xxxx. Fix bug with closing /dev/fd process substitutions in shell functions.
yyyy. Fix bug with `declare -g' trying to convert a global associative array
to an indexed array.
zzzz. Fix bash history expansion characters so we don't get empty history
events.
aaaaa. Allow `time' and `!' reserved words to be followed by `&', which POSIX
interp 267 says is required.
bbbbb. Upgrade intl library to the one from gettext-0.21.1.
ccccc. Fix line number in the event that a simple command jumps back to the
top level on error.
ddddd. Make the order of setting BASH_COMMAND, running the DEBUG trap, and
printing PS4 consistent across all command types.
eeeee. Rely on child processes to set the terminal process group instead of
having the parent do it as well.
fffff. Fix `printf' to consume entire multibyte characters in the format string,
in case the encoding contains `/' or `%'.
ggggg. Fix `hash' to return 1 if -d is supplied and the hash table is empty.
hhhhh. Fix `select' command to be like `for' in that an invalid selection
variable is a fatal error in posix mode.
iiiii. Fix to parameter length expansion to avoid expanding dynamic variables
(e.g., RANDOM) more than once.
jjjjj. Fix to `shift', `break', and `continue' to skip over a `--' when
printing an invalid argument error message.
kkkkk. Fix bug that caused an invalid arithmetic expression in an arithmetic
`for' command to leave the loop level set to the wrong value, preventing
`break' and `continue' from working.
lllll. Fix problem with removing escapes in the `E' variable transformation.
mmmmm. Fix bug with word splitting if `read' assigns to IFS.
nnnnn. Fix posix-mode cases where failure of special builtins did not cause
the shell to exit.
ooooo. Some fixes to cases where the shell quotes characters that are special
internally.
ppppp. Fix error with read builtin trying to assign to a readonly variable.
qqqqq. Fix a slight race condition when bash receives a SIGINT while waiting
for a foreground job.
rrrrr. Fix integer parsing to accept more whitespace characters after the
digit string -- the same ones we accept before the digits.
sssss. Fix a crash when attempting to brace-expand a very large list of
strings fails.
ttttt. Fix dynamic loading of builtins not to look in the current directory
if looking in BASH_LOADABLES_PATH is not successful, like $PATH
searching.
uuuuu. Fix `bind -x' commands to understand negative argument counts.
vvvvv. Disable fork optimization if the shell is running startup files because
SSH_SOURCE_BASHRC was enabled; prevents infinite recursion.
wwwww. Fix `unset' builtin to implement POSIX interp 1009, which says that
unsetting a variable in the temporary environment unsets the variable
in the enclosing scope also, in posix mode.
xxxxx. Fix parser to read here-document body from the current alias, if that's
where input is being read from.
yyyyy. Fix an off-by-one error that caused completion to fail for certain
pathnames containing backslash-quoted single-quotes.
zzzzz. Fix command printing to print a coproc name only if the coproc command
is not a simple command.
aaaaaa. Fix prompt string decoding to preserve the value of $_.
bbbbbb. In posix mode, supplying a non-identifier as a function name to `export'
or `readonly' should cause the shell to exit, since these are special
builtins.
cccccc. Fix a crash that happens due to accessing freed memory if the parser
encounters a syntax error while parsing an alias or a compound
assignment.
dddddd. Fix a bug that could cause errors while executing a DEBUG trap in a
pipeline.
eeeeee. Fix a bug where exiting a subshell should not try to restore the
terminal settings if that subshell didn't reinitialize them.
ffffff. Remove long-lived workaround for old AFS bug that causes problems with
modern implementations.
gggggg. Fix a bug that caused an assignment error to BASHOPTS or SHELLOPTS to
remove the variable's readonly attribute.
hhhhhh. Fix for a crash if a pathname argument to `cd' is NULL and the current
directory has been removed.
iiiiii. Fix a bug with shell-expand-line readline command that caused it to
interpret quoted single quotes incorrectly when inside $'...'.
jjjjjj. Fix to the declare builtin to catch more invalid option combinations.
kkkkkk. Fix to avoid unsafe execution of the EXIT trap if a terminating signal
arrives while bash is waiting for a foreground process.
llllll. Fixed a bug that allowed attribute changes to readonly variables that
changed the effects of attempted assignments.
mmmmmm. Fix bug that caused quoting errors if $* was expanded in a context
where word splitting was not performed.
oooooo. Fix bug that caused declare commands with `-' and `+' options and an
assignment statement to be misinterpreted.
pppppp. Retry opening startup files if the open is interrupted by a signal
and is not automatically restarted.
qqqqqq. Fix printing a case command where one of the case command lists begins
with the word `esac'.
rrrrrr. Fix for history and command number expansion when expanding a prompt
string that contains the @P variable transformation.
ssssss. Fix a bug that could cause the shell to hang if a script used multiple
coprocesses without manually closing file descriptors associated with
existing coprocesses.
2. Changes to Readline
a. Fixed a bug in clearing the visible line structure before redisplay.
b. Fix a bug where setlocale(3) returning NULL caused a crash.
c. Fixed signal checking in callback mode to handle signals that arrive before
readline restore's the application's signal handlers.
d. Fixed a bug with word completion where the directory name needs to be
dequoted and tilde-expanded.
e. Fixed a bug that caused compilation to fail on systems with select but not
pselect.
f. System-specific changes for: WIN32, z/OS, Cygwin, MSYS
g. Fixed a bug that caused word completion mismatches if the quoted text the
user typed was longer than the unquoted match.
h. Fixes for freeing undo lists that might appear in history list entries
after non-incremental searches.
i. Fixes for some errors revealed by address sanitizer.
j. In vi mode, if an `f' or `F' move command associated with a `c' or `C'
command fails, don't enter insert mode.
k. Fixed bug with truncating a history file containing timestamps that caused
the timestamp associated with the first history entry not to be written.
l. Fix vi-mode so that a motion command attached to d/D, y/Y, or t/T must
consume or delete at least one character.
m. Fix a redisplay error when displaying meta characters as octal sequences
and other C locale issues.
n. Fix error that caused characters composing an incomplete multibyte
character not to be inserted into the line.
o. In callback mode, let the application echo the signal characters (e.g., ^C)
when the application's signal handlers are installed.
p. Added some support for lines that consume more than the physical number of
screen lines.
q. Make sure dump-variables returns the string values for active-region-start-color
and active-region-end-color if they're set.
r. Fixes to how characters between 128 and 159 are printed when displaying
macro values (use symbolic notation instead of directly printing the
character).
s. Don't convert meta characters that contain NULL (\M-\C-@) to actual NULs,
which prematurely terminates the macro value.
t. Fix typo in the readline color prefix extension that it uses for coloring
filename prefixes when displaying possible completions.
u. Call the filename rewrite hook on the word being completed before comparing
it against possible completions from the file system to get consistent
strings.
v. Fix infinite recursion that can happen if someone binds a key that doesn't
have a different upper and lower case represenation to do-lowercase-version.
w. Check for non-ANSI (dumb) terminals a little more thoroughly.
x. Don't attempt to history-expand the `quick substitution' character at the
beginning of a line if the application has set the quoting state to single
quotes.
y. Fix small memory leak if non-incremental or incremental search is
interrupted by a signal.
z. Loading very large history files should be much faster.
aa. Retry opening startup files if the open is interrupted by a signal
and is not automatically restarted.
3. New Features in Bash
a. When checking whether a script file argument is a binary file, check the
first two lines of a script if the first line begins with `#!'.
b. Bash does a better job of preserving user-supplied quotes around a word
completion, instead of requoting it.
c. Bash reports the starting line number in an error message about an
unterminated compound command like `if' without a `fi'.
d. Implement the POSIX requirement that running the `jobs' builtin removes
jobs from the jobs list.
f. Call bash signal handlers while executing programmable completion commands,
instead of readline's.
g. Print an error message if a regular expression used with [[ fails to compile.
h. The `umask' builtin now has additional features for full POSIX conformance.
i. `type -a -P' reports both hashed pathnames and the result of a $PATH search.
j. `trap' has a new -P option that prints the trap action associated with each
signal argument.
k. The `command' builtin preceding a declaration builtin (e.g., `declare')
preserves the special asisgnment statement parsing for the declation
builtin. This is a new POSIX requirement.
l. `printf' uses the `alternate form' for %q and %Q to force single quoting.
m. `printf' now interprets %ls (%S) and %lc (%C)nas referring to wide strings
and characters, respectively, when in a multibyte locale.
n. The shell can be compiled with a different default value for the
patsub_replacement option.
o. Check for window size changes during trap commands, `bind -x' commands,
and programmable completion.
p. Treat a NULL value for $PATH as equivalent to ".".
p. New loadable builtins: kv, strptime
q. GLOBSORT: new variable to specify how to sort the results of pathname
expansion (name, size, blocks, mtime, atime, ctime, none) in ascending
or descending order.
r. `compgen' has a new option: -V varname. If supplied, it stores the generated
completions into VARNAME instead of printing them on stdout.
s. New form of command substitution: ${ command; } or ${|command;} to capture
the output of COMMAND without forking a child process and using pipes.
t. array_expand_once: new shopt option, replaces assoc_expand_once
u. complete/compopt new option: fullquote; sets rl_full_quoting_desired so all
possible completions are quoted as if they were filenames.
v. Command timing now allows precisions up to 6 digits instead of 3 in
$TIMEFORMAT.
w. BASH_MONOSECONDS: new dynamic variable that returns the value of the
system's monotonic clock, if one is available.
x. BASH_TRAPSIG: new variable, set to the numeric signal number of the trap
being executed while it's running.
y. The checkwinsize option can be used in subshell commands started from
interactive shells.
z. In posix mode, the test command < and > binary primaries compare strings
using the current locale.
aa. bind -x allows new key binding syntax: separate the key sequence and the
command string with whitespace, but require the command string to be
double-quoted if this is used. This allows different quoting options for
the command string.
bb. Print commands bound to key sequences using `bind -x' with the new key
binding syntax it allows.
cc. `read' has a new `-E' option to use readline but with the default bash
completion (including programmable completion).
dd. New bindable readline command name: `bash-vi-complete'.
ee. New test builtin behavior when parsing a parenthesized subexpression and
test was given more than 4 arguments: scan forward for a closing paren and
call posixtest() if there are 4 or fewer arguments between the parentheses.
Added for compatibility with coreutils test, dependent on the shell
compatibility level. Such expressions remain ambiguous.
4. New Features in Readline
a. Output a newline if there is no prompt and readline reads an empty line.
b. The history library falls back to stdio when writing the history list if
mmap fails.
c. New bindable variable `search-ignore-case', causes readline to perform
case-insensitive incremental and non-incremental history searches.
d. rl_full_quoting_desired: new application-settable variable, causes all
completions to be quoted as if they were filenames.
e. rl_macro_display_hook: new application-settable function pointer, used if
the application wants to print macro values itself instead of letting
readline do it
f. rl_reparse_colors: new application-callable function, reparses $LS_COLORS
(presumably after the user changes it)
g. rl_completion_rewrite_hook: new application-settable function pointer,
called to modify the word being completed before comparing it against
pathnames from the file system.
h. execute-named-command: a new bindable command that reads the name of a
readline command from the standard input and executes it. Bound to M-x
in emacs mode by default.
i. Incremental and non-incremental searches now allow ^V/^Q (or, in the former
case, anything bound to quoted-insert) to quote characters in the search
string.
+598
View File
@@ -0,0 +1,598 @@
Compatibility with previous versions
====================================
This document details the incompatibilities between this version of bash,
bash-5.3, and the previous widely-available versions, bash-3.2 (which is
still the `standard' version for Mac OS X), 4.2/4.3 (which are still
standard on a few Linux distributions), and bash-4.4 and
bash-5.0/bash-5.1/bash-5.2, the current widely-available versions.
These were discovered by users of bash-2.x through 5.x, so this list is not
comprehensive. Some of these incompatibilities occur between the current
version and versions 2.0 and above.
1. Bash uses a new quoting syntax, $"...", to do locale-specific
string translation. Users who have relied on the (undocumented)
behavior of bash-1.14 will have to change their scripts. For
instance, if you are doing something like this to get the value of
a variable whose name is the value of a second variable:
eval var2=$"$var1"
you will have to change to a different syntax.
This capability is directly supported by bash-2.0:
var2=${!var1}
This alternate syntax will work portably between bash-1.14 and bash-2.0:
eval var2=\$${var1}
2. One of the bugs fixed in the YACC grammar tightens up the rules
concerning group commands ( {...} ). The `list' that composes the
body of the group command must be terminated by a newline or
semicolon. That's because the braces are reserved words, and are
recognized as such only when a reserved word is legal. This means
that while bash-1.14 accepted shell function definitions like this:
foo() { : }
bash-2.0 requires this:
foo() { :; }
This is also an issue for commands like this:
mkdir dir || { echo 'could not mkdir' ; exit 1; }
The syntax required by bash-2.0 is also accepted by bash-1.14.
3. The options to `bind' have changed to make them more consistent with
the rest of the bash builtins. If you are using `bind -d' to list
the readline key bindings in a form that can be re-read, use `bind -p'
instead. If you were using `bind -v' to list the key bindings, use
`bind -P' instead.
4. The `long' invocation options must now be prefixed by `--' instead
of `-'. (The old form is still accepted, for the time being.)
5. There was a bug in the version of readline distributed with bash-1.14
that caused it to write badly-formatted key bindings when using
`bind -d'. The only key sequences that were affected are C-\ (which
should appear as \C-\\ in a key binding) and C-" (which should appear
as \C-\"). If these key sequences appear in your inputrc, as, for
example,
"\C-\": self-insert
they will need to be changed to something like the following:
"\C-\\": self-insert
6. A number of people complained about having to use ESC to terminate an
incremental search, and asked for an alternate mechanism. Bash-2.03
uses the value of the settable readline variable `isearch-terminators'
to decide which characters should terminate an incremental search. If
that variable has not been set, ESC and Control-J will terminate a
search.
7. Some variables have been removed: MAIL_WARNING, notify, history_control,
command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
nolinks, hostname_completion_file, noclobber, no_exit_on_failed_exec, and
cdable_vars. Most of them are now implemented with the new `shopt'
builtin; others were already implemented by `set'. Here is a list of
correspondences:
MAIL_WARNING shopt mailwarn
notify set -o notify
history_control HISTCONTROL
command_oriented_history shopt cmdhist
glob_dot_filenames shopt dotglob
allow_null_glob_expansion shopt nullglob
nolinks set -o physical
hostname_completion_file HOSTFILE
noclobber set -o noclobber
no_exit_on_failed_exec shopt execfail
cdable_vars shopt cdable_vars
8. `ulimit' now sets both hard and soft limits and reports the soft limit
by default (when neither -H nor -S is specified). This is compatible
with versions of sh and ksh that implement `ulimit'. The bash-1.14
behavior of, for example,
ulimit -c 0
can be obtained with
ulimit -S -c 0
It may be useful to define an alias:
alias ulimit="ulimit -S"
9. Bash-2.01 uses a new quoting syntax, $'...' to do ANSI-C string
translation. Backslash-escaped characters in ... are expanded and
replaced as specified by the ANSI C standard.
10. The sourcing of startup files has changed somewhat. This is explained
more completely in the INVOCATION section of the manual page.
A non-interactive shell not named `sh' and not in posix mode reads
and executes commands from the file named by $BASH_ENV. A
non-interactive shell started by `su' and not in posix mode will read
startup files. No other non-interactive shells read any startup files.
An interactive shell started in posix mode reads and executes commands
from the file named by $ENV.
11. The <> redirection operator was changed to conform to the POSIX.2 spec.
In the absence of any file descriptor specification preceding the `<>',
file descriptor 0 is used. In bash-1.14, this was the behavior only
when in POSIX mode. The bash-1.14 behavior may be obtained with
<>filename 1>&0
12. The `alias' builtin now checks for invalid options and takes a `-p'
option to display output in POSIX mode. If you have old aliases beginning
with `-' or `+', you will have to add the `--' to the alias command
that declares them:
alias -x='chmod a-x' --> alias -- -x='chmod a-x'
13. The behavior of range specificiers within bracket matching expressions
in the pattern matcher (e.g., [A-Z]) depends on the current locale,
specifically the value of the LC_COLLATE environment variable. Setting
this variable to C or POSIX will result in the traditional ASCII behavior
for range comparisons. If the locale is set to something else, e.g.,
en_US (specified by the LANG or LC_ALL variables), collation order is
locale-dependent. For example, the en_US locale sorts the upper and
lower case letters like this:
AaBb...Zz
so a range specification like [A-Z] will match every letter except `z'.
Other locales collate like
aAbBcC...zZ
which means that [A-Z] matches every letter except `a'.
The portable way to specify upper case letters is [:upper:] instead of
A-Z; lower case may be specified as [:lower:] instead of a-z.
Look at the manual pages for setlocale(3), strcoll(3), and, if it is
present, locale(1).
You can find your current locale information by running locale(1):
caleb.ins.cwru.edu(2)$ locale
LANG=en_US
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_ALL=en_US
My advice is to put
export LC_COLLATE=C
into /etc/profile and inspect any shell scripts run from cron for
constructs like [A-Z]. This will prevent things like
rm [A-Z]*
from removing every file in the current directory except those beginning
with `z' and still allow individual users to change the collation order.
Users may put the above command into their own profiles as well, of course.
14. Bash versions up to 1.14.7 included an undocumented `-l' operator to
the `test/[' builtin. It was a unary operator that expanded to the
length of its string argument. This let you do things like
test -l $variable -lt 20
for example.
This was included for backwards compatibility with old versions of the
Bourne shell, which did not provide an easy way to obtain the length of
the value of a shell variable.
This operator is not part of the POSIX standard, because one can (and
should) use ${#variable} to get the length of a variable's value.
Bash-2.x does not support it.
15. Bash no longer auto-exports the HOME, PATH, SHELL, TERM, HOSTNAME,
HOSTTYPE, MACHTYPE, or OSTYPE variables. If they appear in the initial
environment, the export attribute will be set, but if bash provides a
default value, they will remain local to the current shell.
16. Bash no longer initializes the FUNCNAME, GROUPS, or DIRSTACK variables
to have special behavior if they appear in the initial environment.
17. Bash no longer removes the export attribute from the SSH_CLIENT or
SSH2_CLIENT variables, and no longer attempts to discover whether or
not it has been invoked by sshd in order to run the startup files.
18. Bash no longer requires that the body of a function be a group command;
any compound command is accepted.
19. As of bash-3.0, the pattern substitution operators no longer perform
quote removal on the pattern before attempting the match. This is the
way the pattern removal functions behave, and is more consistent.
20. After bash-3.0 was released, I reimplemented tilde expansion, incorporating
it into the mainline word expansion code. This fixes the bug that caused
the results of tilde expansion to be re-expanded. There is one
incompatibility: a ${paramOPword} expansion within double quotes will not
perform tilde expansion on WORD. This is consistent with the other
expansions, and what POSIX specifies.
21. A number of variables have the integer attribute by default, so the +=
assignment operator returns expected results: RANDOM, LINENO, MAILCHECK,
HISTCMD, OPTIND.
22. Bash-3.x is much stricter about $LINENO correctly reflecting the line
number in a script; assignments to LINENO have little effect.
23. By default, readline binds the terminal special characters to their
readline equivalents. As of bash-3.1/readline-5.1, this is optional and
controlled by the bind-tty-special-chars readline variable.
24. The \W prompt string expansion abbreviates $HOME as `~'. The previous
behavior is available with ${PWD##/*/}.
25. The arithmetic exponentiation operator is right-associative as of bash-3.1.
26. The rules concerning valid alias names are stricter, as per POSIX.2.
27. The Readline key binding functions now obey the convert-meta setting active
when the binding takes place, as the dispatch code does when characters
are read and processed.
28. The historical behavior of `trap' reverting signal disposition to the
original handling in the absence of a valid first argument is implemented
only if the first argument is a valid signal number.
29. In versions of bash after 3.1, the ${parameter//pattern/replacement}
expansion does not interpret `%' or `#' specially. Those anchors don't
have any real meaning when replacing every match.
30. Beginning with bash-3.1, the combination of posix mode and enabling the
`xpg_echo' option causes echo to ignore all options, not looking for `-n'
31. Beginning with bash-3.2, bash follows the Bourne-shell-style (and POSIX-
style) rules for parsing the contents of old-style backquoted command
substitutions. Previous versions of bash attempted to recursively parse
embedded quoted strings and shell constructs; bash-3.2 uses strict POSIX
rules to find the closing backquote and simply passes the contents of the
command substitution to a subshell for parsing and execution.
32. Beginning with bash-3.2, bash uses access(2) when executing primaries for
the test builtin and the [[ compound command, rather than looking at the
file permission bits obtained with stat(2). This obeys restrictions of
the file system (e.g., read-only or noexec mounts) not available via stat.
33. Bash-3.2 adopts the convention used by other string and pattern matching
operators for the `[[' compound command, and matches any quoted portion
of the right-hand-side argument to the =~ operator as a string rather
than a regular expression.
34. Bash-4.0 allows the behavior in the previous item to be modified using
the notion of a shell `compatibility level'. If the compat31 shopt
option is set, quoting the pattern has no special effect.
35. Bash-3.2 (patched) and Bash-4.0 fix a bug that leaves the shell in an
inconsistent internal state following an assignment error. One of the
changes means that compound commands or { ... } grouping commands are
aborted under some circumstances in which they previously were not.
This is what Posix specifies.
36. Bash-4.0 now allows process substitution constructs to pass unchanged
through brace expansion, so any expansion of the contents will have to be
separately specified, and each process substitution will have to be
separately entered.
37. Bash-4.0 now allows SIGCHLD to interrupt the wait builtin, as Posix
specifies, so the SIGCHLD trap is no longer always invoked once per
exiting child if you are using `wait' to wait for all children. As
of bash-4.2, this is the status quo only when in posix mode.
38. Since bash-4.0 now follows Posix rules for finding the closing delimiter
of a $() command substitution, it will not behave as previous versions
did, but will catch more syntax and parsing errors before spawning a
subshell to evaluate the command substitution.
39. The programmable completion code uses the same set of delimiting characters
as readline when breaking the command line into words, rather than the
set of shell metacharacters, so programmable completion and readline
should be more consistent.
40. When the read builtin times out, it attempts to assign any input read to
specified variables, which also causes variables to be set to the empty
string if there is not enough input. Previous versions discarded the
characters read.
41. Bash-4.0 changes the handling of the set -e option so that the shell exits
if a pipeline fails (and not just if the last command in the failing
pipeline is a simple command). This is not as Posix specifies. There is
work underway to update this portion of the standard; the bash-4.0
behavior attempts to capture the consensus at the time of release.
42. Bash-4.0 fixes a Posix mode bug that caused the . (source) builtin to
search the current directory for its filename argument, even if "." is
not in $PATH. Posix says that the shell shouldn't look in $PWD in this
case.
43. Bash-4.1 uses the current locale when comparing strings using the < and
> operators to the `[[' command. This can be reverted to the previous
behavior (ASCII collating and strcmp(3)) by setting one of the
`compatNN' shopt options, where NN is less than 41.
44. Bash-4.1 conforms to the current Posix specification for `set -u':
expansions of $@ and $* when there are no positional parameters do not
cause the shell to exit.
45. Bash-4.1 implements the current Posix specification for `set -e' and
exits when any command fails, not just a simple command or pipeline.
46. Command substitutions now remove the caller's trap strings when trap is
run to set a new trap in the subshell. Previous to bash-4.2, the old
trap strings persisted even though the actual signal handlers were reset.
47. When in Posix mode, a single quote is not treated specially in a
double-quoted ${...} expansion, unless the expansion operator is
# or % or the new `//', `^', or `,' expansions. In particular, it
does not define a new quoting context. This is from Posix interpretation
221.
48. Posix mode shells no longer exit if a variable assignment error occurs
with an assignment preceding a command that is not a special builtin.
49. Bash-4.2 attempts to preserve what the user typed when performing word
completion, instead of, for instance, expanding shell variable
references to their value.
50. When in Posix mode, bash-4.2 exits if the filename supplied as an argument
to `.' is not found and the shell is not interactive.
51. When compiled for strict Posix compatibility, bash-4.3 does not enable
history expansion by default in interactive shells, since it results in
a non-conforming environment.
52. Bash-4.3 runs the replacement string in the pattern substitution word
expansion through quote removal. The code already treats quote
characters in the replacement string as special; if it treats them as
special, then quote removal should remove them.
53. Bash-4.4 no longer considers a reference to ${a[@]} or ${a[*]}, where `a'
is an array without any elements set, to be a reference to an unset
variable. This means that such a reference will not cause the shell to
exit when the `-u' option is enabled.
54. Bash-4.4 allows double quotes to quote the history expansion character (!)
when in Posix mode, since Posix specifies the effects of double quotes.
55. Bash-4.4 does not inherit $PS4 from the environment if running as root.
56. Bash-4.4 doesn't allow a `break' or `continue' in a function to affect
loop execution in the calling context.
57. Bash-4.4 no longer expands tildes in $PATH elements when in Posix mode.
58. Bash-4.4 does not attempt to perform a compound array assignment if an
argument to `declare' or a similar builtin expands to a word that looks
like a compound array assignment (e.g. declare w=$x where x='(foo)').
59. Bash-5.0 only sets up BASH_ARGV and BASH_ARGC at startup if extended
debugging mode is active. The old behavior of unconditionally setting
BASH_ARGC and BASH_ARGV is available at compatibility levels less than
or equal to 44.
60. Bash-5.0 doesn't allow a `break' or `continue' in a subshell to attempt
to break or continue loop execution inherited from the calling context.
61. Bash-5.0 doesn't allow variable assignments preceding builtins like
export and readonly to modify variables with the same name in preceding
contexts (including the global context) unless the shell is in posix
mode, since export and readonly are special builtins.
62. Bash-5.1 changes the way posix-mode shells handle assignment statements
preceding shell function calls. Previous versions of POSIX specified that
such assignments would persist after the function returned; subsequent
versions of the standard removed that requirement (interpretation #654).
Bash-5.1 posix mode assignment statements preceding shell function calls
do not persist after the function returns.
63. Bash-5.1 reverts to the bash-4.4 treatment of pathname expansion of words
containing backslashes but no other special globbing characters. This comes
after a protracted discussion and a POSIX interpretation (#1234).
64. In bash-5.1, disabling posix mode attempts to restore the state of several
options that posix mode modifies to the state they had before enabling
posix mode. Previous versions restored these options to default values.
65. Bash-5.2 attempts to prevent double-expansion of array subscripts under
certain circumstances, especially arithmetic evaluation, by acting as if
the `assoc_expand_once' shell option were set.
66. The `unset' builtin in bash-5.2 treats array subscripts `@' and `*'
differently than previous versions, and differently depending on whether
the array is indexed or associative.
67. The `test' builtin in bash-5.3 treats parenthesized subexpressions when
given more than four arguments differently. It scans forward for a
closing paren and counts the number of arguments between the parens. If
there are four or fewer, it uses the posix test algorithm on the
subexpression.
68. The bind builtin's -p and -P options treat any arguments remaining after
option processing as bindable command names for which to print any key
bindings.
Shell Compatibility Level
=========================
Bash-4.0 introduced the concept of a `shell compatibility level', specified
as a set of options to the shopt builtin (compat31, compat32, compat40,
compat41, and so on). There is only one current compatibility level --
each option is mutually exclusive. The compatibility level is intended to
allow users to select behavior from previous versions that is incompatible
with newer versions while they migrate scripts to use current features and
behavior. It's intended to be a temporary solution.
This section does not mention behavior that is standard for a particular
version (e.g., setting compat32 means that quoting the rhs of the regexp
matching operator quotes special regexp characters in the word, which is
default behavior in bash-3.2 and above).
If a user enables, say, compat32, it may affect the behavior of other
compatibility levels up to and including the current compatibility level.
The idea is that each compatibility level controls behavior that changed in
that version of bash, but that behavior may have been present in earlier
versions. For instance, the change to use locale-based comparisons with
the `[[' command came in bash-4.1, and earlier versions used ASCII-based
comparisons, so enabling compat32 will enable ASCII-based comparisons as
well. That granularity may not be sufficient for all uses, and as a result
users should employ compatibility levels carefully. Read the documentation
for a particular feature to find out the current behavior.
Bash-4.3 introduced a new shell variable: BASH_COMPAT. The value assigned
to this variable (a decimal version number like 4.2, or an integer
corresponding to the compatNN option, like 42) determines the compatibility
level.
Starting with bash-4.4, bash has begun deprecating older compatibility
levels. Eventually, the options will be removed in favor of the
BASH_COMPAT variable.
Bash-5.0 is the final version for which there will be an individual shopt
option for the previous version. Users should use the BASH_COMPAT variable
on bash-5.0 and later versions.
The following table describes the behavior changes controlled by each
compatibility level setting. The `compatNN' tag is used as shorthand for
setting the compatibility level to NN using one of the following
mechanisms. For versions prior to bash-5.0, the compatibility level may be
set using the corresponding compatNN shopt option. For bash-4.3 and later
versions, the BASH_COMPAT variable is preferred, and it is required for
bash-5.1 and later versions.
compat31
- the < and > operators to the [[ command do not consider the current
locale when comparing strings; they use ASCII ordering
- quoting the rhs of the [[ command's regexp matching operator (=~)
has no special effect
compat32
- the < and > operators to the [[ command do not consider the current
locale when comparing strings; they use ASCII ordering
compat40
- the < and > operators to the [[ command do not consider the current
locale when comparing strings; they use ASCII ordering.
Bash versions prior to bash-4.1 use ASCII collation and strcmp(3);
bash-4.1 and later use the current locale's collation sequence and
strcoll(3).
compat41
- in posix mode, `time' may be followed by options and still be
recognized as a reserved word (this is POSIX interpretation 267)
- in posix mode, the parser requires that an even number of single
quotes occur in the `word' portion of a double-quoted ${...}
parameter expansion and treats them specially, so that characters
within the single quotes are considered quoted (this is POSIX
interpretation 221)
compat42
- the replacement string in double-quoted pattern substitution is not
run through quote removal, as it is in versions after bash-4.2
- in posix mode, single quotes are considered special when expanding
the `word' portion of a double-quoted ${...} parameter expansion
and can be used to quote a closing brace or other special character
(this is part of POSIX interpretation 221); in later versions,
single quotes are not special within double-quoted word expansions
compat43
- word expansion errors are considered non-fatal errors that cause the
current command to fail, even in posix mode (the default behavior is
to make them fatal errors that cause the shell to exit)
- when executing a shell function, the loop state (while/until/etc.)
is not reset, so `break' or `continue' in that function will break
or continue loops in the calling context. Bash-4.4 and later reset
the loop state to prevent this
compat44
- the shell sets up the values used by BASH_ARGV and BASH_ARGC so
they can expand to the shell's positional parameters even if extended
debug mode is not enabled
- a subshell inherits loops from its parent context, so `break'
or `continue' will cause the subshell to exit. Bash-5.0 and later
reset the loop state to prevent the exit
- variable assignments preceding builtins like export and readonly
that set attributes continue to affect variables with the same
name in the calling environment even if the shell is not in posix
mode
compat50 (set using BASH_COMPAT)
- Bash-5.1 changed the way $RANDOM is generated to introduce slightly
more randomness. If the shell compatibility level is set to 50 or
lower, it reverts to the method from bash-5.0 and previous versions,
so seeding the random number generator by assigning a value to
RANDOM will produce the same sequence as in bash-5.0
- If the command hash table is empty, bash versions prior to bash-5.1
printed an informational message to that effect even when writing
output in a format that can be reused as input (-l). Bash-5.1
suppresses that message if -l is supplied
- Bash-5.1 and later use pipes for here-documents and here-strings if
they are smaller than the pipe capacity. If the shell compatibility
level is set to 50 or lower, it reverts to using temporary files.
compat51 (set using BASH_COMPAT)
- The `unset' builtin will unset the array a given an argument like
`a[@]'. Bash-5.2 will unset an element with key `@' (associative
arrays) or remove all the elements without unsetting the array
(indexed arrays)
- arithmetic commands ( ((...)) ) and the expressions in an arithmetic
for statement can be expanded more than once
- expressions used as arguments to arithmetic operators in the [[
conditional command can be expanded more than once
- indexed and associative array subscripts used as arguments to the
operators in the [[ conditional command (e.g., `[[ -v') can be
expanded more than once. Bash-5.2 behaves as if the
`assoc_expand_once' option were enabled.
- the expressions in substring parameter brace expansion can be
expanded more than once
- the expressions in the $(( ... )) word expansion can be expanded
more than once
- arithmetic expressions used as indexed array subscripts can be
expanded more than once;
- `test -v', when given an argument of A[@], where A is an existing
associative array, will return true if the array has any set
elements. Bash-5.2 will look for a key named `@';
- the ${param[:]=value} word expansion will return VALUE, before any
variable-specific transformations have been performed (e.g.,
converting to lowercase). Bash-5.2 will return the final value
assigned to the variable, as POSIX specifies;
- Parsing command substitutions will act as if extended glob is
enabled, so that parsing a command substitution containing an extglob
pattern (say, as part of a shell function) will not fail. This
assumes the intent is to enable extglob before the command is
executed and word expansions are performed. It will fail at word
expansion time if extglob hasn't been enabled by the time the
command is executed.
compat52 (set using BASH_COMPAT)
- the test builtin uses its historical algorithm for parsing
expressions composed of five or more primaries.
- the -p and -P options to the bind builtin treat remaining arguments
as bindable command names for which to print any key bindings
-------------------------------------------------------------------------------
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty.
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
File diff suppressed because it is too large Load Diff
+111
View File
@@ -0,0 +1,111 @@
From chet@cwns1.INS.CWRU.Edu Sun Aug 26 17:46:14 1990
Flags: 50
Received: from cwns1.INS.CWRU.Edu by cwjcc.INS.CWRU.Edu with SMTP (5.61+ida+/CWRU-1.3-decnet)
id AA17813; Sun, 26 Aug 90 17:46:14 -0400 (from chet@cwns1.INS.CWRU.Edu for /usr/local/bin/m2mbox /usr/homes/chet/mbox)
Received: by cwns1.INS.CWRU.Edu (5.61+ida+/CWRU-1.3-client)
id AA00962; Sun, 26 Aug 90 17:46:31 -0400 (from chet for chet@cwjcc.INS.CWRU.Edu)
Date: Sun, 26 Aug 90 17:01:56 -0400
From: Chet Ramey <chet@cwns1.INS.CWRU.Edu>
To: trent@jove.cs.pdx.edu
Subject: Re: bash on triton
Cc: chet@cwns1.INS.CWRU.Edu
Reply-To: chet@po.CWRU.Edu
In-Reply-To: Message from trent@jove.cs.pdx.edu of Fri, 24 Aug 90 16:07:19 PDT
Message-Id: <9008262101.AA00902.SM@cwns1.INS.CWRU.Edu>
Read-Receipt-To: chet@po.CWRU.Edu
> Actually, it just that PSU gets the short end of the stick compared to
> the other state universities because we don't have a division I
> football team (no :-).
Yeah, but didn't you guys produce Neil Lomax (lo these many years ago)? What
have the other schools given the NFL lately?
> First thing I noticed is that this alias fails:
> alias .root=/usr/local/.root
> The error is:
> alias: .root: not a valid shell identifier
This is correct according to Posix 1003.2a draft 5. An alias must obey this
pseudo-regexp:
[a-zA-Z_][a-zA-Z0-9_]*
(That is, only letters, digits, and underscores, and it may not begin with an
underscore). This is in the latest version of the manual page, the one in
the documentation directory.
> Also it crashes when PROMPT_COMMAND is set, thus:
> bash$ PROMPT_COMMAND="A=`pwd`"
> bash$ # just hit return
> bash: free: Called with already freed block argument
I am sorting through this problem right now, and I've discovered a few things
(none complimentary to Sun).
First of all, this crash happens because Sun's programmers are lazy. The Sun
malloc allows you to free things multiple times, instead of doing the old
if (x)
free(x);
x = NULL;
trick. The Gnu malloc disallows that.
The root of this set of problems is that the Sun yyparse() is not reentrant
(`impure'). First of all, /usr/lib/yaccpar has changed a number of things
to be dynamically allocated that were once static arrays (the state stack
and the value stack are the two major ones). Second, some things that used
to be automatic variables to yyparse (like the state stack) are now
globally static variables in /usr/lib/yaccpar. This means no more
indirectly recursive calls to yyparse(). This is pure bogusness, and
breaks backwards compatibility in a major way.
The first indirect call to yyparse() occurs when PROMPT_COMMAND is run
through parse_and_execute() (parse.y, around line 1200). The next call to
yyparse() in your example (hitting return) returns quickly, putting nothing
onto the state stack. Of course, YYACCEPT doesn't check whether anything
was put into the stack; it just goes ahead and frees it anyway.
The next problem arises when PROMPT_COMMAND contains a backquoted command,
which is run through parse_and_execute() again. It doesn't matter that
this parse_and_execute is in a subshell; the data structures being built by
Sun's yacc come along for free when bash forks. The state stack gets all
screwed up and a segmentation fault is the inevitable result. If Sun (and,
I assume, AT&T, since the SCCS line at the top of /usr/lib/yaccpar
indicates that it is derived from S5R3.1) wants to do this kind of shit,
they should at least provide a convenience function to clear out the state
stack.
Both of these problems are avoided by using bison. I have put bison on
triton (you'll have to redo it if you want it; it looks for the parser
skeletons in /home/chet/lib), and a bash compiled with a bison-generated
parser does not crash given the above setting of PROMPT_COMMAND. That bash
is in /home/chet/bin. I don't know how to solve these problems in a
simple way by using the Sun yacc.
`Byacc' (Berkeley Yacc), the 4.4 BSD rewrite of Yacc by Bob Corbett (who
wrote the original version of bison), should also be OK, though I haven't
looked at it.
> That brings up something else: Triton is set up as a mail-less
> machine (all mail is forwarded elsewhere). Do you want your mail
> forwarded to CWSU?? Right now the bug reports Bash generates are
> vanishing. (I don't touch sendmail, and, from what I'm told, I'm
> better off that way :-)
(It's CWRU, by the way.)
Don't worry, I get them all. Look at the end of shell.c (make_bug_report)
where it opens a pipe to `/bin/rmail chet@ins.cwru.edu'.
Let me know of any more problems you encounter.
Chet
--
Chet Ramey ``Levi Stubbs' tears run down
Network Services Group his face...''
Case Western Reserve University
chet@ins.CWRU.Edu
+46
View File
@@ -0,0 +1,46 @@
From chet@odin.INS.CWRU.Edu Sat Apr 27 19:54:13 1991
Flags: 50
Received: from odin.INS.CWRU.Edu by usenet.INS.CWRU.Edu with SMTP (5.65b+ida+/CWRU-1.5-UUCPGW)
id AA05700; Sat, 27 Apr 91 19:54:13 -0400 (from chet@odin.INS.CWRU.Edu for /usr/local/bin/m2mbox /usr/homes/chet/mbox)
Received: by odin.INS.CWRU.Edu (5.65b+ida+/CWRU-1.4-ins)
id AA17732; Sat, 27 Apr 91 19:54:06 -0400 (from chet for chet@usenet.INS.CWRU.Edu)
Date: Sat, 27 Apr 91 19:31:16 -0400
From: Chet Ramey <chet@odin.INS.CWRU.Edu>
To: bfox@ai.mit.edu
Subject: Re: [pedz@aixwiz.austin.ibm.com: fd 9 left open bug]
Cc: chet@odin.INS.CWRU.Edu, pedz@aixwiz.austin.ibm.com
Reply-To: chet@po.CWRU.Edu
In-Reply-To: Message from bfox@bears.ece.ucsb.edu of Wed, 24 Apr 91 12:49:33 PDT
Message-Id: <9104272331.AA17706.SM@odin.INS.CWRU.Edu>
Read-Receipt-To: chet@po.CWRU.Edu
> Below is something I call Xemacs which goes across the net, sets up the
> display variable and then kicks off emacs in such a way that rshd
> terminates. The trick is that the shell must die and all file
> descriptors going back to rshd must be closed. The same basic script
> works with csh but I had to add in the "9>&-" part at the end to make
> it work with bash. This is because somehow, file descriptor 9 is left
> open and I guess it must be a dup of stdin, stdout, or stderr.
This is a bug alright, but it's a bug with rshd that's not fixed until
4.3-reno.
rshd sets up a pipe (int pv[2]; if you have the source to the tahoe rshd)
to the process it executes and uses it to manage error and control output
from over the net. In the child process, it does a dup2(pv[1], 2), but
never calls close(pv[1]). Adding that code to the 4.3-tahoe rshd makes it
(and the Xemacs script) work right.
I don't know how to solve this cleanly in bash. Doing a blanket close of
all open file descriptors < 2, < 20 is a no-no, especially when we're not
interactive. csh `works' because it does the blanket close on startup, but
csh can get away with doing that because it doesn't let you manipulate
arbitrary file descriptors.
Chet
--
Chet Ramey Internet: chet@po.CWRU.Edu
Case Western Reserve University NeXT Mail: chet@macbeth.INS.CWRU.Edu
``Now, somehow we've brought our sins back physically -- and they're pissed.''
+38
View File
@@ -0,0 +1,38 @@
From chet Thu Aug 13 10:42:35 1992
Flags: 50
Received: by odin.INS.CWRU.Edu (5.65b+ida+/CWRU-1.5-ins)
id AA07004; Thu, 13 Aug 92 10:42:35 -0400 (from chet for /usr/homes/chet/bin/mailfilter.sh /usr/homes/chet/mbox)
Date: Thu, 13 Aug 1992 10:34:47 -0400
From: Chet Ramey <chet@odin.INS.CWRU.Edu>
To: przemek@rrdstrad.nist.gov
Subject: Re: output of background jobs in BASH
Cc: bug-bash@prep.ai.mit.edu, chet
Reply-To: chet@po.CWRU.Edu
In-Reply-To: Message from przemek@rrdstrad.nist.gov of 12 Aug 92 18:15:53 GMT
Message-Id: <9208131434.AA00639.SM@odin.INS.CWRU.Edu>
Read-Receipt-To: chet@po.CWRU.Edu
> I believe that this changed when I installed bash 1.12: when I put a job that
> prints on stdout in background (^Z/bg or directly by &), the output comes out
> staggered, as if the CR wasn't being added to the LF at the end of the lines.
This is a result of bash using the BSD-style tty driver on Ultrix. The BSD
driver ties input and output carriage return translation together with the
CRMOD bit. (The CRMOD bit causes CR->LF translation on input and LF->CRLF
translation on output.) Unless the CRMOD bit is cleared, it is impossible
to get a literal ^M in an input line. Unfortunately, one of the effects of
clearing it is the loss of output processing you've observed.
The Ultrix Posix-style tty driver can't be used because it has serious
problems with losing typeahead when ICANON is switched on and off. These
characters seem to reappear later without warning, usually when a
program that uses the BSD-style ioctls turns on CBREAK (e.g., `more').
Chet
--
``The use of history as therapy means the corruption of history as history.''
-- Arthur Schlesinger
Chet Ramey, Case Western Reserve University Internet: chet@po.CWRU.Edu
@@ -0,0 +1,3 @@
The HP/UX manual page for ulimit(2) reports that ulimit(1, 0L) will return
the maximum file size in terms of 512-byte blocks. It lies, at least on
HP/UX 6.5; the number of bytes is returned.
+137
View File
@@ -0,0 +1,137 @@
Article 7946 of comp.unix.sysv386:
Newsgroups: comp.unix.sysv386
Path: usenet.ins.cwru.edu!agate!stanford.edu!snorkelwacker.mit.edu!think.com!zaphod.mps.ohio-state.edu!rpi!batcomputer!cornell!rochester!lubkin
From: lubkin@cs.rochester.edu (Saul Lubkin)
Subject: Binary patch to os.o fixes POSIX panics using VP/ix with job controlled bash
Message-ID: <1991Apr30.034006.24056@cs.rochester.edu>
Organization: Computer Science Department University of Rochester
Date: Tue, 30 Apr 1991 03:40:06 GMT
Recently, Uwe Doering posted the following article:
Article 6891 of comp.unix.sysv386:
Path: nancy!uunet!math.fu-berlin.de!fub!geminix.in-berlin.de!gemini
From: gemini@geminix.in-berlin.de (Uwe Doering)
Newsgroups: comp.unix.sysv386
Subject: Re: NAMEI panic - trap "E", address and info follows (+ patch)
Message-ID: <KYXPX2E@geminix.in-berlin.de>
Date: 13 Apr 91 00:55:41 GMT
References: <1991Apr10.040146.645@ddsw1.MCS.COM>
Organization: Private UNIX Site
Lines: 92
karl@ddsw1.MCS.COM (Karl Denninger) writes:
>Is anyone else having problems with a "namei" panic in ISC 2.2 (with NFS,
>the NFS/lockd patches, and POSIX patches applied)?
>
>I have been getting these nearly daily. Trap type "E", address is d007962f.
>That's right near the end of "namei"; here's the relavent line from a "nm"
>on the kernel:
>
>namei |0xd007919c|extern| *struct( )|0x0608| |.text
>
>Needless to say, I am most displeased with the crashes!
>
>Near as I can determine, the hardware is fine.
>
>All pointers or ideas appreciated...
I found this bug a few days ago and was about to send a bug report
to ISC. The problem is "simply" a NULL pointer reference in the
namei() function. The machine I found this on runs ISC 2.21 with
the security fix installed. I fixed this bug with a binary patch. It
is for the module /etc/conf/pack.d/kernel/os.o. I disassembled the
original and then the fixed version of os.o and ran a context diff
over the output. Depending on what version of the kernel config kit
you have the addresses might be off some bytes. You can apply this
patch with every binary file editor.
***************
*** 35349,35364 ****
[%al,%al]
cf71: 74 1e je 0x1e <cf91>
[0xcf91]
! cf73: 0f b7 07 movzwl (%edi),%eax
[%edi,%eax]
! cf76: 3d 11 00 00 00 cmpl $0x11,%eax
[$0x11,%eax]
! cf7b: 74 14 je 0x14 <cf91>
[0xcf91]
! cf7d: c7 45 e8 00 00 00 00 movl $0x0,0xe8(%ebp)
! [$0x0,-24+%ebp]
! cf84: eb 19 jmp 0x19 <cf9f>
! [0xcf9f]
cf86: 90 nop
[]
cf87: 90 nop
--- 35349,35372 ----
[%al,%al]
cf71: 74 1e je 0x1e <cf91>
[0xcf91]
! cf73: 85 ff testl %edi,%edi
! [%edi,%edi]
! cf75: 74 1a je 0x1a <cf91>
! [0xcf91]
! cf77: 0f b7 07 movzwl (%edi),%eax
[%edi,%eax]
! cf7a: 3d 11 00 00 00 cmpl $0x11,%eax
[$0x11,%eax]
! cf7f: 74 10 je 0x10 <cf91>
[0xcf91]
! cf81: eb 15 jmp 0x15 <cf98>
! [0xcf98]
! cf83: 90 nop
! []
! cf84: 90 nop
! []
! cf85: 90 nop
! []
cf86: 90 nop
[]
cf87: 90 nop
I'm not absolutely sure whether the action that is now taken in case of
a NULL pointer is the right one, but I haven't noticed any problems,
and most important, there are no more kernel panics! At least not from
that spot. :-) The action that is taken if the pointer in _not_ NULL
hasn't changed (this is not very obvious from the patch, but look
in the disassembler listing of your own kernel for more details).
I use this modified kernel for over a week now and it works for
me. Of course, as always, I can't give you any guaranty that this
patch does something useful on your machine. :-)
Hope this helps you.
Uwe
PS: ISC, if you see this posting, could you drop me a note on whether
you have put this on your to-do list? This would save me the time
needed to file an official bug report.
--
Uwe Doering | INET : gemini@geminix.in-berlin.de
Berlin |----------------------------------------------------------------
Germany | UUCP : ...!unido!fub!geminix.in-berlin.de!gemini
=======================================================================
Here is a copy of my recent note to Uwe:
I've applied the binary patch that you recently poosted to comp.unix.sysv386
for os.o.
It works beautifully. Previously, I had compiled bash1.07CWRU, and it worked
well (using POSIX job control), job control and all -- but running VP/ix under
this bash caused a system panic. This evidently is the (now infamous) "POSIX
namei bug". After rebuilding the kernel with a patched os.o, the problem
simply disappeared. VP/ix, like everything else, now works fine under
bash1.07CWRU.
Yours sincerely,
Saul Lubkin
@@ -0,0 +1,63 @@
From chet@odin.INS.CWRU.Edu Thu Mar 7 19:16:25 1991
Flags: 50
Received: from odin.INS.CWRU.Edu by usenet.INS.CWRU.Edu with SMTP (5.61+ida+/CWRU-1.4-UUCPGW)
id AA00967; Thu, 7 Mar 91 19:16:25 -0500 (from chet@odin.INS.CWRU.Edu for /usr/local/bin/m2mbox /usr/homes/chet/mbox)
Received: by odin.INS.CWRU.Edu (5.65+ida+/CWRU-1.4-ins)
id AA04437; Thu, 7 Mar 91 19:15:31 -0500 (from chet for chet@usenet.INS.CWRU.Edu)
Date: Thu, 7 Mar 91 19:10:00 -0500
From: Chet Ramey <chet@odin.INS.CWRU.Edu>
To: jacob@blackbox.gore.com
Subject: Re: Library function redefinition
Cc: chet@odin.INS.CWRU.Edu, bfox@ai.mit.edu
Reply-To: chet@po.CWRU.Edu
In-Reply-To: Message from jacob@blackbox.gore.com of Sun, 3 Mar 91 19:18:54 MST
Message-Id: <9103080010.AA04427.SM@odin.INS.CWRU.Edu>
Read-Receipt-To: chet@po.CWRU.Edu
> Now that you're working on bash for NeXT, let me ask you if you've run into
> this bug under 2.0: bash, as a login shell, hangs on rlogin into the NeXT.
> But it works fine on telnet. On rlogin, I even get no output to stdout
> from the 'tset' (or debugging 'echo's) in my startup files.
It's getting stuck in initialize_jobs (). There is a bug in the NeXT
/usr/etc/rlogind that causes bash to be started with the terminal still
belonging to the rlogind process, and its process group set to 0 (so
that getpgrp() returns 0 (!)). It looks like there's a stray setpgrp(0, 0)
in the rlogind code that NeXT is not handling like 4.3 BSD.
(Another bug that I've found with NeXT 2.0 is that Terminal starts up the
shell underneath it with argc == 0 and argv[0] = "-". Not polite.
`mount -vat nfs' seems to be broken too. Any more good ones I should look
for?)
Here's a diff to jobs.c to work around it. Your line numbers will certainly
vary (for all I know, the code might, too).
Chet
*** jobs.c~ Tue Mar 5 17:41:00 1991
--- jobs.c Thu Mar 7 18:50:12 1991
***************
*** 1839,1842 ****
--- 1839,1852 ----
}
+ #if defined (NeXT)
+ /* This is to compensate for a bug in the NeXT 2.0 /usr/etc/rlogind. */
+ if (shell_pgrp == 0)
+ {
+ shell_pgrp = getpid ();
+ setpgid (0, shell_pgrp);
+ tcsetpgrp (shell_tty, shell_pgrp);
+ }
+ #endif /* NeXT */
+
while ((terminal_pgrp = tcgetpgrp (shell_tty)) != -1)
{
--
Chet Ramey ``Now, somehow we've brought our sins
Network Services Group back physically -- and they're
Case Western Reserve University pissed.''
chet@ins.CWRU.Edu My opinions are just those, and mine alone.
+57
View File
@@ -0,0 +1,57 @@
From gnulists@ai.mit.edu Mon Feb 22 20:41:24 1993
Flags: 50
Received: from po.CWRU.Edu by odin.INS.CWRU.Edu with SMTP (5.65b+ida+/CWRU-1.5.4-ins)
id AA17713; Mon, 22 Feb 93 20:41:24 -0500 (from gnulists@ai.mit.edu for /usr/homes/chet/bin/mailfilter.sh /usr/homes/chet/mbox)
Return-Path: <gnulists@ai.mit.edu>
Received: from life.ai.mit.edu by po.CWRU.Edu with SMTP (5.65b+ida+/CWRU-1.9)
id AA29616; Mon, 22 Feb 93 20:41:17 -0500 (from gnulists@ai.mit.edu for chet@odin.INS.CWRU.Edu)
Received: from raisin-nut (raisin-nut.ai.mit.edu) by life.ai.mit.edu (4.1/AI-4.10) id AA01858; Mon, 22 Feb 93 20:40:47 EST
Received: by raisin-nut (4.1/AI-4.10) id AA06708; Mon, 22 Feb 93 20:40:46 EST
Resent-Date: Mon, 22 Feb 1993 13:29:57 -0500
Resent-Message-Id: <9302230140.AA06708@raisin-nut>
Received: from odin.INS.CWRU.Edu by life.ai.mit.edu (4.1/AI-4.10) id AA19283; Mon, 22 Feb 93 13:36:48 EST
Received: by odin.INS.CWRU.Edu (5.65b+ida+/CWRU-1.5.4-ins)
id AA27765; Mon, 22 Feb 93 13:36:44 -0500 (from chet for bug-bash@prep.ai.mit.edu)
Date: Mon, 22 Feb 1993 13:29:57 -0500
From: Chet Ramey <chet@odin.ins.cwru.edu>
Sender: gnulists@ai.mit.edu
To: pat@bcserv.wustl.edu
Subject: Re: bash for SCO Unix 3.2.2/4
Cc: bug-bash@prep.ai.mit.edu, chet@odin.ins.cwru.edu
Reply-To: chet@po.cwru.edu
In-Reply-To: Message from pat@bcserv.wustl.edu of 22 Feb 93 06:23:34 GMT (id <pat.730362214@bcserv>)
Message-Id: <9302221829.AA27553.SM@odin.INS.CWRU.Edu>
Read-Receipt-To: chet@po.CWRU.Edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Resent-From: bug-bash-request@prep.ai.mit.edu
> I've had no luck making either bash-1.11 or bash-1.12 for
> SCO Unix v 3.2.2 or 3.2.4...
>
> bash-1.12 says (specifically) that it's making for 3.2.2, but
> still has problems.
>
> It locks up after a few commnds...
>
> I don't have GCC right now, so I did have to tell it that I don't
> have 'alloca' by undefining it in machines.h - if that could be a problem.
You can't run bash-1.12 on a 3.2.4 system if it's been compiled on a
3.2.2 system. Bash contains a fix for the broken sigsuspend in 3.2.2
that breaks bash on 3.2.4, because 3.2.4 has the bug fixed.
Bash 1.12 should build and run OK out of the box on 3.2.2. For 3.2.4
you need to locate the code at around line 1250 of jobs.c and change
#if !defined (SCO) to #if 1 so that sigsuspend is used. Then take out
the SCO defines in flush_child().
Chet
--
``The use of history as therapy means the corruption of history as history.''
-- Arthur Schlesinger
Chet Ramey, Case Western Reserve University Internet: chet@po.CWRU.Edu
@@ -0,0 +1,28 @@
From chet@odin.INS.CWRU.Edu Fri May 3 17:22:41 1991
Flags: 50
Received: from odin.INS.CWRU.Edu by usenet.INS.CWRU.Edu with SMTP (5.65b+ida+/CWRU-1.5-UUCPGW)
id AA22515; Fri, 3 May 91 17:22:41 -0400 (from chet@odin.INS.CWRU.Edu for /usr/local/bin/m2mbox /usr/homes/chet/mbox)
Received: by odin.INS.CWRU.Edu (5.65b+ida+/CWRU-1.4-ins)
id AA07171; Fri, 3 May 91 17:22:21 -0400 (from chet for chet@usenet.INS.CWRU.Edu)
Date: Fri, 3 May 91 17:18:03 -0400
From: Chet Ramey <chet@odin.INS.CWRU.Edu>
To: jp@lysator.liu.se
Subject: fixed sequent bug
Cc: chet@odin.INS.CWRU.Edu
Reply-To: chet@po.CWRU.Edu
Message-Id: <9105032118.AA07167.SM@odin.INS.CWRU.Edu>
Read-Receipt-To: chet@po.CWRU.Edu
I fixed it. Sequent's fcntl and dup2 are both messed up. They do not set
the new descriptor to be open-on-exec. For dup2 it's OK; that's the way
4.2 BSD did it. fcntl doing it is a bug, and a bad one.
Chet
--
Chet Ramey Internet: chet@po.CWRU.Edu
Case Western Reserve University NeXT Mail: chet@macbeth.INS.CWRU.Edu
``Now, somehow we've brought our sins back physically -- and they're pissed.''
+52
View File
@@ -0,0 +1,52 @@
From chet Mon Jul 27 14:54:45 1992
Flags: 50
Received: by odin.INS.CWRU.Edu (5.65b+ida+/CWRU-1.5-ins)
id AA15494; Mon, 27 Jul 92 14:54:45 -0400 (from chet for /usr/homes/chet/bin/mailfilter.sh /usr/homes/chet/mbox)
Date: Mon, 27 Jul 1992 14:29:55 -0400
From: Chet Ramey <chet@odin.INS.CWRU.Edu>
To: stud7b43@x400gate.bnr.ca
Subject: Re: Bug in Bash 1.12.1
Cc: bug-bash@ai.mit.edu, chet
Reply-To: chet@po.CWRU.Edu
In-Reply-To: Message from stud7b43@x400gate.bnr.ca of Mon, 27 Jul 1992 12:30:00 +0000
Message-Id: <9207271829.AA14484.SM@odin.INS.CWRU.Edu>
Read-Receipt-To: chet@po.CWRU.Edu
> I seem to have found a bug in Bash.
>
> How to cause the bug to appear:
> 1) Start a long username-completion, e.g.
> cat ~user<TAB>
> Let it run for a while (don't know exactly how long...)
> Before it's finished, hit ^C (or whatever the break character
> is set to)
> 2) As the next command, run a filename completion with a username in it, eg.
> cat ~username/.log<TAB>
>
> Error message: "free: Called with already freed block argument
This is a bug in the Sun YP code that everyone seems to have picked up.
Sun keeps static state in the YP library code -- a pointer into the
data returned from the server. When YP initializes itself (setpwent),
it looks at this pointer and calls free on it if it's non-null. So far,
so good.
If one of the YP functions is interrupted during getpwent (the exact function
is interpretwithsave()), and returns NULL, the pointer is freed without being
reset to NULL, and the function returns. The next time getpwent is called,
it sees that this pointer is non-null, calls free, and the Gnu free()
blows up because it's being asked to free freed memory.
The traditional Unix mallocs allow memory to be freed multiple times; that's
probably why this has never been fixed. You can probably stop it by adding
an #undef USE_GNU_MALLOC to the appropriate machine description in machines.h.
Chet
--
``The use of history as therapy means the corruption of history as history.''
-- Arthur Schlesinger
Chet Ramey, Case Western Reserve University Internet: chet@po.CWRU.Edu
+74
View File
@@ -0,0 +1,74 @@
From chet@odin.INS.CWRU.Edu Fri Dec 21 10:56:27 1990
Flags: 50
Received: from odin.INS.CWRU.Edu by usenet.INS.CWRU.Edu with SMTP (5.61+ida+/CWRU-1.3-UUCPGW)
id AA27089; Fri, 21 Dec 90 10:56:27 -0500 (from chet@odin.INS.CWRU.Edu for /usr/local/bin/m2mbox.test /usr/homes/chet/mbox)
Received: by odin.INS.CWRU.Edu (5.61+ida+/CWRU-1.4-ins)
id AA17558; Fri, 21 Dec 90 10:56:18 -0500 (from chet for chet@usenet.INS.CWRU.Edu)
Date: Fri, 21 Dec 90 10:36:58 -0500
From: Chet Ramey <chet@odin.ins.cwru.edu>
To: dbrooks@osf.org
Subject: Re: bash and OSF/1
Cc: chet@odin.INS.CWRU.Edu
Reply-To: chet@po.CWRU.Edu
In-Reply-To: Message from dbrooks@osf.org of Fri, 21 Dec 90 10:28:26 EST
Message-Id: <9012211536.AA17531.SM@odin.ins.cwru.edu>
Read-Receipt-To: chet@po.CWRU.Edu
> Michael Meissner has been suddenly asked to do Real Work (TM) so it's
> unlikely he'll get to do anything with OSF/1 until the new year. We
> talked about it, however, and there are a few issues.
Not (gasp) Real Work!
> The upshot of the above is: expect a block of #defines based on
> __OSF1__, and expect it possibly not to work under all
> implementations.
Works for me.
> I have two new bugs for you in 1.06.
>
> - Typeahead is very weird. Often, I will be in a state where a
> command is busy, and I type a new one. The shell prompts and
> nothing happens; I have to type the line again. Later, if I enter
> an interactive command (such as "mail") the missing keystrokes get
> delivered to it instead. This is on a pmax, Ultrix 3.1, with some
> patches of my own and Michael's fignore patch (that may have caused
> it; I haven't investigated yet. Just wanted to see if this rang a bell.)
Typeahead under Ultrix is wierd. This doesn't happen anywhere else. Here's
what it does for me:
cwjcc$ sleep 4
echo hi ; echo hi <----- typeahead while sleeping
cwjcc$ <----- nothing comes out
cwjcc$ more readline.c
readline.c: No such file or directory
cwjcc$ echo hi ; echo hi <----- now it does...
hi
hi
I'll look at it today.
> - The sequence
> echo foo > /dev/tty
> cat bar
> produces:
> cat: write error: Bad file number
This only happens under Ultrix, too. It's another consequence of Dec's
dup2 fuckup (I am *really*pissed*off* about it; it's caused me to waste a
lot of time already). File descriptor 1 is getting set to close-on-exec.
I haven't decided whether to hack around it in the code or to just make
Ultrix use the dup2 emulation in general.c.
Cheers,
Chet
--
Chet Ramey ``I die, Horatio''
Network Services Group, Case Western Reserve University
chet@ins.CWRU.Edu
My opinions are just those, and mine alone.
+20
View File
@@ -0,0 +1,20 @@
Contents of this directory:
changelog - my change log since the last release
POSIX.NOTES - list of what changes for `posix mode'
README - this file
misc - directory with some useful tools
The following are distributed `as-is'. They will not apply without some
modification.
sh-redir-hack - diff to parse.y to get redirections before
compound commands
empty-for-wordlist - diff to parse.y to allow an empty wordlist after
the `in' keyword in a `for' statement
mh-folder-comp - diffs that reportedly add MH folder completion
+339
View File
@@ -0,0 +1,339 @@
Date: Tue, 06 Feb 2007 16:06:58 -0500
From: Steve Grubb <sgrubb@redhat.com>
Subject: Re: bash and linux audit
To: chet.ramey@case.edu
Organization: Red Hat
OK, I released audit 1.4 Sunday which has the logging function for user
commands. It produces audit events like this:
type=USER_CMD msg=audit(01/30/2007 18:23:45.793:143) : user pid=22862 uid=root
auid=root subj=system_u:system_r:unconfined_t:s0-s0:c0.c1023
msg='cwd=/root/test dir cmd=ls -l (terminal=tty1 res=success)'
diff -urp bash-3.2.orig/config-bot.h bash-3.2/config-bot.h
--- bash-3.2.orig/config-bot.h 2007-01-03 09:01:05.000000000 -0500
+++ bash-3.2/config-bot.h 2007-01-20 11:59:23.000000000 -0500
@@ -97,6 +97,11 @@
# define RESTRICTED_SHELL_NAME "rbash"
#endif
+/* If the shell is called by this name, it will become audited. */
+#if defined (AUDIT_SHELL)
+# define AUDIT_SHELL_NAME "aubash"
+#endif
+
/***********************************************************/
/* Make sure feature defines have necessary prerequisites. */
/***********************************************************/
diff -urp bash-3.2.orig/config.h.in bash-3.2/config.h.in
--- bash-3.2.orig/config.h.in 2007-01-03 09:01:05.000000000 -0500
+++ bash-3.2/config.h.in 2007-01-20 11:59:23.000000000 -0500
@@ -81,6 +81,11 @@
flag. */
#undef RESTRICTED_SHELL
+/* Define AUDIT_SHELL if you want the generated shell to audit all
+ actions performed by root account. The shell thus generated can become
+ audited by being run with the name "aubash". */
+#undef AUDIT_SHELL
+
/* Define DISABLED_BUILTINS if you want "builtin foo" to always run the
shell builtin "foo", even if it has been disabled with "enable -n foo". */
#undef DISABLED_BUILTINS
diff -urp bash-3.2.orig/configure.in bash-3.2/configure.in
--- bash-3.2.orig/configure.in 2007-01-03 09:01:05.000000000 -0500
+++ bash-3.2/configure.in 2007-01-20 11:59:23.000000000 -0500
@@ -162,6 +162,7 @@ opt_history=yes
opt_bang_history=yes
opt_dirstack=yes
opt_restricted=yes
+opt_audit=yes
opt_process_subst=yes
opt_prompt_decoding=yes
opt_select=yes
@@ -195,8 +196,8 @@ dnl a minimal configuration turns everyt
dnl added individually
if test $opt_minimal_config = yes; then
opt_job_control=no opt_alias=no opt_readline=no
- opt_history=no opt_bang_history=no opt_dirstack=no
- opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
+ opt_history=no opt_bang_history=no opt_dirstack=no opt_restricted=no
+ opt_audit=no opt_process_subst=no opt_prompt_decoding=no
opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no
@@ -227,6 +228,7 @@ AC_ARG_ENABLE(progcomp, AC_HELP_STRING([
AC_ARG_ENABLE(prompt-string-decoding, AC_HELP_STRING([--enable-prompt-string-decoding], [turn on escape character decoding in prompts]), opt_prompt_decoding=$enableval)
AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [turn on command line editing]), opt_readline=$enableval)
AC_ARG_ENABLE(restricted, AC_HELP_STRING([--enable-restricted], [enable a restricted shell]), opt_restricted=$enableval)
+AC_ARG_ENABLE(audit, AC_HELP_STRING([--enable-audit], [enable an audited shell]), opt_audit=$enableval)
AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select], [include select command]), opt_select=$enableval)
AC_ARG_ENABLE(separate-helpfiles, AC_HELP_STRING([--enable-separate-helpfiles], [use external files for help builtin documentation]), opt_separate_help=$enableval)
AC_ARG_ENABLE(single-help-strings, AC_HELP_STRING([--enable-single-help-strings], [store help documentation as a single string to ease translation]), opt_single_longdoc_strings=$enableval)
@@ -254,6 +256,10 @@ fi
if test $opt_restricted = yes; then
AC_DEFINE(RESTRICTED_SHELL)
fi
+if test $opt_audit = yes; then
+AC_DEFINE(AUDIT_SHELL)
+AUDIT_LIB='-laudit'
+fi
if test $opt_process_subst = yes; then
AC_DEFINE(PROCESS_SUBSTITUTION)
fi
@@ -355,6 +361,8 @@ AC_SUBST(HELPDIRDEFINE)
AC_SUBST(HELPINSTALL)
AC_SUBST(HELPSTRINGS)
+AC_SUBST(AUDIT_LIB)
+
echo ""
echo "Beginning configuration for bash-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}"
echo ""
diff -urp bash-3.2.orig/doc/bash.1 bash-3.2/doc/bash.1
--- bash-3.2.orig/doc/bash.1 2007-01-03 09:01:05.000000000 -0500
+++ bash-3.2/doc/bash.1 2007-01-20 11:59:23.000000000 -0500
@@ -155,6 +155,12 @@ single-character options to be recognize
.PP
.PD 0
.TP
+.B \-\-audit
+The shell logs all commands run by the root user (see
+.SM
+.B "AUDIT SHELL"
+below).
+.TP
.B \-\-debugger
Arrange for the debugger profile to be executed before the shell
starts.
@@ -8770,6 +8776,17 @@ turns off any restrictions in the shell
script.
.\" end of rbash.1
.if \n(zY=1 .ig zY
+.SH "AUDIT SHELL"
+.zY
+.PP
+If
+.B bash
+is started with the name
+.BR aubash ,
+or the
+.B \-\-audit
+option is supplied at invocation, the shell logs all commands issued by the root user to the audit system.
+.if \n(zY=1 .ig zY
.SH "SEE ALSO"
.PD 0
.TP
diff -urp bash-3.2.orig/eval.c bash-3.2/eval.c
--- bash-3.2.orig/eval.c 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/eval.c 2007-01-20 11:59:23.000000000 -0500
@@ -45,6 +45,11 @@
# include "bashhist.h"
#endif
+#if defined (AUDIT_SHELL)
+# include <libaudit.h>
+# include <errno.h>
+#endif
+
extern int EOF_reached;
extern int indirection_level;
extern int posixly_correct;
@@ -58,6 +63,38 @@ extern int rpm_requires;
static void send_pwd_to_eterm __P((void));
static sighandler alrm_catcher __P((int));
+#if defined (AUDIT_SHELL)
+static int audit_fd = -1;
+
+static int
+audit_start ()
+{
+ audit_fd = audit_open ();
+ if (audit_fd < 0)
+ return -1;
+ else
+ return 0;
+}
+
+static int
+audit (cmd, result)
+ char *cmd;
+ int result;
+{
+ int rc;
+
+ if (audit_fd < 0)
+ return 0;
+
+ rc = audit_log_user_command (audit_fd, AUDIT_USER_CMD, cmd,
+ NULL, !result);
+ close (audit_fd);
+ audit_fd = -1;
+ return rc;
+}
+#endif
+
+
/* Read and execute commands until EOF is reached. This assumes that
the input source has already been initialized. */
int
@@ -145,7 +182,25 @@ reader_loop ()
executing = 1;
stdin_redir = 0;
+#if defined (AUDIT_SHELL)
+ if (audited && interactive_shell && getuid () == 0)
+ {
+ if (audit_start () < 0)
+ {
+ if (errno != EINVAL && errno != EPROTONOSUPPORT &&
+ errno != EAFNOSUPPORT)
+ return EXECUTION_FAILURE;
+ }
+ }
+#endif
+
execute_command (current_command);
+#if defined (AUDIT_SHELL)
+ {
+ extern char *shell_input_line;
+ audit (shell_input_line, last_command_exit_value);
+ }
+#endif
exec_done:
QUIT;
diff -urp bash-3.2.orig/externs.h bash-3.2/externs.h
--- bash-3.2.orig/externs.h 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/externs.h 2007-01-20 12:05:00.000000000 -0500
@@ -77,6 +77,10 @@ extern int shell_is_restricted __P((char
extern int maybe_make_restricted __P((char *));
#endif
+#if defined (AUDIT_SHELL)
+extern int maybe_make_audited __P((char *));
+#endif
+
extern void unset_bash_input __P((int));
extern void get_current_user_info __P((void));
diff -urp bash-3.2.orig/flags.c bash-3.2/flags.c
--- bash-3.2.orig/flags.c 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/flags.c 2007-01-20 11:59:23.000000000 -0500
@@ -142,6 +142,12 @@ int restricted = 0; /* currently restri
int restricted_shell = 0; /* shell was started in restricted mode. */
#endif /* RESTRICTED_SHELL */
+#if defined (AUDIT_SHELL)
+/* Non-zero means that this shell is audited. An audited shell records
+ each command that the root user executes. */
+int audited = 0; /* shell was started in audit mode. */
+#endif /* AUDIT_SHELL */
+
/* Non-zero means that this shell is running in `privileged' mode. This
is required if the shell is to run setuid. If the `-p' option is
not supplied at startup, and the real and effective uids or gids
diff -urp bash-3.2.orig/flags.h bash-3.2/flags.h
--- bash-3.2.orig/flags.h 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/flags.h 2007-01-20 11:59:23.000000000 -0500
@@ -66,6 +66,10 @@ extern int restricted;
extern int restricted_shell;
#endif /* RESTRICTED_SHELL */
+#if defined (AUDIT_SHELL)
+extern int audited;
+#endif /* AUDIT_SHELL */
+
extern int *find_flag __P((int));
extern int change_flag __P((int, int));
extern char *which_set_flags __P((void));
Only in bash-3.2: .made
diff -urp bash-3.2.orig/Makefile.in bash-3.2/Makefile.in
--- bash-3.2.orig/Makefile.in 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/Makefile.in 2007-01-20 11:59:23.000000000 -0500
@@ -366,6 +366,8 @@ MALLOC_LIBRARY = @MALLOC_LIBRARY@
MALLOC_LDFLAGS = @MALLOC_LDFLAGS@
MALLOC_DEP = @MALLOC_DEP@
+AUDIT_LIB = @AUDIT_LIB@
+
ALLOC_HEADERS = $(ALLOC_LIBSRC)/getpagesize.h $(ALLOC_LIBSRC)/shmalloc.h \
$(ALLOC_LIBSRC)/imalloc.h $(ALLOC_LIBSRC)/mstats.h \
$(ALLOC_LIBSRC)/table.h $(ALLOC_LIBSRC)/watch.h
@@ -386,7 +388,7 @@ BASHINCFILES = $(BASHINCDIR)/posixstat.
$(BASHINCDIR)/ocache.h
LIBRARIES = $(SHLIB_LIB) $(READLINE_LIB) $(HISTORY_LIB) $(TERMCAP_LIB) $(GLOB_LIB) \
- $(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) $(LOCAL_LIBS)
+ $(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) $(LOCAL_LIBS) $(AUDIT_LIB)
LIBDEP = $(SHLIB_DEP) $(INTL_DEP) $(READLINE_DEP) $(HISTORY_DEP) $(TERMCAP_DEP) $(GLOB_DEP) \
$(TILDE_DEP) $(MALLOC_DEP)
diff -urp bash-3.2.orig/parse.y bash-3.2/parse.y
--- bash-3.2.orig/parse.y 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/parse.y 2007-01-20 11:59:23.000000000 -0500
@@ -258,7 +258,7 @@ int need_here_doc;
/* Where shell input comes from. History expansion is performed on each
line when the shell is interactive. */
-static char *shell_input_line = (char *)NULL;
+char *shell_input_line = (char *)NULL;
static int shell_input_line_index;
static int shell_input_line_size; /* Amount allocated for shell_input_line. */
static int shell_input_line_len; /* strlen (shell_input_line) */
diff -urp bash-3.2.orig/shell.c bash-3.2/shell.c
--- bash-3.2.orig/shell.c 2007-01-03 09:01:06.000000000 -0500
+++ bash-3.2/shell.c 2007-01-20 12:04:23.000000000 -0500
@@ -240,6 +240,9 @@ struct {
#if defined (RESTRICTED_SHELL)
{ "restricted", Int, &restricted, (char **)0x0 },
#endif
+#if defined (AUDIT_SHELL)
+ { "audit", Int, &audited, (char **)0x0 },
+#endif
{ "verbose", Int, &echo_input_at_read, (char **)0x0 },
{ "version", Int, &do_version, (char **)0x0 },
{ "wordexp", Int, &wordexp_only, (char **)0x0 },
@@ -644,6 +647,10 @@ main (argc, argv, env)
maybe_make_restricted (shell_name);
#endif /* RESTRICTED_SHELL */
+#if defined (AUDIT_SHELL)
+ maybe_make_audited (shell_name);
+#endif
+
if (wordexp_only)
{
startup_state = 3;
@@ -1143,6 +1150,29 @@ maybe_make_restricted (name)
}
#endif /* RESTRICTED_SHELL */
+#if defined (AUDIT_SHELL)
+/* Perhaps make this shell an `audited' one, based on NAME. If the
+ basename of NAME is "aubash", then this shell is audited. The
+ name of the audited shell is a configurable option, see config.h.
+ In an audited shell, all actions performed by root will be logged
+ to the audit system.
+ Do this also if `audited' is already set to 1 maybe the shell was
+ started with --audit. */
+int
+maybe_make_audited (name)
+ char *name;
+{
+ char *temp;
+
+ temp = base_pathname (name);
+ if (*temp == '-')
+ temp++;
+ if (audited || (STREQ (temp, AUDIT_SHELL_NAME)))
+ audited = 1;
+ return (audited);
+}
+#endif /* AUDIT_SHELL */
+
/* Fetch the current set of uids and gids and return 1 if we're running
setuid or setgid. */
static int
+1
View File
@@ -0,0 +1 @@
CWRU.chlog
+43
View File
@@ -0,0 +1,43 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#if defined (S_IFDIR) && !defined (S_ISDIR)
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) /* directory */
#endif
main(c, v)
int c;
char **v;
{
struct stat sb;
int r, fd;
char fbuf[32];
r = stat("/dev/fd", &sb);
/* test -d /dev/fd */
if (r == -1 || S_ISDIR (sb.st_mode) == 0)
exit (1);
/* test -r /dev/fd/0 */
r = access ("/dev/fd/0", R_OK);
if (r == -1)
exit (1);
/* exec 3</dev/null */
fd = open("/dev/null", O_RDONLY, 0666);
if (fd == -1)
exit (2);
if (fd != 3 && (dup2(fd, 3) == -1))
exit (1);
/* test -r /dev/fd/3 */
r = access("/dev/fd/3", R_OK);
if (r == -1)
exit (1);
exit (0);
}
+38
View File
@@ -0,0 +1,38 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#if defined (S_IFDIR) && !defined (S_ISDIR)
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) /* directory */
#endif
main(c, v)
int c;
char **v;
{
struct stat sb;
int r, fd;
char fbuf[32];
r = stat("/dev/fd", &sb);
/* test -d /dev/fd */
if (r == -1 || S_ISDIR (sb.st_mode) == 0)
exit (1);
/* test -r /dev/stdin < /dev/null */
fd = open("/dev/null", O_RDONLY, 0666);
if (fd == -1)
exit (2);
if (dup2(fd, 0) == -1)
exit (1);
r = access("/dev/stdin", R_OK);
if (r == -1)
exit (1);
exit (0);
}
+19
View File
@@ -0,0 +1,19 @@
#include <unistd.h>
#include <limits.h>
#include <stdio.h>
#ifndef INTMAX_MAX
# ifdef LLONG_MAX
# define INTMAX_MAX LLONG_MAX
# else
# define INTMAX_MAX LONG_MAX
# endif
#endif
main(int c, char **v)
{
printf ("%d\n", INT_MAX);
printf ("%ld\n", LONG_MAX);
printf ("%lld\n", INTMAX_MAX);
exit(0);
}
+449
View File
@@ -0,0 +1,449 @@
From jwe@che.utexas.edu Wed Sep 21 17:23:40 1994
Flags: 10
Return-Path: jwe@che.utexas.edu
Received: from po.CWRU.Edu (root@po.CWRU.Edu [129.22.4.2]) by odin.INS.CWRU.Edu with ESMTP (8.6.8.1+cwru/CWRU-2.1-ins)
id RAA04010; Wed, 21 Sep 1994 17:23:39 -0400 (from jwe@che.utexas.edu for <chet@odin.INS.CWRU.Edu>)
Received: from life.ai.mit.edu (life.ai.mit.edu [128.52.32.80]) by po.CWRU.Edu with SMTP (8.6.8.1+cwru/CWRU-2.2)
id RAA02121; Wed, 21 Sep 1994 17:23:28 -0400 (from jwe@che.utexas.edu for <chet@po.cwru.edu>)
Received: from schoch.che.utexas.edu by life.ai.mit.edu (4.1/AI-4.10) for chet@po.cwru.edu id AA09989; Wed, 21 Sep 94 17:23:17 EDT
Received: from localhost (jwe@localhost) by schoch.che.utexas.edu (8.6.8.1/8.6) with SMTP id QAA05737; Wed, 21 Sep 1994 16:22:01 -0500
Message-Id: <199409212122.QAA05737@schoch.che.utexas.edu>
To: march@tudor.com
Cc: bug-bash@prep.ai.mit.edu
Subject: Re: Completion feature possible?
In-Reply-To: Your message of 21 Sep 94 13:30:22 EDT
Date: Wed, 21 Sep 94 16:22:00 EDT
From: John Eaton <jwe@che.utexas.edu>
Gregory F. March <march@tudor.com> wrote:
: I was having a discussion about MH with one of my friends the other
: day and I got to thinking that the +folder/subfolder scheme for naming
: mail folders is a real pain because completion doesn't work on
: them. Someone then mentioned that zsh (I think) has the ability to
: specify how to complete (I guess where to look for the files) for
: different prefixes. Bash right now knows about '@', '~', and '$' (any
: others?). It would be really helpful if one could define something
: like:
:
: completion '+' "$HOME/Mail"
:
: in a config file someplace. Would this be easy? Is there a list of
: TODO item that someone might want to add this to?
It would be nice to have a general completion feature like this.
Until that happens, maybe you will find the following patch useful.
It makes MH folder name completion work with bash. The diffs are
relative to version 1.14.2.
I realize that changes to readline.c and and complete.c are not good
since they add some MH-specific stuff to the readline code and not to
bash, but when I first wrote this, I had no idea what else to do.
Chet, would you consider adding this if it were cleaned up a bit?
Made optional with cpp conditionals?
This feature has been very useful to me for the last several years
(since about 1.05 or 1.06, I think).
Thanks,
--
John W. Eaton | 4.3BSD is not perfect. -- Leffler, et al. (1989).
jwe@che.utexas.edu |
-------------------------------cut here-------------------------------
diff -rc bash-1.14.2/bashline.c bash-1.14.2.local/bashline.c
*** bash-1.14.2/bashline.c Wed Aug 3 09:32:45 1994
--- bash-1.14.2.local/bashline.c Wed Sep 21 15:39:04 1994
***************
*** 58,63 ****
--- 58,64 ----
static char *hostname_completion_function ();
static char *command_word_completion_function ();
static char *command_subst_completion_function ();
+ static char *mh_folder_completion_function ();
static void snarf_hosts_from_file (), add_host_name ();
static void sort_hostname_list ();
***************
*** 90,95 ****
--- 91,98 ----
bash_complete_username_internal (),
bash_complete_hostname (), bash_possible_hostname_completions (),
bash_complete_hostname_internal (),
+ bash_complete_mh_folder (), bash_possible_mh_folder_completions (),
+ bash_complete_mh_folder_internal (),
bash_complete_variable (), bash_possible_variable_completions (),
bash_complete_variable_internal (),
bash_complete_command (), bash_possible_command_completions (),
***************
*** 134,140 ****
rl_terminal_name = get_string_value ("TERM");
rl_instream = stdin;
rl_outstream = stderr;
! rl_special_prefixes = "$@";
/* Allow conditional parsing of the ~/.inputrc file. */
rl_readline_name = "Bash";
--- 137,143 ----
rl_terminal_name = get_string_value ("TERM");
rl_instream = stdin;
rl_outstream = stderr;
! rl_special_prefixes = "$@+";
/* Allow conditional parsing of the ~/.inputrc file. */
rl_readline_name = "Bash";
***************
*** 193,198 ****
--- 196,207 ----
rl_bind_key_in_map ('@', bash_possible_hostname_completions,
emacs_ctlx_keymap);
+ rl_add_defun ("complete-mh-folder", bash_complete_mh_folder, META('+'));
+ rl_add_defun ("possible-mh-folder-completions",
+ bash_possible_mh_folder_completions, -1);
+ rl_bind_key_in_map ('+', bash_possible_mh_folder_completions,
+ emacs_ctlx_keymap);
+
rl_add_defun ("complete-variable", bash_complete_variable, -1);
rl_bind_key_in_map ('$', bash_complete_variable, emacs_meta_keymap);
rl_add_defun ("possible-variable-completions",
***************
*** 656,661 ****
--- 665,677 ----
if (!matches && *text == '@')
matches = completion_matches (text, hostname_completion_function);
+ /* Another one. Why not? If the word starts in '+', then look for
+ matching mh folders for completion first. */
+ if (!matches && *text == '+')
+ {
+ matches = completion_matches (text, mh_folder_completion_function);
+ }
+
/* And last, (but not least) if this word is in a command position, then
complete over possible command names, including aliases, functions,
and command names. */
***************
*** 1077,1082 ****
--- 1093,1185 ----
return ((char *)NULL);
}
+ /* How about a completion function for mh folders? */
+ static char *
+ mh_folder_completion_function (text, state)
+ int state;
+ char *text;
+ {
+ extern int rl_filename_completion_desired;
+
+ extern char *get_mh_path ();
+
+ static char *mh_path = (char *)NULL;
+ static int len;
+ static int istate;
+ static char *val;
+ char *hint;
+
+ static char *mh_folder_hint = (char *)NULL;
+
+ /* If we don't have any state, make some. */
+ if (!state)
+ {
+ val = (char *)NULL;
+
+ if (mh_path)
+ free (mh_path);
+
+ mh_path = get_mh_path ();
+ if (!mh_path && !(hint[1] == '/' || hint[1] == '.'))
+ return ((char *)NULL);
+
+ len = strlen (mh_path);
+ }
+
+ if (mh_folder_hint)
+ free (mh_folder_hint);
+
+ hint = text;
+ if (*hint == '+')
+ hint++;
+
+ mh_folder_hint = (char *)xmalloc (2 + len + strlen (hint));
+ if (*hint == '/' || *hint == '.') {
+ len = -1;
+ sprintf (mh_folder_hint, "%s", hint);
+ } else
+ sprintf (mh_folder_hint, "%s/%s", mh_path, hint);
+
+ istate = (val != (char *)NULL);
+
+ again:
+ val = filename_completion_function (mh_folder_hint, istate);
+ istate = 1;
+
+ if (!val)
+ {
+ return ((char *)NULL);
+ }
+ else
+ {
+ char *ptr = val + len + 1, *temp;
+ struct stat sb;
+ int status = stat (val, &sb);
+
+ if (status != 0)
+ return ((char *)NULL);
+
+ if ((sb.st_mode & S_IFDIR) == S_IFDIR)
+ {
+ temp = (char *)xmalloc (2 + strlen (ptr));
+ *temp = '+';
+ strcpy (temp + 1, ptr);
+
+ free (val);
+ val = "";
+
+ rl_filename_completion_desired = 1;
+
+ return (temp);
+ }
+ else
+ {
+ free (val);
+ }
+ goto again;
+ }
+ }
+
/* History and alias expand the line. */
static char *
history_expand_line_internal (line)
***************
*** 1628,1633 ****
--- 1731,1773 ----
{
bash_specific_completion
(what_to_do, (Function *)username_completion_function);
+ }
+
+ static void
+ bash_complete_mh_folder (ignore, ignore2)
+ int ignore, ignore2;
+ {
+ bash_complete_mh_folder_internal (TAB);
+ }
+
+ static void
+ bash_possible_mh_folder_completions (ignore, ignore2)
+ int ignore, ignore2;
+ {
+ bash_complete_mh_folder_internal ('?');
+ }
+
+ static void
+ bash_complete_mh_folder_internal (what_to_do)
+ int what_to_do;
+ {
+ Function *orig_func;
+ CPPFunction *orig_attempt_func;
+ char *orig_rl_completer_word_break_characters;
+ extern char *rl_completer_word_break_characters;
+
+ orig_func = rl_completion_entry_function;
+ orig_attempt_func = rl_attempted_completion_function;
+ orig_rl_completer_word_break_characters = rl_completer_word_break_characters;
+ rl_completion_entry_function = (Function *)mh_folder_completion_function;
+ rl_attempted_completion_function = (CPPFunction *)NULL;
+ rl_completer_word_break_characters = " \t\n\"\'";
+
+ rl_complete_internal (what_to_do);
+
+ rl_completion_entry_function = orig_func;
+ rl_attempted_completion_function = orig_attempt_func;
+ rl_completer_word_break_characters = orig_rl_completer_word_break_characters;
}
static void
Only in bash-1.14.2.local: bashline.c.orig
diff -rc bash-1.14.2/lib/readline/complete.c bash-1.14.2.local/lib/readline/complete.c
*** bash-1.14.2/lib/readline/complete.c Tue Jul 26 12:59:57 1994
--- bash-1.14.2.local/lib/readline/complete.c Wed Sep 21 15:41:19 1994
***************
*** 733,751 ****
if (rl_filename_completion_desired)
{
struct stat finfo;
! char *filename = tilde_expand (matches[0]);
! if ((stat (filename, &finfo) == 0) && S_ISDIR (finfo.st_mode))
{
! if (rl_line_buffer[rl_point] != '/')
! rl_insert_text ("/");
}
! else
{
! if (rl_point == rl_end)
! rl_insert_text (temp_string);
}
- free (filename);
}
else
{
--- 733,768 ----
if (rl_filename_completion_desired)
{
struct stat finfo;
! char *tilde_expand ();
! char *plus_expand ();
! char *filename = (char *) NULL;
! switch (*matches[0])
{
! case '+':
! filename = plus_expand (matches[0]);
! break;
! case '~':
! default:
! filename = tilde_expand (matches[0]);
! break;
}
!
! if (filename)
{
! if ((stat (filename, &finfo) == 0)
! && S_ISDIR (finfo.st_mode))
! {
! if (rl_line_buffer[rl_point] != '/')
! rl_insert_text ("/");
! }
! else
! {
! if (rl_point == rl_end)
! rl_insert_text (temp_string);
! }
! free (filename);
}
}
else
{
Only in bash-1.14.2.local/lib/readline: diffs
diff -rc bash-1.14.2/lib/readline/readline.c bash-1.14.2.local/lib/readline/readline.c
*** bash-1.14.2/lib/readline/readline.c Fri Aug 12 12:47:46 1994
--- bash-1.14.2.local/lib/readline/readline.c Wed Sep 21 15:36:07 1994
***************
*** 23,28 ****
--- 23,29 ----
#define READLINE_LIBRARY
#include <stdio.h>
+ #include <string.h>
#include <sys/types.h>
#include <fcntl.h>
#if !defined (NO_SYS_FILE)
***************
*** 3518,3523 ****
--- 3519,3616 ----
}
#endif /* TEST */
+
+ #define cr_whitespace(c) ((c) == '\r' || (c) == '\n' || whitespace(c))
+
+ char *
+ get_mh_path ()
+ {
+ static FILE *fp = (FILE *)NULL;
+ char buf[512]; /* XXX */
+ char profile[512]; /* XXX */
+ char *bp;
+ char *temp_home;
+ char *temp_path;
+
+ temp_home = (char *)getenv ("HOME");
+ if (!temp_home)
+ return ((char *)NULL);
+
+ strcpy (profile, temp_home);
+ strcat (profile, "/.mh_profile");
+
+ if (fp)
+ fclose (fp);
+
+ fp = fopen (profile, "r");
+ if (fp == (FILE *)NULL)
+ return ((char *)NULL);
+
+ while (fgets (buf, 512, fp) != (char *)NULL) /* XXX */
+ {
+ if ((bp = strstr (buf, "Path:")) != (char *)NULL)
+ {
+ bp += 5;
+ while (whitespace (*bp))
+ bp++;
+
+ if (*bp == '\0')
+ return ((char *)NULL);
+
+ temp_path = (char *)xmalloc (3 + strlen (bp) + strlen (temp_home));
+
+ strcpy (temp_path, temp_home);
+ strcat (temp_path, "/");
+ strcat (temp_path, bp);
+
+ bp = temp_path;
+
+ while (!(cr_whitespace (*bp)))
+ bp++;
+
+ *bp = '\0';
+
+ return temp_path;
+ }
+ }
+
+ return ((char *)NULL);
+ }
+
+ /* Expand FILENAME if it begins with a plus. This always returns
+ a new string. */
+ char *
+ plus_expand (filename)
+ char *filename;
+ {
+ static char *dirname = (char *)NULL;
+
+ if (filename && *filename == '+')
+ {
+ char *mh_path = get_mh_path ();
+
+ if (filename[1] == '/' || filename[1] == '.')
+ {
+ dirname = (char *)xmalloc (1 + strlen (filename));
+
+ strcpy(dirname, filename+1);
+
+ return dirname;
+ }
+
+ if (mh_path)
+ {
+ dirname = (char *)xmalloc (1 + strlen (filename) + strlen (mh_path));
+
+ strcpy (dirname, mh_path);
+ strcat (dirname, "/");
+ strcat (dirname, filename+1);
+
+ return dirname;
+ }
+ }
+ return (char *)NULL;
+ }
/*
+52
View File
@@ -0,0 +1,52 @@
#include <stdio.h>
#include <locale.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
static int
qsort_strcmp(s1, s2)
char **s1, **s2;
{
return (strcoll(*s1, *s2));
}
static void
usage()
{
fprintf(stderr, "asort: usage: asort [-v] args\n");
}
int
main(c, v)
int c;
char **v;
{
int i, verbose;
char *dlocale;
verbose = 0;
while ((i = getopt(c, v, "v")) != -1) {
switch (i) {
case 'v':
verbose = 1; break;
case '?':
default:
usage();
exit(2);
}
}
c -= optind;
v += optind;
dlocale = setlocale(LC_ALL, "");
if (verbose)
printf("default locale = %s\n", dlocale ? dlocale : "''");
qsort(v, c, sizeof(char *), qsort_strcmp);
for (i = 0; i < c; i++) {
printf("%s ", v[i]);
}
printf("\n");
exit(0);
}
+26
View File
@@ -0,0 +1,26 @@
#! /bin/sh
#
# bison -- just call yacc
#
# Copyright (C) 1996-2002 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
if [ "$1" = '-y' ]; then
shift
fi
exec /usr/bin/yacc ${1+"$@"}
+17
View File
@@ -0,0 +1,17 @@
/* Copyright (C) 2008,2009 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
+21
View File
@@ -0,0 +1,21 @@
#include <stdio.h>
main()
{
union {
long int l;
char c[sizeof(long int)];
} u;
int x0, x1, x2, x3;
u.l = 1;
x0 = u.c[0];
x3 = u.c[sizeof (long int) - 1];
printf ("x0 = %d x3 = %d (%s)\n", x0, x3, x3 == 1 ? "bigendian" : "littleendian");
x0 = u.l >> 24;
x1 = u.l >> 16;
x2 = u.l >> 8;
x3 = u.l & 0xff;
printf ("x0:x3: %d %d %d %d\n", x0, x1, x2, x3);
}
+13
View File
@@ -0,0 +1,13 @@
#include <stdio.h>
int
main()
{
int i = 0x12345678;
char *x;
x = (char *)&i;
printf ("0x%x\n", *x);
printf ((*x == 0x78) ? "little endian\n" : "big endian\n");
return 0;
}
+21
View File
@@ -0,0 +1,21 @@
#include <stdio.h>
main()
{
union {
int l;
char c[sizeof(int)];
} u;
int x0, x1, x2, x3;
u.l = 0x012345678;
x0 = u.c[0];
x3 = u.c[sizeof (int) - 1];
printf ("x0 = 0x%x x3 = 0x%x (%s)\n", x0, x3, x3 == 0x78 ? "bigendian" : "littleendian");
x0 = (u.l >> 24) & 0xff;
x1 = (u.l >> 16) & 0xff;
x2 = (u.l >> 8) & 0xff;
x3 = u.l & 0xff;
printf ("big endian x0:x3: %x %x %x %x\n", x0, x1, x2, x3);
}
+57
View File
@@ -0,0 +1,57 @@
/*
* If necessary, link with lib/sh/libsh.a
*/
/* Copyright (C) 1998-2009 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <errno.h>
extern char *strerror();
extern int sys_nerr;
int
main(c, v)
int c;
char **v;
{
int i, n;
if (c == 1) {
for (i = 1; i < sys_nerr; i++)
printf("%d --> %s\n", i, strerror(i));
} else {
for (i = 1; i < c; i++) {
n = atoi(v[i]);
printf("%d --> %s\n", n, strerror(n));
}
}
exit (0);
}
programming_error(a, b)
char *a;
int b;
{
}
fatal_error()
{
}
+254
View File
@@ -0,0 +1,254 @@
/*
* Copyright (c) 1989, 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)getcwd.c 5.11 (Berkeley) 2/24/91";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#include <sys/stat.h>
#include <errno.h>
#if defined (HAVE_DIRENT_H)
#include <dirent.h>
#else
#include <sys/dir.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef HAVE_DIRENT_H
# define dirent direct
#endif
#define ISDOT(dp) \
(dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \
dp->d_name[1] == '.' && dp->d_name[2] == '\0'))
#ifndef dirfd
# define dirfd(d) ((d)->dd_fd)
#endif
char *
getcwd(pt, size)
char *pt;
size_t size;
{
register struct dirent *dp;
register DIR *dir;
register dev_t dev;
register ino_t ino;
register int first;
register char *bpt, *bup;
struct stat s;
dev_t root_dev;
ino_t root_ino;
size_t ptsize, upsize;
int save_errno;
char *ept, *eup, *up;
/*
* If no buffer specified by the user, allocate one as necessary.
* If a buffer is specified, the size has to be non-zero. The path
* is built from the end of the buffer backwards.
*/
if (pt) {
ptsize = 0;
if (!size) {
errno = EINVAL;
return((char *)NULL);
}
ept = pt + size;
} else {
if (!(pt = (char *)malloc(ptsize = 1024 - 4)))
return((char *)NULL);
ept = pt + ptsize;
}
bpt = ept - 1;
*bpt = '\0';
/*
* Allocate bytes (1024 - malloc space) for the string of "../"'s.
* Should always be enough (it's 340 levels). If it's not, allocate
* as necessary. Special * case the first stat, it's ".", not "..".
*/
if (!(up = (char *)malloc(upsize = 1024 - 4)))
goto err;
eup = up + MAXPATHLEN;
bup = up;
up[0] = '.';
up[1] = '\0';
/* Save root values, so know when to stop. */
if (stat("/", &s))
goto err;
root_dev = s.st_dev;
root_ino = s.st_ino;
errno = 0; /* XXX readdir has no error return. */
for (first = 1;; first = 0) {
/* Stat the current level. */
if (lstat(up, &s))
goto err;
/* Save current node values. */
ino = s.st_ino;
dev = s.st_dev;
/* Check for reaching root. */
if (root_dev == dev && root_ino == ino) {
*--bpt = '/';
/*
* It's unclear that it's a requirement to copy the
* path to the beginning of the buffer, but it's always
* been that way and stuff would probably break.
*/
(void)bcopy(bpt, pt, ept - bpt);
free(up);
return(pt);
}
/*
* Build pointer to the parent directory, allocating memory
* as necessary. Max length is 3 for "../", the largest
* possible component name, plus a trailing NULL.
*/
if (bup + 3 + MAXNAMLEN + 1 >= eup) {
if (!(up = (char *)realloc(up, upsize *= 2)))
goto err;
eup = up + upsize;
}
*bup++ = '.';
*bup++ = '.';
*bup = '\0';
/* Open and stat parent directory. */
if (!(dir = opendir(up)) || fstat(dirfd(dir), &s))
goto err;
/* Add trailing slash for next directory. */
*bup++ = '/';
/*
* If it's a mount point, have to stat each element because
* the inode number in the directory is for the entry in the
* parent directory, not the inode number of the mounted file.
*/
save_errno = 0;
if (s.st_dev == dev) {
for (;;) {
if (!(dp = readdir(dir)))
goto notfound;
if (dp->d_fileno == ino)
break;
}
} else
for (;;) {
if (!(dp = readdir(dir)))
goto notfound;
if (ISDOT(dp))
continue;
bcopy(dp->d_name, bup, dp->d_namlen + 1);
/* Save the first error for later. */
if (lstat(up, &s)) {
if (!save_errno)
save_errno = errno;
errno = 0;
continue;
}
if (s.st_dev == dev && s.st_ino == ino)
break;
}
/*
* Check for length of the current name, preceding slash,
* leading slash.
*/
if (bpt - pt <= dp->d_namlen + (first ? 1 : 2)) {
size_t len, off;
if (!ptsize) {
errno = ERANGE;
goto err;
}
off = bpt - pt;
len = ept - bpt;
if (!(pt = (char *)realloc(pt, ptsize *= 2)))
goto err;
bpt = pt + off;
ept = pt + ptsize;
(void)bcopy(bpt, ept - len, len);
bpt = ept - len;
}
if (!first)
*--bpt = '/';
bpt -= dp->d_namlen;
bcopy(dp->d_name, bpt, dp->d_namlen);
(void)closedir(dir);
/* Truncate any file name. */
*bup = '\0';
}
notfound:
/*
* If readdir set errno, use it, not any saved error; otherwise,
* didn't find the current directory in its parent directory, set
* errno to ENOENT.
*/
if (!errno)
errno = save_errno ? save_errno : ENOENT;
/* FALLTHROUGH */
err:
if (ptsize)
free(pt);
free(up);
return((char *)NULL);
}
char *
getwd(buf)
char *buf;
{
char *p;
if (p = getcwd(buf, MAXPATHLEN))
return(p);
(void)strcpy(buf, strerror(errno));
return((char *)NULL);
}
+63
View File
@@ -0,0 +1,63 @@
/*
* HPUX 10.x stubs to implement dl* in terms of shl*
*
* Not needed for later versions; HPUX 11.x has dlopen() and friends.
*
* configure also needs to be faked out. You can create a dummy libdl.a
* with stub entries for dlopen, dlclose, dlsym, and dlerror:
*
* int dlopen() { return(0);}
* int dlclose() { return(0);}
* int dlsym() { return(0);}
* int dlerror() { return(0);}
*
* This has not been tested; I just read the manual page and coded this up.
*
* According to the ld manual page, you need to link bash with -dld and add
* the -E flag to LOCAL_LDFLAGS.
*/
/* Copyright (C) 1998-2009 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (__HPUX10_DLFCN_H__)
#define __HPUX10_DLFCN_H__
#include <dl.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#define RTLD_LAZY BIND_DEFERRED
#define RTLD_NOW BIND_IMMEDIATE
#define RTLD_GLOBAL DYNAMIC_PATH
char *bash_global_sym_addr;
#define dlopen(file,mode) (void *)shl_load((file), (mode), 0L)
#define dlclose(handle) shl_unload((shl_t)(handle))
#define dlsym(handle,name) (bash_global_sym_addr=0,shl_findsym((shl_t *)&(handle),name,TYPE_UNDEFINED,&bash_global_sym_addr), (void *)bash_global_sym_addr)
#define dlerror() strerror(errno)
#endif /* __HPUX10_DLFCN_H__ */
+12
View File
@@ -0,0 +1,12 @@
#include <stdio.h>
main()
{
if (sizeof(char *) == sizeof(long))
printf("long\n");
else if (sizeof(char *) == sizeof(short))
printf("short\n");
else
printf("int\n");
exit(0);
}
+9
View File
@@ -0,0 +1,9 @@
main(c, v, e)
int c;
char **v, **e;
{
close(0);
execv(v[1], v+1);
}
+40
View File
@@ -0,0 +1,40 @@
/* open-files -- report files a process has open */
/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sys/types.h>
#include <fcntl.h>
#include <sys/file.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int
main()
{
register int i;
for (i = 0; i < getdtablesize(); i++) {
if (fcntl(i, F_GETFD, 0) != -1)
fprintf(stderr, "fd %d: open\n", i);
}
exit(0);
}
+239
View File
@@ -0,0 +1,239 @@
/* $Header:cat.c 12.0$ */
/* $ACIS:cat.c 12.0$ */
/* $Source: /ibm/acis/usr/src/bin/RCS/cat.c,v $ */
#ifndef lint
static char *rcsid = "$Header:cat.c 12.0$";
#endif
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ifndef lint
static char sccsid[] = "@(#)cat.c 5.2 (Berkeley) 12/6/85";
#endif not lint
/*
* Concatenate files.
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
/* #define OPTSIZE BUFSIZ /* define this only if not 4.2 BSD or beyond */
int bflg, eflg, nflg, sflg, tflg, uflg, vflg;
int spaced, col, lno, inline, ibsize, obsize;
#include <signal.h>
sigpipe()
{
write(2, "pcat: caught SIGPIPE\n", 21);
exit(1);
}
main(argc, argv)
char **argv;
{
int fflg = 0;
register FILE *fi;
register c;
int dev, ino = -1;
struct stat statb;
int retval = 0;
signal(SIGPIPE, sigpipe);
lno = 1;
for( ; argc>1 && argv[1][0]=='-'; argc--,argv++) {
switch(argv[1][1]) {
case 0:
break;
case 'u':
setbuf(stdout, (char *)NULL);
uflg++;
continue;
case 'n':
nflg++;
continue;
case 'b':
bflg++;
nflg++;
continue;
case 'v':
vflg++;
continue;
case 's':
sflg++;
continue;
case 'e':
eflg++;
vflg++;
continue;
case 't':
tflg++;
vflg++;
continue;
}
break;
}
if (fstat(fileno(stdout), &statb) == 0) {
statb.st_mode &= S_IFMT;
if (statb.st_mode!=S_IFCHR && statb.st_mode!=S_IFBLK) {
dev = statb.st_dev;
ino = statb.st_ino;
}
#ifndef OPTSIZE
obsize = statb.st_blksize;
#endif
}
else
obsize = 0;
if (argc < 2) {
argc = 2;
fflg++;
}
while (--argc > 0) {
if (fflg || (*++argv)[0]=='-' && (*argv)[1]=='\0')
fi = stdin;
else {
if ((fi = fopen(*argv, "r")) == NULL) {
perror(*argv);
retval = 1;
continue;
}
}
if (fstat(fileno(fi), &statb) == 0) {
if ((statb.st_mode & S_IFMT) == S_IFREG &&
statb.st_dev==dev && statb.st_ino==ino) {
fprintf(stderr, "cat: input %s is output\n",
fflg?"-": *argv);
fclose(fi);
retval = 1;
continue;
}
#ifndef OPTSIZE
ibsize = statb.st_blksize;
#endif
}
else
ibsize = 0;
if (nflg||sflg||vflg)
copyopt(fi);
else if (uflg) {
while ((c = getc(fi)) != EOF)
putchar(c);
} else
retval |= fastcat(fileno(fi)); /* no flags specified */
if (fi!=stdin)
fclose(fi);
else
clearerr(fi); /* reset sticky eof */
if (ferror(stdout)) {
fprintf(stderr, "cat: output write error\n");
retval = 1;
break;
}
}
exit(retval);
}
copyopt(f)
register FILE *f;
{
register int c;
top:
c = getc(f);
if (c == EOF)
return;
if (c == '\n') {
if (inline == 0) {
if (sflg && spaced)
goto top;
spaced = 1;
}
if (nflg && bflg==0 && inline == 0)
printf("%6d\t", lno++);
if (eflg)
putchar('$');
putchar('\n');
inline = 0;
goto top;
}
if (nflg && inline == 0)
printf("%6d\t", lno++);
inline = 1;
if (vflg) {
if (tflg==0 && c == '\t')
putchar(c);
else {
if (c > 0177) {
printf("M-");
c &= 0177;
}
if (c < ' ')
printf("^%c", c+'@');
else if (c == 0177)
printf("^?");
else
putchar(c);
}
} else
putchar(c);
spaced = 0;
goto top;
}
fastcat(fd)
register int fd;
{
register int buffsize, n, nwritten, offset;
register char *buff;
struct stat statbuff;
char *malloc();
#ifndef OPTSIZE
if (obsize)
buffsize = obsize; /* common case, use output blksize */
else if (ibsize)
buffsize = ibsize;
else
buffsize = BUFSIZ;
#else
buffsize = OPTSIZE;
#endif
if ((buff = malloc(buffsize)) == NULL) {
perror("cat: no memory");
return (1);
}
/*
* Note that on some systems (V7), very large writes to a pipe
* return less than the requested size of the write.
* In this case, multiple writes are required.
*/
while ((n = read(fd, buff, buffsize)) > 0) {
offset = 0;
do {
nwritten = write(fileno(stdout), &buff[offset], n);
if (nwritten <= 0) {
perror("cat: write error");
exit(2);
}
offset += nwritten;
} while ((n -= nwritten) > 0);
}
free(buff);
if (n < 0) {
perror("cat: read error");
return (1);
}
return (0);
}
+13
View File
@@ -0,0 +1,13 @@
#include <stdio.h>
#include <sys/types.h>
int pid;
int pg1;
main()
{
pid = getpid();
pg1 = getpgrp(0);
printf("pid = %d, pgrp = %d\n", pid, pg1);
}
+7
View File
@@ -0,0 +1,7 @@
#include <stdio.h>
main()
{
fprintf(stderr, "%d\n", getpid());
exit(0);
}
+45
View File
@@ -0,0 +1,45 @@
#include <stdio.h>
#include <locale.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
static void
usage()
{
fprintf(stderr, "rangecmp: usage: rangecmp [-v] start test end\n");
}
int
main(c, v)
int c;
char **v;
{
int i, verbose, r1, r2;
char *dlocale;
verbose = 0;
while ((i = getopt(c, v, "v")) != -1) {
switch (i) {
case 'v':
verbose = 1; break;
case '?':
default:
usage();
exit(2);
}
}
c -= optind;
v += optind;
dlocale = setlocale(LC_ALL, "");
if (verbose)
printf("default locale = %s\n", dlocale ? dlocale : "''");
r1 = strcoll (v[1], v[0]);
printf("strcoll (%s, %s) -> %d\n", v[1], v[0], r1);
r2 = strcoll (v[1], v[2]);
printf("strcoll (%s, %s) -> %d\n", v[1], v[2], r2);
exit(0);
}
+47
View File
@@ -0,0 +1,47 @@
/* sigs - print signal dispositions for a process */
/* Copyright (C) 1990-2010 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
extern const char * const sys_siglist[];
typedef void sighandler();
int
main(int argc, char **argv)
{
int i;
sighandler *h;
for (i = 1; i < NSIG; i++) {
h = signal(i, SIG_DFL);
if (h != SIG_DFL) {
if (h == SIG_IGN)
fprintf(stderr, "%d: ignored (%s)\n", i, sys_siglist[i]);
else
fprintf(stderr, "%d: caught (%s)\n", i, sys_siglist[i]);
}
}
exit(0);
}
+231
View File
@@ -0,0 +1,231 @@
/*
* sigstat - print out useful information about signal arguments
*
* Chet Ramey
* chet@po.cwru.edu
*/
/* Copyright (C) 1991-2009 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
static char *signames[NSIG];
char *progname;
void sigstat(int);
void init_signames(void);
int
main(argc, argv)
int argc;
char **argv;
{
register int i;
char *t;
if (t = strrchr(argv[0], '/'))
progname = ++t;
else
progname = argv[0];
init_signames();
if (argc == 1) {
for (i = 1; i < NSIG; i++)
sigstat(i);
exit(0);
}
for (i = 1; i < argc; i++)
sigstat(atoi(argv[i]));
exit(0);
}
void
sigstat(sig)
int sig;
{
struct sigaction oact;
char *signame;
sigset_t set, oset;
int blocked;
if (sig < 0 || sig >= NSIG) {
fprintf(stderr, "%s: %d: signal out of range\n", progname, sig);
return;
}
signame = signames[sig];
sigemptyset(&oset);
sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
if (sigismember(&oset, sig))
printf("%s: signal is blocked\n", signame);
sigaction(sig, (struct sigaction *)NULL, &oact);
if (oact.sa_handler == SIG_IGN)
printf("%s: signal is ignored\n", signame);
else if (oact.sa_handler == SIG_DFL)
printf("%s: signal is defaulted\n", signame);
else
printf("%s: signal is trapped (?)\n", signame);
}
void
init_signames()
{
register int i;
bzero(signames, sizeof(signames));
#if defined (SIGHUP) /* hangup */
signames[SIGHUP] = "SIGHUP";
#endif
#if defined (SIGINT) /* interrupt */
signames[SIGINT] = "SIGINT";
#endif
#if defined (SIGQUIT) /* quit */
signames[SIGQUIT] = "SIGQUIT";
#endif
#if defined (SIGILL) /* illegal instruction (not reset when caught) */
signames[SIGILL] = "SIGILL";
#endif
#if defined (SIGTRAP) /* trace trap (not reset when caught) */
signames[SIGTRAP] = "SIGTRAP";
#endif
#if defined (SIGABRT) /* */
signames[SIGABRT] = "SIGABRT";
#endif
#if defined (SIGIOT) /* IOT instruction */
signames[SIGIOT] = "SIGIOT";
#endif
#if defined (SIGEMT) /* EMT instruction */
signames[SIGEMT] = "SIGEMT";
#endif
#if defined (SIGFPE) /* floating point exception */
signames[SIGFPE] = "SIGFPE";
#endif
#if defined (SIGKILL) /* kill (cannot be caught or ignored) */
signames[SIGKILL] = "SIGKILL";
#endif
#if defined (SIGBUS) /* bus error */
signames[SIGBUS] = "SIGBUS";
#endif
#if defined (SIGSEGV) /* segmentation violation */
signames[SIGSEGV] = "SIGSEGV";
#endif
#if defined (SIGSYS) /* bad argument to system call */
signames[SIGSYS] = "SIGSYS";
#endif
#if defined (SIGPIPE) /* write on a pipe with no one to read it */
signames[SIGPIPE] = "SIGPIPE";
#endif
#if defined (SIGALRM) /* alarm clock */
signames[SIGALRM] = "SIGALRM";
#endif
#if defined (SIGTERM) /* software termination signal from kill */
signames[SIGTERM] = "SIGTERM";
#endif
#if defined (SIGCLD) /* Like SIGCHLD. */
signames[SIGCLD] = "SIGCLD";
#endif
#if defined (SIGPWR) /* Magic thing for some machines. */
signames[SIGPWR] = "SIGPWR";
#endif
#if defined (SIGPOLL) /* For keyboard input? */
signames[SIGPOLL] = "SIGPOLL";
#endif
#if defined (SIGURG) /* urgent condition on IO channel */
signames[SIGURG] = "SIGURG";
#endif
#if defined (SIGSTOP) /* sendable stop signal not from tty */
signames[SIGSTOP] = "SIGSTOP";
#endif
#if defined (SIGTSTP) /* stop signal from tty */
signames[SIGTSTP] = "SIGTSTP";
#endif
#if defined (SIGCONT) /* continue a stopped process */
signames[SIGCONT] = "SIGCONT";
#endif
#if defined (SIGCHLD) /* to parent on child stop or exit */
signames[SIGCHLD] = "SIGCHLD";
#endif
#if defined (SIGTTIN) /* to readers pgrp upon background tty read */
signames[SIGTTIN] = "SIGTTIN";
#endif
#if defined (SIGTTOU) /* like TTIN for output if (tp->t_local&LTOSTOP) */
signames[SIGTTOU] = "SIGTTOU";
#endif
#if defined (SIGIO) /* input/output possible signal */
signames[SIGIO] = "SIGIO";
#endif
#if defined (SIGXCPU) /* exceeded CPU time limit */
signames[SIGXCPU] = "SIGXCPU";
#endif
#if defined (SIGXFSZ) /* exceeded file size limit */
signames[SIGXFSZ] = "SIGXFSZ";
#endif
#if defined (SIGVTALRM) /* virtual time alarm */
signames[SIGVTALRM] = "SIGVTALRM";
#endif
#if defined (SIGPROF) /* profiling time alarm */
signames[SIGPROF] = "SIGPROF";
#endif
#if defined (SIGWINCH) /* window changed */
signames[SIGWINCH] = "SIGWINCH";
#endif
#if defined (SIGLOST) /* resource lost (eg, record-lock lost) */
signames[SIGLOST] = "SIGLOST";
#endif
#if defined (SIGUSR1) /* user defined signal 1 */
signames[SIGUSR1] = "SIGUSR1";
#endif
#if defined (SIGUSR2) /* user defined signal 2 */
signames[SIGUSR2] = "SIGUSR2";
#endif
#if defined (SIGMSG) /* HFT input data pending */
signames[SIGMSG] = "SIGMSG";
#endif
#if defined (SIGPWR) /* power failure imminent (save your data) */
signames[SIGPWR] = "SIGPWR";
#endif
#if defined (SIGDANGER) /* system crash imminent */
signames[SIGDANGER] = "SIGDANGER";
#endif
#if defined (SIGMIGRATE) /* migrate process to another CPU */
signames[SIGMIGRATE] = "SIGMIGRATE";
#endif
#if defined (SIGPRE) /* programming error */
signames[SIGPRE] = "SIGPRE";
#endif
#if defined (SIGGRANT) /* HFT monitor mode granted */
signames[SIGGRANT] = "SIGGRANT";
#endif
#if defined (SIGRETRACT) /* HFT monitor mode retracted */
signames[SIGRETRACT] = "SIGRETRACT";
#endif
#if defined (SIGSOUND) /* HFT sound sequence has completed */
signames[SIGSOUND] = "SIGSOUND";
#endif
for (i = 0; i < NSIG; i++)
if (signames[i] == (char *)NULL) {
signames[i] = (char *)malloc (16);;
sprintf (signames[i], "signal %d", i);
}
}
+12
View File
@@ -0,0 +1,12 @@
#include <stdio.h>
main()
{
fprintf(stdout, "to stdout\n");
fprintf(stderr, "to stderr\n");
fprintf(stdout, "to stdout\n");
fprintf(stderr, "to stderr\n");
exit(0);
}
+33
View File
@@ -0,0 +1,33 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
main(c, v)
int c;
char **v;
{
double dv, dv2;
char *sv, *ep;
int r;
sv = "4.2";
dv = 4.2;
errno = 0;
dv2 = strtod(sv, &ep);
if (*ep)
exit(1);
else if (errno == ERANGE)
exit(1);
if (dv != dv2)
exit(1);
exit(0);
}
@@ -0,0 +1,115 @@
This file details the changes between the previous release of CWRU bash
(3/10/93) and this release.
1. Bugs Fixed
New version of endian.c that handles 64-bit machines better
added code to make readline reset itself when $TERMINFO changes
fixed memory leaks in:
builtins/exec.def
lib/readline/history.c
lib/readline/readline.c
parse.y
subst.c
variables.c
dispose_cmd.c
mailcheck.c
bashline.c
execute_cmd.c
shell.c
make sure that bash_symbolic_link_hook calls get_working_directory with a
non-empty string argument
check the return value of getdtablesize() for bad values
make the job control tty handlers print error message only if the shell is
currently interactive
process substitution no longer tries to close every file descriptor
fixed up the source to contain more extern function declarations rather than
casting the return values
fixed up handling of embedded quoted strings by the parser so that $ is not
a special character while parsing one
added escape handling to the read builtin so backslashes can escape $IFS
characters
fixed the brace expansion code so that backslash can act as a delimiter and
can escape `"' in a double-quoted string
the `<>' redirection needs to open the file O_RDWR|O_CREAT for Posix.2
compatibility
fixed up the here document reading code so that it will remove backslash-
quoted newlines if the document delimiter is not quoted
fixed up the unwind_protect_var code so that the same strategy is used
for both saving and restoring variables
completion functions may now tell readline not to attempt filename completion
by returning (char **) -1
improved the error message printed by get_working_directory
Compile for solaris if either USGr4 or __svr4__ is defined
bash does not perform a getwd() on startup unless the inherited value of
$PWD is wrong or $PWD was not in the environment
fixed up the trap saving and restoring code so that savetrap=$(trap) works
like Posix.2 says it should
non-interactive shells are now much better about cleaning up dead processes
and jobs on both job control and non job control systems
fixed the code that saves and restores the dollar variables around a `.'
script so that if the script changes the positional parameters, the old
values are not restored
fixed the tokenizer so that it will not return ASSIGNMENT_WORD while
parsing a case statement pattern list
redid the implementation of cprintf for systems without varargs
fixed up the variable expansion code so that illegal variable names in ${ }
expansion now generate errors rather than produce incorrect results
fixed up some problems with default_buffered_input and the implicit redirection
of fd 0 to /dev/null for asynchronous commands without job control
new function internal_error for shell internal error messages
changed the sigint signal handler in nojobs.c to do nothing when it's called,
not even run a signal handler
made the command substitution code more careful about file descriptors when
errors occur
2. New Features
SIGWINCH causes bash to reset the values of $LINES and $COLUMNS for both
readline and non-readline systems
changed the code in readline that handled conditional parsing of `$if term='
to test the terminal name given to $if against both the `long' and `short'
(portion up to the first `-') forms of the terminal name
the completion code now single-quotes a match that contains a shell word
break character
the readline code does not define USE_XON_XOFF. This causes output to be
swallowed when using bash over a relatively slow line (like a modem line).
there is now a bindable readline function to do only history expansion;
bound to M-^ (M-! was already taken)
ulimit now has a -u option to set and get the limit for the maximum number
of user processes
config.h.mini is a `minimal' configuration file that compiles out just about
everything
@@ -0,0 +1,63 @@
This file details the changes between the previous release of CWRU bash
(5/10/93) and this release.
1. Bugs Fixed
commas within backquotes inside matching braces are now treated as
quoted (e.g., echo {`echo foo:bar | sed s/:/,/`})
don't create the export env unless we are running a command with
shell_execve (in execute_disk_command), and don't create it anew
each time a child is forked
make execute_disk_command look in the temp environment for an
assignment to PATH, and disable hash lookup for the command if
such an assignment is present
fixed here documents so that backslash-quoted newlines are treated as
Posix.2 specifies
removed a number of extraneous unwind-protects or moved them inside
if statements
only call rl_reset_terminal in sv_term if we're actually using readline
only run traps on SIGCHLD if job_control != 0
fixed readline so it won't try to pass memory allocated with alloca() to
a separate function
cleaned up the readline global function and variable namespace, and split
some more code out from readline.c into separate files
added header files that declare extern functions rather than having those
extern declarations littered throughout the code
readline now allows ^T to be undone
fixed readline so that characters whose screen representation is > 1
character (e.g., \354) are erased correctly
the read builtin no longer attempts to split its input into words if
$IFS is unset
changed the terminating signals that bash catches so they're reset to
their original handlers when a child is forked
the Gnu malloc library code was upgraded to Gnu libc version 1.06
the Gnu termcap library code was upgraded to Gnu termcap version 1.02
the man page was updated to cover the bind -m option
2. New Features
Bash now notices if it's running setuid or setgid and disables $ENV
processing and importing shell functions from the environment
New flag: -p/-o privileged, set if the shell is running setuid or setgid.
Turning this off causes the effective uid and gid to be set to the
real uid and gid
New machine descriptions for the Intel Paragon, Symmetric 375, NeXT 486,
and HP running 4.4 BSD
@@ -0,0 +1,140 @@
This file details the changes between the previous release of CWRU bash
(07/11/93) and this release.
1. Bugs Fixed
Readline's vi-mode once again has TAB bound to completion; entering `posix
mode' changes it to self-insert
Bash now binds its special emacs-mode functions directly into
emacs_meta_keymap so that eight-bit character handling does not interfere
Some source restructuring: more extern functions are defined in header files
and not in C source files
The handling of `line number' inside functions is now more correct and
closer to reality
Some functions of `general use' were moved to general.c (vfree,
full_pathname)
A bug that caused some redirections to be applied twice was fixed in
execute_command_internal (dispose of redirection_undo_list after copying it;
ditto for exec_redirection_undo_list)
The exit status of a command that is not found is 126, as Posix.2 specifies
More speed improvements -- bash now runs as fast as the SunOS sh on
Haertel's `shell benchmark'
Instead of returning pointers to -1, bash and the readline, history, and
glob libraries now return pointers to special `error pointers', which the
calling code checks for in place of -1
Fixed a problem with canonicalize_pathname which made it get
confused with xxx/./yyy if yyy was `.' or `..'
Fixes to make bash recognize SVR4.2 and set USGr4_2 for SVR4.2 systems
Fixes to the HP/UX machine descriptions to make alloca work on HPUX_9
and to avoid `M_MACHINE redefined' warnings
Fixes to the CRAY machine description
Fixes to the mailpath code to make it Posix.2-compliant -- backslash
may now quote `%' and `?'
The namespace was further cleaned up, and more functions and variables
were made static
On systems with S_IFSOCK or S_ISSOCK defined in sys/stat.h, bash checks
whether fd 0 is a socket to decide whether or not it's being started by
rshd and to run the startup files
Bash now gives the signal mask it inherits to its children -- previously,
login shells cleared the signal mask
cpp-Makefile and subst.c both used the `USE_GLOB_LIBRARY' define, but
with different meanings; subst.c now uses `USE_POSIX_GLOB_LIBRARY'
Fixed pattern substitution so that ${a%%$b}, where b was unset, no longer
causes a core dump
Changed the `test_exit' define in test.c to no longer use `longjmp' as
the rhs or a comma-ized expression; this causes core dumps on some
optimizer/machine combinations
A speed hack in variables.c: if no local variables are defined for a level
of shell context, kill_all_local_variables does not need to search the
whole variable hash table when popping a context
Fixed the `bind' builtin so that -m now changes the keymap for all of the
subsequent operations
Changed some more builtins to use internal_getopt: bind, command, export,
readonly, declare, typeset
Fixed fc to use the Posix.2 format for listing commands in the
history list
Changed bg to set `!', as Posix.2 specifies
Fixed ulimit.def to compile if RLIMIT_RSS is not defined,
as some systems seem to have it
Replaced lib/malloc/alloca.c with the version from emacs 19. The old one
lives in alloca.c.old
malloc.c now uses the ANSI C features to `stringize' macro arguments if
__STDC__ is defined
Fixes to the GNU malloc library from glibc 1.06 and Mike Haertel
Fixes to readline key binding and lookup for Cray systems, which don't
like the casting that readline does
Fixes to all readline library source files to clean up the code: make sure
`int'-returning functions use `return x;' rather than `return;', declare all
arguments, even the `int' ones, and make some functions void. Cleaned up
the code formatting a little, too.
The readline completer now double-quotes filenames with special word-break
characters, so that tilde expansion still works
^C now breaks out of keyboard macros
If being compiled as part of the shell, readline no longer attempts to
handle SIGTTIN, SIGTTOU, or SIGTSTP
tilde_expansion_failure_hook is now a CPFunction rather than a Function,
since that's how it's used
Readline vi-mode `change case' function now skips over characters which
are neither upper nor lower case
Readline vi-mode now allows replacement to be redoable with `.'
2. New Features
A `strict Posix.2' mode, enabled with the -posix startup option or
setting the POSIXLY_CORRECT variable (see CWRU/POSIX.NOTES for a
description of the changed behavior)
`ONESHOT' is now an option in config.h
cpp-Makefile assumes that fixed header files are present if gcc is being
used
The redirections attached to a function declaration are now part of that
function, applied when the function is executed, as specified by Posix.2.
This caused a change to parse.y that resulted in 66 shift/reduce
conflicts(!)
All of the OP= functions that Posix.2 specifies are now implemented for
both `let' and arithmetic substitution
The `command' builtin has acquired the Posix.2 `-v' and `-V' options
(this shares code with the `type' builtin)
A new `bash_builtins' man page, like the `csh_builtins' page on some
systems
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,584 @@
This documents the changes between the first `public' release of CWRU bash
and this, its second release. It summarizes, without going into detail,
the changes that have been made.
NEW FEATURES
o `getopts' builtin, as specified by Posix.2
o new configuration variable HAVE_UNISTD_H, used to include
<unistd.h> and test for Posix features
o `ulimit' has new -p and -n options to report the pipe buffer size
and number of available file descriptors, respectively
o allow SIGCHLD to be trapped and useful behavior to result if it is
o Posix termios and signal code for readline and the shell itself
o can optionally use the GNU termcap library
o new output for `times' builtin that looks like ksh:
shell-user shell-sys
child-user child-sys
o `ulimit' limits now apply to both shell and its children
o new machines.h entries
o no longer does the costly `close file descriptors 3-NOFILE'
each time it exec's a program -- now uses the close-on-exec
flag for the files it fiddles with
NOTABLE BUG FIXES
o jobs.c only sets and gets the tty state in an interactive shell
o bash does better process group checking on Posix systems, eliminating
some error messages
o fix for `infinite login' bug on System V machines when executing a
script from a .bash_profile
o the `trap' command now behaves as 1003.2 specifies, as of draft 9
o restore original terminal process group upon exit, so as to not
confuse a parent Bourne shell
o `bash file', where `file' is a binary file, now reports an error
o shells started with `-s' now execute the .bashrc file
CHANGES (by date and files affected)
9/20 - 9/30
-----------
builtins.c, builtins.c.posix
- added getopts help text
- removed extra "let" from `let' error message
- added correct extern definition for list_rest_of_args() to shift
builtin
jobs.c, jobs.c.posix
- removed bogus call to set_process_resource_limits() from
make_child() as a consequence of redoing `ulimit'
- initialize shell_tty to -1
- only get or set the tty state after a command completes if the shell
is interactive
- use shell_tty in get_tty_state() and set_tty_state() instead of
reopening /dev/tty every time
jobs.c.posix
- do better pgrp checking in initialize_jobs() to avoid error message
about not being able to setpgid(2) on startup
- changed tcsetattr() error messages slightly
expr.c
- avoid advancing beyond the end of the expression when reporting an
error
- NULL expressions now return 0 ($[], for example)
mailcheck.c
- #ifdef redundant definition of NOW, which is also defined in
general.h
variables.c
- initialize $OPTIND and $OPTERR to 1 for getopts
- add correct extern definition for itos()
subst.c
- if $IFS is unset, it defaults to " \t\n"
- add special variable hack functions for $OPTIND, $OPTERR
builtins.h
- add definition for getopts_builtin()
getopts.c
- new file, source for `getopts' builtin command
ulimit.c
- remove the `struct ResourceLimit' stuff; limits now apply to both
the shell and its children
- took out set_process_resource_limits(), let ulimit(2) or
setrlimit(2) do the work
- changed error messages to use builtin_error() instead of
report_error()
- changed the block factor for RLIMIT_CPU from 1000 (milliseconds)
to 1 (seconds)
10/1
----
builtins.c, builtins.c.posix
- changed `test' help text for -ef option
- made `trap -' reset all signals to their original values
machines.h
- added a new configuration variable, HAVE_UNISTD_H, which should
be defined if /usr/include/unistd.h exists
cpp-Makefile
- make HAVE_UNISTD_H show though from machines.h to the bash code
- add an explicit build line for ulimit.o so `psize.sh' is run
each time ulimit.o is remade. This is kind of flaky.
config.h
- include <unistd.h> if HAVE_UNISTD_H is defined, use it to test
for various Posix features (job control, signals, termios)
jobs.c, jobs.c.posix
- restore original signals to child process in make_child()
- keep count of number of children that exit or stop in flush_child(),
and call a trap handler for SIGCHLD that many times. This allows
SIGCHLD to be trapped without disaster occurring.
shell.c
- If we're on a Posix system, initialize signals the Posix way
- clear signal mask in initialize_signals() if on Posix system
- set login_shell and make_login_shell to 0 upon entry to main(),
solving the System V infinite login bug
trap.c
- preserve value of $? when running traps
- don't allow a signal ignored upon entry to the shell to be trapped
or reset to the default
- do not allow trapping SIGCHLD to change the signal handler, but
save the commands to be executed. Run these commands from the
SIGCHLD signal handler for each child that exits or stops
- don't allow SIGCHLD signal handler to be overridden or have SIGCHLD
ignored
- new function added to restore all trapped signals to their original
values
ulimit.c
- add new -p option to report pipe buffer size. This is flaky on
all non-Posix systems (those that do not define PIPE_BUF).
readline/readline.c
- add Posix termios and signal code
10/2
----
jobs.c, jobs.c.posix
- only fetch terminal state in initialize_jobs() if the shell is
interactive
10/3
----
machines.h
- new entry for Stardent
- new variable USE_TERMCAP_EMULATION, for those systems that have the
termcap(3) functions in the curses library, but have not linked
/usr/lib/libtermcap.a to libcurses.a
cpp-Makefile
- use USE_TERMCAP_EMULATION to set TERMCAP and TERMLIB
siglist.c, alias.h, general.c
- declare the return values of xmalloc() and malloc() for the benefit
of machines which cannot cope with simply casting the return value
shell.c, execute_cmd.c
- change the re-execution of main() when executing a shell script to
use setjmp/longjmp
builtins.c
- add code to change the shell level in exec_builtin(), decrementing
it before trying the execve(2) and incrementing it again if that
fails
variables.c
- new function adjust_shell_level() to change shell level by a
specified increment
- initialize `noclobber' in shell_initialize(), if we have inherited
the `noclobber' variable from a parent shell
ulimit.c
- add new option -n, which reports the max number of available file
descriptors as reported by getdtablesize(). On SunOS 4.1, this
can be set, too, with setrlimit(RLIM_NOFILE, ...).
10/4
----
readline/readline.c
- Ultrix turns off system call restart when executing in `Posix mode'
(when sigaction(3) is used to set signal handling), so make it use
the System V version of shell_getc()
jobs.c.posix
- fix a bug in start_job() where `oset' was not initialized in the first
call to sigprocmask(), yet was used in subsequent calls
- remove the `shadow' instance of shell_tty_info in the code that sets
the line discipline in initialize_jobs()
shell.c
- if job control is being used, restore the tty pgrp to its original
value so as to not screw the parent
builtins.c, builtins.c.posix
- make the output of `times' look more like ksh
10/5
----
jobs.c.posix
- HP/UX no longer needs the signal handler for SIGCHLD reset via a
call to signal() in flush_child() -- this breaks job control
machines.h
- add HAVE_VPRINTF to HP/UX entry
siglist.c
- include <stdio.h>, sprintf(3) requires it on some systems
10/8
----
execute_cmd.c
- make $LINENO in a function count the number of simple commands
executed
10/9
----
termcap, cpp-Makefile
- new GNU termcap library, cribbed from Emacs. #define
USE_GNU_TERMCAP in machines.h entry to use it. Small changes
required to cpp-Makefile to make it work. This works on
4.3 BSD, at least.
machines.h
- add new entry for AIX/370
general.c
- sysv_getc() is also needed for Ultrix machines running in Posix
mode, so change the #ifdef accordingly (Ultrix passes the
SV_INTERRUPT flag to sigvec(2) in sigaction(3)).
subst.c
- use sysv_getc() for Ultrix machines running in Posix mode for
command subsitution pipe reading
10/10
-----
shell.c, execute_cmd.c
- if the `file' portion of `bash file' is a binary file, report an
error and do not attempt to execute it
jobs.c, jobs.c.posix
- the code that does the guts of `kill' now sends the SIGCONT to a
stopped job after it sends the specified signal, not before
10/11
-----
parse.y
- set +H also turned off putting commands into the history list
shell.c
- make shells started with -s read .bashrc
10/14
-----
expr.c
- changed calls to `report_error' to call `builtin_error'. I don't
know if this is exactly right, but it seems to me that an error
in an expression shouldn't kill the shell if -e is set.
fc.c
- changed `report_error' to `builtin_error'
10/16
-----
readline/vi_mode.c
- repeat count to rl_vi_subst() was incorrectly being ignored
- don't call rl_vi_change_case() on an empty line; two calls in
a row can cause a seg fault
10/17
-----
execute_cmd.c
- give builtins run in pipes a useful setting of top_level to
longjmp(2) to on errors
builtins.c, builtins.c.posix
- replace some occurrences of longjmp (top_level, ...) with simple
calls to return (EXECUTION_FAILURE)
10/18
-----
readline/readline.c
- Make O_NDELAY be the same as O_NONBLOCK on Posix systems
- Don't use IXANY if it's not defined (some strict Posix systems do
not define it)
- Posix systems need NOFLSH for c_lflag to avoid flushing the input
buffer after a SIGINT, SIGQUIT, or SIGSUSP. This is still wrong,
though.
execute_cmd.c, test.c, general.h
- use the Posix S_IS* macros to test file formats instead of explicitly
masking with S_IFMT and testing the result. Macros are provided
for those systems that do not have them (like 4.3 BSD).
parse.y
- fix expansion of \W in the prompt string so that it works when
you're in the root directory
machines.h
- add machine description for concurrent in UCB universe
Makefile
- make sure $(MFLAGS) is passed to the recursive make of bash-Makefile
10/22
-----
jobs.c.posix
- make sure the NOFLSH bit is turned on in the termios c_lflag word
so that typeahead doesn't get flushed on receipt of signals. THIS
HAS BEEN TAKEN OUT.
10/23
-----
execute_cmd.c
- change extract_colon_unit() to increment the path index past a
colon when it is called, before it tries to get the next component
from the path. Without doing this, `.' was always found as the
second component in the path, whether it was actually there or not.
trap.c, shell.c
- made SIGINT trap handling act the same as that of ksh and the BSD
sh. As a side effect (really the reason for doing this in the
first place), `read' is now interruptible.
Makefile
- made the CPPFLAGS definition useful by passing it to cpp when
making bash-Makefile from cpp-Makefile
- made the `echo' line when creating bash-Makefile really echo by
quoting the redirection to bash-Makefile
general.c
- make fcntl.h be included only if NO_DUP2 is defined
10/24
-----
cpp-Makefile
- make libreadline.a depend on the objects, not the sources. Without
this, you could delete on of the .o files to try to force a library
rebuild and have it not happen.
10/25
-----
shell.c
- make a flag of `-' signal the end of option arguments, like the
4.3 BSD sh, and in accordance with the Posix command line syntax
standard
shell.c, builtins.c, builtins.c.posix
- shuffle some code around so -o option can be given on the command
line -- there's no reason why it shouldn't be allowed.
variables.c, variables.h, execute_cmd.c, builtins.c, builtins.c.posix, shell.c,
subst.c, bashline.c, hash.h, variables.h
- change the implementation of shell function and variable storage to
a hash table instead of a singly-linked list
make_cmd.c, shell.c
- bug reports only get mailed out if MAIL_BUG_REPORTS is defined
10/29
-----
bashline.c
- some random cleanups from bfox
- make sure alias expansion is attempted in shell_expand_line () only
if ALIAS is defined
hash.c
- add default case to make_hash_table to force the number of buckets
in the table to be the default if 0 is passed as the number of
buckets
variables.c
- make initialize_shell_variables () call make_hash_table () with an
argument of 0 again (see previous entry).
variables.c, builtins.c, builtins.c.posix
- cleanups because map_over(), all_vars(), all_shell_variables(), and
all_shell_functions () can possibly return NULL lists, and such
lists should not be sorted or freed
trap.c
- make sure we declare `extern int last_command_exit_value' in
run_interrupt_trap ().
variables.c
- Don't override a HOSTTYPE variables that comes in from the
environment
10/30
-----
variables.c
- Fix a bug in variables.c: make_var_array () where it called
array_len on a NULL list
builtins.c, builtins.c.posix
- Add a description of `-m' to the help for the `set' builtin
command
11/1
----
general.c
- added a definition of bzero() for USG machines, because
there is a reference to it in the new variable hashing code
11/2
----
shell.c
- set forced_interactive to 0 in shell_reinitialize(), otherwise
shell scripts get marked as interactive
11/6
----
execute_cmd.c
- eliminated the costly loop from 3 to NOFILE closing all file
descriptors each time we exec a command by setting all file
descriptors > 2 opened as the result of a redirection and internal
to the shell to be close-on-exec, as well as all file descriptors
opened to save others in add_undo_redirect(). `internal to the
shell' means that the redirections were attached to shell builtin.
Other `internal' redirections include while, for, and until
loops, and shell functions. I got scared after reading that
s5r4 provides 2048 fd's per process -- 2045 (mostly useless)
close() calls on *each executed program*? No way, no how.
This caused the other fixes for this file to be discovered.
Unfortunately (there always seems to be a catch), 4.3 BSD up to
4.3-tahoe leaves a file descriptor open in setpwent() if you're
using dbm password files. 4.3+NFS does this if you're not using
YP. Arghhhhhhh... I haven't decided yet what to do about this;
probably just set fd 3 to close-on-exec when the shell is
initialized.
execute_cmd.c
- removed the call to `add_undo_redirect()' when a file is being
closed with the redirection operators [n]<&- and [n]>&-. The
effect was to make those operators useless. Sad to say, I was
probably the dummy who put it in there...
execute_cmd.c
- when calling fcntl(redirector, F_GETFD, 0) in do_redirection() to
find out if a file descriptor is active, do it only if redirector
is not the same as `fd', which you've just opened. This has
spectacularly bad consequences if you do something like
exec 3</dev/tty 4>/tmp/foo 5</dev/null
I'm probably to blame for this, too...
execute_cmd.c
- when saving a file descriptor in add_undo_redirect, make sure we
save the state of the close-on-exec flag, and restore it when
dup2'ing the saved fd back to the orignal.
execute_cmd.c
- when performing a redirection that causes us to open a file, make
sure we at least add an undo record to close the file, even if
the file descriptor is not already active
execute_cmd.c
- when duplicating a file descriptor as the result of a redirection
instruction, make sure to manually duplicate the state of the
close-on-exec flag
11/13
-----
execute_cmd.c
- finally tracked down and stamped out the persistant bug that caused
the shell to hang when doing a command like "history | more" when
there was more than a pipeful of text to send to `more' and you quit
out of `more'after the first screenful. An extra read end of the
pipe was being left open in the shell started to run `history', the
consequence being that that shell at the beginning of the pipeline
would never get the SIGPIPE that would cause it to exit. The fix
is kind of strange: pass around a file descriptor to close whenever
a child process is created in either execute_command_internal or
execute_simple_command. We just pass the file descriptor that we
want closed to the instance of execute_command_internal that runs
the first half of the pipeline, and it gets closed just like we
want.
In the future, this can (and probably should) be made into a bitmap
of file descriptors to close. It wouldn't have to be big, 16 should
be enough given the ability to do close-on-exec.
builtins.c, builtins.c.posix
- changed the one call to execute_command_internal to add the extra
parameter needed by the above fix.
unwind_prot.c
- make without_interrupts() block SIGINT on capable systems (Posix
and systems with BSD sigs) instead of ignoring it, which causes
interrupts to be dropped. Blocking is what you want, anyway.
execute_cmd.c
- add an unwind_protect for the redirections for a function or
builtin. To see why this is needed, define a function shcat:
shcat()
{
while read line
do
echo "$line"
done
}
Now execute "shcat < INSTALL" and try to interrupt it. Bash will
keep reading the lines from INSTALL and trying to execute them
until EOF, at which point the shell exits.
11/14
-----
execute_cmd.c
- a subshell spawned to execute a function or a builtin with a pipe
or an asynchronous function or builtin should have login_shell and
interactive set to 0. That way, if someone is stupid enough to
pipe to `exit' from a login shell, the subshell won't try to exec
.bash_logout.
11/16
-----
builtins.c, builtins.c.posix
- exit status of `type' was wrong for executable files, hashed and
unhashed
bashline.c
- Made bash_complete_filename_internal take just about everything
as a possible filename character. It still can't do completion
of a filename containing blanks if you type one of the blanks,
though -- it needs the blanks-as-word-separators logic to work
at all.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,234 @@
This file documents changes to CWRU bash following its first network-wide
release.
3/15
----
Makefile
- change the declaration of $CPP_ARGS so that CPP_CC can have
embedded blanks, by adding quotes
bashline.c
- some cosmetic changes to the FIGNORE support functions
glob.c
- don't define USGr3 if it's already defined
variables.c
- a declaration for the argument to put_command_name_into_env was
missing
builtins.c
- only print the command name in builtin_error if this_command_name
is non-null
expr.c
- catch something % 0 as an error
subst.c
- make sure this_command_name is set to NULL before calling evalexp,
because evalexp uses builtin_error
3/18
----
variables.c
- changed getenv() to search the inherited environment if the hash
table of shell variables does not exist or has not been created
3/19
----
subst.c
- when doing command substitution, strip only the trailing newlines.
This is in accordance with Posix.2.
general.c
- strip_trailing () has aquired a new flag telling whether to strip
all white space or just trailing newlines.
variables.c
- since some places in the code rely on bind_variable returning a
valid value, the dynamic variable assignment functions have been
changed to take a pointer to themselves as the first parameter:
return ((*(entry->assign_func)) (entry, value));
and then return that value after doing whatever they need to
3/30
----
bashline.c
- disabled builtin commands should not be returned to the readline
completion functions as legal command alternatives
flags.c
- do not redefine NULL; check only after including all needed
.h files
nojobs.c
- fix unconditional reference to status.w_*
- fix typo after call to WIFCORED in wait_for
readline/readline.c
- make sure all calls to BSD signal mechanism are protected by test
for HAVE_BSD_SIGNALS define
- make sure declaration of struct ltchars variable is protected by
test for definition of TIOCGLTC
- change #include file from sys/errno.h to errno.h
- added a new function rl_stop_output (), the non-emacs version of
^S, to go with rl_restart_output. Haven't done anything with it
yet.
- added Posix support in the form of tcflow() calls to
rl_restart_output and rl_stop_output
readline/readline.h
- change the declaration of rl_filename_completion_ignore_function
to extern. It was coming up as multiply defined on some systems
siglist.c
- change #include file from sys/signal.h to signal.h
- some systems define _NSIG but not NSIG. Define NSIG in terms of
_NSIG on those systems
ulimit.c
- change #include file from sys/errno.h to errno.h
subst.c
- string_extract_double_quoted() needs to ignore "" inside `` pair,
but this code should be executed only if the ` is not backslash-
escaped.
- changed sv_uids() to give UID, EUID the integer attribute
automatically
machines.h
- check for the DG AViiON defining either __DGUX__ or DGUX, make
sure DGUX is defined in any case
trap.c
- change run_pending_traps to loop from 1 to NSIG instead of 0 to
NSIG
execute_cmd.c
- For a command run explicitly in a subshell via (), run_exit_trap ()
needs to be called after that command has executed for /bin/sh
compatibility
variables.c
- make $PPID have the integer attribute when it is intialized
4/2
---
subst.c
- make string_extract_double_quoted handle backslash-escaped
` correctly when parsing a `` pair
4/3
---
jobs.c
- make sure job_control is set to 1 before the first time
give_terminal_to is called, so that it does its job and the
process groups are correct.
subst.c
- make string_extract_double_quoted() not turn \\ into \ inside
quoted strings. The translations will be taken care of later.
nojobs.c
- make sure we get the tty state in initialize_jobs(), and don't
try to set it in set_tty_state until we know we have saved
valid settings.
4/6
---
shell.c, execute_cmd.c, shell.h
- shell now exits with status 127 when asked to execute a binary
file as a shell script
builtins.c
- `local' is once again an error outside a function
- `trap' now formats output differently when given no arguments;
the new format is suitable for feeding back to the shell as
input to `trap'
- cleaned up a contradiction in the help text for the `export'
builtin
- `export' and `readonly' now accept a -p flag for Posix.2 compliance
that acts the same as if no flags had been specified, and take a
`--' option to disable further option processing
- `unset' takes a `--' argument to disable further option
processing
- when given the -f flag, unset will now try to unset a variable
if no function is found for the name supplied
- `kill' now takes a -s signal argument as equivalent to -signal
- `kill' takes a `--' argument to disable further option processing,
since a negative number may be used to denote a process group
- `kill -l' now takes arguments and lists the names for individual
signals by number. If the number given as argument is > 128, it
is assumed to be an exit status, and 128 is subtracted before
further processing
builtins.c, variables.c
- `set +' is no more; print_vars_no_values() is no longer needed
flags.c, builtins.c
- `set -C' is now an alias for noclobber
trap.c
- SIGNULL is no longer a valid name for signal 0
getopts.c, subst.c
- resetopts () --> getopts_reset ()
- rewrote getopt() per Brian's request
builtins.c
- `return' is now valid when executing a file with the `.' builtin
and causes the execution to be aborted
execute_cmd.c
- file descriptors > 2 manipulated via `exec' are no longer set to
close-on-exec
4/8
---
cpp-Makefile
- fixed the bad definition of RANLIB if RANLIB_LOCATION was defined
- pass the correct definition of ranlib through to the make of
readline
readline/readline.c
- make sure some defaults for screen size are defined in the case
of a dumb terminal
builtins.c
- `return' now works for aborting files executed with the `.'
builtin
parse.y
- a `"' before a closing ) in a $( ) construct within double
quotes is no longer an error
subst.c
- string_extract_double_quoted now passes everything between $(
and ) through verbatim, without scanning it for double quotes.
This way, `echo "$(echo "*")"' will echo `*' like it should.
documentation/bash.1
- updated to reflect the changes from Posix.2 draft 11.
4/10
----
execute_cmd.c, builtins.c
- changed some instances of absolute_pathname to absolute_program
(like doing PATH, CDPATH searching, the `type' builtin, and
filename hashing)
readline/readline.c
- made rl_deprep_terminal do a little sanity checking on the
values in otio that it is restoring
Minor update of tar files available for FTP from CWRU
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,671 @@
[Beginning of work with version 1.11]
10/31
-----
Makefile
- changed instances of $(AWK) to $(GAWK) -- political correctness from
bfox
builtins.h, builtins/help.def, builtins/mkbuiltins.c
- changed representation of long_doc from a single string to an
array of strings
execute_cmd.c
- only call __setostype() if on isc386 and _POSIX_SOURCE is
defined
general.c
- only define functions for index and rindex if index and rindex
are not already cpp defines
jobs.c
- #undef some things that clash between <sys/ioctl.h> and <termios.h>
on Posix suns
machines.h
- make isc386 machines links with the shared C library explicitly
(-lc_s)
- new entry for a MagicStation (?) from bfox
variables.c
- use a cpp define _CONST_HACK to determine whether the parameter to
getenv() is a char const * (yes for _STDC_, no otherwise)
builtins/type.def
- make found_file local to the block that searches for executable
disk files
11/4
----
execute_cmd.c
- make execute_function_or_builtin use unwind protects to protect
the `return catch' variables
support/getcppsyms.c
- added definitions for M_UNIX, M_XENIX, and _AIX
11/5
----
bashline.c
- fix a call to savestring in command_word_completion_function with
a post-incremented int parameter, since savestring is a macro that
evaluates its argument twice (builtin completion)
lib/glob/fnmatch.c
- add `^' as a character that negates a character class ([])
11/6
----
subst.c
- add a new variable last_command_subst_pid to keep track of the
pid of the last child created for command substitution. Used
to determine whether or not command substitution has taken
place.
execute_cmd.c
- made the exit status of a command that has only assignments and
redirections obey the Posix spec
unwind_prot.c, trap.c
- make sure all sigset_t variables are initialized with sigemptyset
before use
lib/glob/fnmatch.c
- fixed a couple of bugs with [] classes in fnmatch: not checking
whether or not we've hit the ']' and not incrementing the string
argument in the right place
11/7
----
braces.c
- Make backquotes inhibit brace expansion -- defer it until the
subshell runs
- Ditto for $( )
subst.c
- since braces.c now calls unquoted_member and unquoted_substring,
they can no longer be static functions
config.h
- two new configuration options: ALLOW_RIGID_POSIX_COMPLIANCE and
DISABLED_BUILTINS
shell.c, jobs.c
- define and use top_level_signal_mask, restored on longjmps to
top_level by throw_to_top_level
builtins/builtin.def
- use builtin_address to find the function (if so configured) so
that `builtin foo' still works after `enable -n foo'
builtins/common.c
- have both find_shell_builtin, which never finds disabled builtins,
and builtin_address, which does
11/8
----
general.c
- the getdtablesize emulation should ensure that _SC_OPEN_MAX is
defined on Posix systems before trying to use it in a call to
sysconf()
11/10
-----
lib/glob/fnmatch.c
- fixes from Roland McGrath for some of the more egregious bugs
- naturally, Roland missed a few
lib/readline/readline.c
- add missing calls to sigemptyset(), since Posix specifies that
all sigset_t variables be initialized before use using it
- only turn off ISTRIP and INPCK in the termio(s) code if the
character size is 8 bits ((otio.c_cflag & CSIZE) == CS8)
- Sequents running Dynix/ptx should include <sys/pte.h> rather
that <sys/ptem.h>
builtins/type.def
- change a call to printf to builtin_error when printing a
diagnostic that something is not found
builtins/times.def
- changed file inclusion code to include <sys/time.h> and
<sys/resource.h> if HAVE_RESOURCE is defined, then to include
<sys/times.h> if !HAVE_RESOURCE and RUSAGE_SELF is not defined.
This catches systems with deficient <sys/resource.h> files
11/11
-----
lib/readline/readline.c
- Don't try to dereference funmap in rl_named_function() if it's
null (as it is before rl_initialize_funmap is called)
11/12
-----
lib/readline/readline.c
- backed out of change of 11/11 to rl_named_function
bashline.c
- add a state variable bash_readline_initialized to keep track of
whether or not readline has been initialized with a call to
initialize_readline()
builtins/bind.def
- if readline has not been initialized the first time this is
called, call initialize_readline
11/13
-----
execute_cmd.c
- execute_subshell_builtin_or_function would only let the output
of `jobs' be piped if pipe_in and pipe_out were both != NO_PIPE
(?). Obviously a typo.
builtins/command.def
- add an unwind_protect to dispose of the new command created
by the call to make_bare_simple_command
builtins/jobs.def
- add the `jobs -x command args' form from the System V.4 sh
All job specs in `args' are replaced with the appropriate
job's process group id and `command' is executed
builtins/getopt.c
- if getopt() finds that optind > argc when it is called, it
sets optind = argc and returns EOF
builtins/times.def
- backed out of 11/10 change. Some systems, most notably
HP/UX have all the correct includes and defines and simply
do not implement getrusage(). At all.
subst.c
- if sv_optind finds that OPTIND has been unset or set to an
empty string, call getopts_reset (0). The Gnu getopt
resets its internal state when optind == 0.
- call getopts_reset(0) if OPTIND=1, because that's what the
Posix spec says to use to reset
11/14
-----
builtins/alias.def
- fixed a typo in the SHORT_DOC for the unalias builtin
builtins/shift.def
- allowed the shift count to be 0
11/15
-----
lib/readline/readline.c
- turn on 8 bit characters if NO_EIGHT_BIT_CHARACTERS is not
defined and the Posix termios code path is being taken
[The following two entries describe what's needed for an initial
implementation of the vi mode `.' command]
lib/readline/vi_mode.c
- new variables:
vi_last_command: last command that modified text in
the buffer
vi_last_repeat: the repeat count to vi_last_command
vi_last_arg_sign: arg sign for vi_last_repeat
vi_last_motion: the last motion qualifier for the
text modification commands that use one
vi_redoing: state variable, if 1 we're re-doing a
command
vi_textmod: list of commands that modify text
(initially "_*\\AaIiCcDdPpYyRrSsXx~")
- new functions:
rl_vi_redo: an initial implementation of the vi mode
`.' command
rl_vi_set_last: initialize the state of the new variables
described above
rl_vi_textmod_command: return true if command passed is
a text modification command
- changed rl_vi_domove to save the movement command information in
vi_last_motion
- changed rl_vi_movement_mode to call rl_vi_set_last to initialize
the `last command' state
lib/readline/readline.c
- changed rl_dispatch to save vi_last_command, vi_last_repeat,
and vi_last_arg_sign
- changed rl_newline to call vi_set_last
lib/readline/readline.h
- new function rl_vi_redo
lib/readline/vi_keymap.c
- bind rl_vi_redo to `.'
11/20
-----
posixstat.h
- make isc386 defines for S_IFDIR and S_IFMT be used if they
do not already appear, no matter whether or not gcc is being
used for the compile
machines.h
- new entry for Omron Luna 88k running Mach 2.5 (nice machines)
lib/readline/vi_mode.c
- fixed a bug with rl_vi_domove and the last word on the line.
If rl_point ended up > rl_end, it was being set to rl_end - 1
rather than to rl_end.
cpp-Makefile
- quote the values of RANLIB and AR passed to makes in
subdirectories
shell.c
- instead of making all Xenix systems swap the second and third
arguments to setvbuf, make that behavior dependent on the
definition of REVERSED_SETVBUF_ARGS
11/21
-----
lib/readline/readline.c
- fixed an error in rl_forward that caused vi-mode to walk off
the end of the line after executing `l' in command mode on an
empty line
11/22
-----
support/getcppsyms.c
- added the `luna88k' define
11/24
-----
execute_cmd.c
- all calls to dup2 in do_redirection_internal should be checked
for errors and the redirection should fail if the dup2 fails
shell.h, parse.y, execute_cmd.c, print_cmd.c, make_cmd.c
- replaced the single redirection operator `r_duplicating' with
r_duplicating_input and r_duplicating_output to avoid the
read 1<&7 getting printed as read 1>&7 problem:
foo()
{
exec 9</dev/tty
read 1<&9
exec 9<&-
}
is printed wrong when `type foo' is executed
shell.h
- added two new redirection_operators, r_duplicating_input_word and
r_duplicating_output_word to implement true sh semantics for
[n]<&word and [n]>&word
parse.y
- eliminated the old yacc production for >& word, meaning put stdout
and stderr into `word'
- added productions for [n]<&word and [n]>&word that use the new
redirection operators
execute_cmd.c
- the first thing done in do_redirection_internal is now a check for
r_duplicating_input_word and r_duplicating_output_word. If the
redirection is one of those two, `word' is expanded and a new
redirection is made
print_cmd.c
- new code to print the [n]<&word and [n]>&word redirections
(r_duplicating_input_word and r_duplicating_output_word)
make_cmd.c
- new code for make_redirection to handle r_duplicating_input_word
and r_duplicating_output_word
documentation/bash.1
- added documentation for the -x option to `jobs' + minor cleanups
and corrections
11/25
-----
cpp-Makefile
- added GCC_EXTRAS for gcc-specific compiler flags
execute_cmd.c
- removed some unused functions (close_all_files) and variables
(file_exists_p)
parse.y
- added new command-oriented-style history: all lines of a multiple
line command will be added to the same history line
- new variable current_command_line_count to keep track of the
number of lines in the current command. If > 1, a line is appended
to the current history line to implement command-oriented history
- new function bash_add_history
shell.c
- added code to reset current_command_line_count to 0 before calling
parse_command and yyparse
subst.c
- the command-oriented history is controlled by the setting of the
variable command_oriented_history
builtins/reserved.def
- a new help topic: `variables', giving help on some common shell
variables
11/26
-----
lib/glob/glob.c
- if the filename portion of the pathname to be matched is null
(e.g. a*/), do not call glob_vector to attempt to match each
file in the expanded directories against the null string.
11/27
-----
lib/glob/glob.c
- force globbing of directory names even if the metacharacters
contained therein are protected by backslashes. The globbing
strips the quotes correctly
shell.c
- make sure current_command_line_count is declared everywhere
it's used
parse.y
- remove declaration of history_lines_this_session from
pre_process_line
- add extern declaration of history_lines_this_session to
bash_add_history
12/2
----
trap.h
- removed inclusion of <sys/types.h> because most files include it
themselves, and this is dangerous on systems that do not protect
against multiple inclusion of header files
trap.c
- include <sys/types.h> before "trap.h" since it was the only file
in the distribution not to do so
shell.c
- Install the SIGINT sighandler the Posix way on machines with
_POSIX_VERSION defined
12/3
----
dispose_cmd.c
- make sure dispose_redirects properly handles r_duplicating_input_word
and r_duplicating_output_word by freeing the `filename'
execute_cmd.c
- fix do_redirection_internal to copy new_redirect->redirectee.filename
using alloca() so no memory has to be freed at function exit
12/4
----
parse.y
- expand \n in PS1 or PS2 into \r\n only if line editing is enabled
shell.c
- define top_level_mask if _POSIX_VERSION defined
newversion.c
- made it write a definition of SCCSVERSION to version.h -- an SCCS
string so the `what' command will be useful
version.c
- new variable `sccsversion' set to SCCSVERSION
12/5
----
builtins/fc.def
- make fc_gethist check that the history list is non-null before
trying to access its members
12/6
----
lib/readline/readline.c
- changed the ISTRIP code (again) to force bash to disable ISTRIP
only if the tty driver guarantees eight bits (cflag & CSIZE == CS8)
12/9
----
lib/readline/readline.c
- tgetent returns 0 if it can't find the terminal name in /etc/termcap,
so we failed if it returns <= 0, not < 0.
12/11
-----
machines.h
- Sony machines running NEWS-OS 4.0 (V.4) should have strerror(),
so define HAVE_STRERROR
- Pyramids running BSD do not all have the vprintf family of functions,
so remove the definition of HAVE_VPRINTF
12/12
-----
parse.y
- make sure that shell_getc always checks that shell_input_line is
valid before trying to reference shell_input_line[0]
12/13
-----
mailcheck.c
- Since `dollar_underscore' saves the value of $_ in a local variable,
it's possible that bind_variable can free and reallocate the cell
for $_, leaving dollar_underscore pointing at freed storage. The
fix is to copy it into freshly-allocated memory.
- ensure that when saving and restoring dollar_underscore that we do
not try to call strlen on a null string
12/15
-----
general.c, execute_cmd.c
- moved the utility function `all_digits' from execute_cmd.c to
general.c
builtins/kill.def
- remove use of sscanf, used calls to all_digits and atoi instead
machines.h
- if not using gcc, need to make SYSDEP_LDFLAGS = -Xp for Posix
on isc386
12/16
-----
machines.h
- isc386 has multiple groups
execute_cmd.c
- add a QUIT to the while loop in find_user_command_in_path that
searches the path, so users can interrupt a lengthy path search
12/17
-----
builtins/alias.def
- added the Posix-specified -a option to unalias, made unalias obey
the getopt argument syntax guidelines
builtins/jobs.def
- made `jobs' handle the -- option to signal the end of arguments
flags.c
- Posix.2a has specified that the -b flag stand for asynchronous
notification, so move the definition of asynchronous_notification
here and add a new entry to the `flags' struct if JOB_CONTROL is
defined
flags.h
- add an extern declaration of asynchronous_notification
jobs.c
- change the definition of asynchronous_notification to extern, since
it's now declared in flags.c
builtins/set.def
- change documentation strings to add -b option, note that
set -o notify is now the same as set -b
- change the code to make set -o notify the same as set -b
(list_long_opts(), take the special case out of set_minus_o_option)
12/19
-----
lib/readline/readline.c
- added support for $LINES, $COLUMNS. The variables are read after
the ioctl(TIOCGWINSZ) and before calls to tgetent
builtins/fc.def
- made the fc output format correspond to that specified by Posix.2a
("%d\t%s\n")
12/20
-----
execute_cmd.c
- user_command_matches did not properly handle a null $PATH element,
which should be the same as ".". Changed the code to mirror
find_user_command_in_path ()
12/23
-----
execute_cmd.c
- added a new function get_next_path_element, which calls
extract_colon_unit and interprets the result, translating
"" to "."
builtins/cd.def
- added description of -l option to dirs short_doc
- fixed the bug that caused `dirs' to always print an extra
trailing space
documentation/bash.1
- added description of -l option to dirs
parse.y
- added optional leading ( for case clause, as per Posix.2
12/30
-----
lib/readline/vi_mode.c
- removed unused variable `added_blank'
bashline.c
- added dynamic completion from bfox
execute_cmd.c
- redirections must be performed in a child before execution of
the command is attempted or aborted (because it's not found
by a hash table or $PATH search), according to Posix.2
getcwd.c
- new file, from the Gnu C library, for systems that don't do
this right -- they use popen("/bin/pwd", "r") instead
12/31
-----
builtins/type.def
- the type builtin would not report a name as not found if any name
had previously been found because the flag variable used to report
this (found_something) was not reset each time through the loop.
Added a variable `found_any' to be global and reset found_something
to 0 each time through the loop
1/4
---
builtins/jobs.def
- make sure that the call to add_unwind_protect in
execute_list_with_replacements is made after the new command
struct is completely initialized
support/mksysdefs
- look for /dev/fd, define HAVE_DEV_FD if present
cpp-Makefile
- pass HAVE_DEV_FD through to make in SYSTEM_FLAGS
shell.c, execute_cmd.c
- call unlink_fifo_list only if HAVE_DEV_FD is not defined and
PROCESS_SUBSTITUTION is defined
subst.c
- new function make_dev_fd_filename to return /dev/fd/xx, where
xx corresponds to the parent end of the pipe
- all the named pipe utility functions should be #if !defined
(HAVE_DEV_FD)
- change process_subsitute to do the following on systems with /dev/fd:
1. Make a pipe in the parent
2. if (open_for_read_in_child)
parent_pipe_fd = fildes[1]
child_pipe_fd = fildes[0]
else
parent_pipe_fd = fildes[0]
child_pipe_fd = fildes[1]
3. pathname = make_dev_fd_filename (parent_pipe_fd);
4. fork
5. In parent, close child_pipe_fd and return pathname
6. In child, turn off job control, dup child_pipe_fd to
either fd 0 or 1 depending on OPEN_FOR_READ_IN_CHILD,
close parent_pipe_fd, parse and execute the string,
and exit
shell.c
- added call to unlink_fifo_list in reader_loop so that all fifos
get closed, even after builtin commands are executed
1/6
---
machines.h, make_cmd.c, print_cmd.c, shell.c, cpp-Makefile
- HAVE_VPRINTF --> HAVE_VFPRINTF
cpp-Makefile, machines.h, test.c
- HAVE_MULTIPLE_GROUPS --> HAVE_GETGROUPS
cpp-Makefile, machines.h
- HAVE_SIGLIST --> HAVE_SYS_SIGLIST
parse.y
- add if_command production
builtins/echo.def
- validate all arguments before using them so that -nanything != -n
- document the -E option and its use
builtins/umask.def
- allow other arguments to be used with -S
subst.c
- make sure to close all files in the child created to run a
process substutition to avoid holding write file descriptors
to pipes that will cause the shell to hang
1/7
---
cpp-Makefile
- fixed a typo: SEARCHLIB -> SEARCH_LIB
machines.h
- new description for Amiga 3000 running System V.4
shell.c
- default secondary prompt is now "> "
builtins/bashgetopt.c
- more internal cleanups and bug fixes
support/mksysdefs
- detect the amiga by the presence of /usr/amiga
1/9
---
general.c
- canonicalize_pathname should remove ./ only if it's at the
beginning of the pathname, or immediately preceded by a `/'
1/10
----
documentation/bash.1
- clean up the documentation for test -t, since according to
Posix, it always requires an argument
general.c
- don't build index and rindex for DG machines
machines.h
- description for System V.4 on IBM 370 architecture
- fixed up DG/UX machine description
@@ -0,0 +1,251 @@
[ Work begins after network release of version 1.11 ]
1/11
----
nojobs.c
- Posix systems now reap zombie children and retry a fork() once if
it fails
- Posix systems should use waitpid() rather than wait() wherever
possible
- Posix systems do not need to validate a pid before calling waitpid()
in wait_for_single_pid(); waitpid takes a pid argument
1/13
----
execute_cmd.c
- get_next_path_element can return NULL, so the code that calls it
must take that possibility into account
jobs.c
- there was an extra parameter in the select() call
builtins/type.def
- successful_finds needed to be initialized to 0
machines.h
- fixed a typo (_D -> -D) in the DG/UX machine description
1/14
----
execute_cmd.c
- fixed extract_colon_unit to return "" in the case of a trailing
colon in the path
INSTALL
- note that on SCO Xenix 386 one must use cc -E rather than /lib/cpp
to process cpp-Makefile
cpp-Makefile
- fixed the problem of a single quote in a makefile comment
machines.h
- Xenix 386 machines need -DUSG in SYSDEP_CFLAGS
lib/readline/readline.c
- changed the includes around so that the Xenix 386 support is
in the same section as the USGr3 code, and the Xenix 286
support is in the same section as the plain USG code
shell.c
- split the `int code = setjmp (top_level)' statement in
reader_loop into two statements -- some compilers don't like
it
parse.y
- changed the overloaded `yy_input_dev' to a `union STREAM',
where a `union STREAM' is
typedef union STREAM {
FILE *s_file;
char *s_string;
} STREAM;
and changed the parameter to init_yy_io and all the functions
that call it to use a STREAM argument instead of casting back
and forth between a (char *) and a (FILE *)
builtins/times.def
- If hpux or USGr4, #undef HAVE_RESOURCE, rather than try to fit
all the special cases onto a single line deciding whether or
not to include <sys/resource.h>
1/15
----
bashline.c
- changed the bindable name for the ksh-style ^O function from
operate_and_get_next to operate-and-get-next
execute_cmd.c
- some systems (e.g SGI) allow the result of alloca to be assigned
only to a `simple' variable, so I introduced a dummy one instead
of assigning to redirectee->word directly
shell.c
- fixed a typo: PENDANTIC -> PEDANTIC
machines.h
- took -DREVERESED_SETVBUF_ARGS out of the entries for Xenix 386
cpp-Makefile
- added double quotes around the RHS of the assignment to
SYSTEM_NAME to avoid further cpp processing if the system name
happens to be a cpp define
bashline.c
- added `search-forward', `search-backward' functions that perform
non-incremental history searches using the vi-mode code
1/16
----
builtins/ulimit.def
- fixed a typo in a comment
- added parens around the object in an #if defined preprocessor
statement
machines.h
- the Xenix 386 machine descriptions need to #undef HAVE_GETWD
builtins/read.def
- Fixed read to treat backslash as an escape character unless
-r is given, as per Posix.2
lib/readline/readline.c
- Fixed up the maze of dire[cn]t includes and defines so that
they're correct for Xenix (finally)
lib/glob/glob.c
- ditto. Now the defines/includes are correct for Xenix 386
execute_cmd.c
- a loop of the form
while : ; do echo -n 1; done
can run a machine using Gwyn's alloca() emulation out of memory
because alloca() keeps getting called at the same stack level
and never frees anything up. Added a call to alloca(0) after
the call to execute_simple_command in execute_command_internal
- added Karl Kleinpaste's workaround for the AFS file creation
bug, dependent on AFS_CREAT_BUG
parse.y
- \s in a prompt string needs to decode to the shell basename, as
per the documentation, rather than the full shell name
1/17
----
nojobs.c
- fixed a typo in one of the WAITPID calls, thanks to Bruce Evans
[At this point, all of these fixes were sent along to bfox]
support/getcppsyms.c
- now recognizes cpp symbol __hppa for use on HP precision
architecture machines
machines.h
- M_MACHINE is now `hppa' for HP Precision Architecture machines, so
to make sure hpux is defined, it's now in SYSDEP_CFLAGS
- Make sure that the RS6000/AIXv3 description defines M_OS as AIX,
not "AIX". The quotes are added in cpp-Makefile
1/27
----
parser.h
- new file, contains structures necessary to parse commands
input.h
- new file, contains definitions and structures used to read input
bashline.c
- removed the definitions for search-backward, search-forward
cpp-Makefile
- removed the definition of DESTDIR; now passed down from Makefile
error.c, error.h
- new files to isolate the error-handling functions
command.h
- new file including structures used internally to represent
commands
parse.y
- include input.h, parser.h
- changed all the code that deals with input streams to fit the
new framework defined in input.h
make_cmd.c
- moved the error reporting code to error.c
- added cpp code to ensure that alloca is defined correctly
shell.h
- removed the code that was moved to input.h, parser.h, command.h
builtins/common.c
- moved a call to setjmp out of an if statement
- changed the input code to work with the new input framework
builtins/getopt.c
-include config.h if compiling for the shell
lib/readline/readline.c
- change representation of characters > 127 to octal
rather than M-c
- changed representation of characters < ' ' to ^X rather
than C-x
- fixed a memory leak in parser_if () by freeing `tname'
machines.h
- removed MIPS_CFLAGS from the ultrix Decstation entry, since the
limit no longer needs increasing
variables.c
- move the initialization of PWD before the environment is read, so
an exported version of PWD takes precedence
readline.c, funmap.c, emacs_keymap.c
- removed support for rl_arrow_keys -- it should now be done by the
inputrc file
documentation/bash.1
- only non-job-control shells start background jobs ignoring SIGINT
and SIGQUIT
builtins/umask.def
- don't print the octal representation of the umask if the symbolic
representation has already been displayed
- a bad option to umask should return EXECUTION_FAILURE, not -1
shell.c
- new function, init_signal_handler (sig), to initialize the SIG
signal hander, call it in main loop
nojobs.c
- call init_signal_handler (SIGINT, sigint_sighandler) so the correct
thing happens on Posix systems
general.c
- updated the comment above the fallback implemenation of killpg()
machines.h
- machine entry for the Unix PC
- new variable HAVE_DIRENT
1/28
----
machines.h
- SCO needs to #undef HAVE_GETCWD so that the getcwd() function
supplied with bash is used
subst.c
- USG machines should include <string.h>, others <strings.h>
- sub_append_number should use itos() rather than xmalloc and
sprintf
builtins/ulimit.def
- changed the resource limit struct to one that has no explicit
size to account for systems with differing numbers of resource
limits
lib/readline/readline.c
- there was an off-by-one error in the code that counts the number
of items to list when doing completion listing
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,268 @@
# This Makefile for building libbuiltins.a is in -*- text -*- for Emacs.
#
MKBUILTINS = mkbuiltins
RANLIB = ranlib
CFLAGS = -g -I.. -I.
SHELL = /bin/sh
# CC = cc
AR = ar
RM = rm -f
CP = cp
srcdir = .
VPATH = .:$(srcdir)
.SUFFIXES:
.SUFFIXES: .def .c .o
# How to make a .o file from a .def file.
.def.o:
$(RM) $@
./$(MKBUILTINS) $(DIRECTDEFINE) $<
$(CC) -c $(CFLAGS) $(CPPFLAGS) $*.c || ( $(RM) $*.c ; exit 1 )
$(RM) $*.c
# How to make a .c file from a .def file.
.def.c:
$(RM) $@
./$(MKBUILTINS) $(DIRECTDEFINE) $<
# Here is a rule for making .o files from .c files that does not
# force the type of the machine (like -M_MACHINE) into the flags.
.c.o:
$(RM) $@
$(CC) -c $(CFLAGS) $(CPPFLAGS) $<
DEFS = $(srcdir)/alias.def $(srcdir)/bind.def $(srcdir)/break.def \
$(srcdir)/builtin.def $(srcdir)/cd.def $(srcdir)/colon.def \
$(srcdir)/command.def $(srcdir)/declare.def $(srcdir)/echo.def \
$(srcdir)/enable.def $(srcdir)/eval.def $(srcdir)/getopts.def \
$(srcdir)/exec.def $(srcdir)/exit.def $(srcdir)/fc.def \
$(srcdir)/fg_bg.def $(srcdir)/hash.def $(srcdir)/help.def \
$(srcdir)/history.def $(srcdir)/jobs.def $(srcdir)/kill.def \
$(srcdir)/let.def $(srcdir)/read.def $(srcdir)/return.def \
$(srcdir)/set.def $(srcdir)/setattr.def $(srcdir)/shift.def \
$(srcdir)/source.def $(srcdir)/suspend.def $(srcdir)/test.def \
$(srcdir)/times.def $(srcdir)/trap.def $(srcdir)/type.def \
$(srcdir)/ulimit.def $(srcdir)/umask.def $(srcdir)/wait.def \
$(srcdir)/reserved.def $(srcdir)/pushd.def $(srcdir)/shopt.def
STATIC_SOURCE = common.c getopt.c bashgetopt.c getopt.h
OFILES = builtins.o \
alias.o bind.o break.o builtin.o cd.o colon.o command.o \
common.o declare.o echo.o enable.o eval.o exec.o exit.o \
fc.o fg_bg.o hash.o help.o history.o jobs.o kill.o let.o \
pushd.o read.o return.o set.o setattr.o shift.o source.o \
suspend.o test.o times.o trap.o type.o ulimit.o umask.o \
wait.o getopts.o shopt.o getopt.o bashgetopt.o
THINGS_TO_TAR = $(DEFS) $(STATIC_SOURCE) Makefile ChangeLog
CREATED_FILES = builtext.h builtins.c psize.aux pipesize.h
all: $(MKBUILTINS) libbuiltins.a
libbuiltins.a: $(MKBUILTINS) $(OFILES)
$(RM) $@
$(AR) cq $@ $(OFILES)
-$(RANLIB) $@
builtext.h builtins.c: $(MKBUILTINS) $(DEFS)
$(RM) builtext.h builtins.c
./$(MKBUILTINS) -externfile builtext.h -structfile builtins.c \
-noproduction $(DIRECTDEFINE) $(DEFS)
mkbuiltins: $(srcdir)/mkbuiltins.c ../config.h
$(CC) $(CFLAGS) -o $(MKBUILTINS) $(srcdir)/mkbuiltins.c
ulimit.o: ulimit.def pipesize.h
pipesize.h: psize.aux
$(SHELL) $(srcdir)/psize.sh > pipesize.h
psize.aux: psize.c
$(CC) $(CFLAGS) -o $@ $(srcdir)/psize.c
documentation: builtins.texi
$(OFILES): $(MKBUILTINS) ../config.h
builtins.texi: $(MKBUILTINS)
./$(MKBUILTINS) -documentonly $(DEFS)
clean:
$(RM) $(OFILES) $(CREATED_FILES) $(MKBUILTINS) libbuiltins.a
alias.o: alias.def
bind.o: bind.def
break.o: break.def
builtin.o: builtin.def
cd.o: cd.def
colon.o: colon.def
command.o: command.def
declare.o: declare.def
echo.o: echo.def
enable.o: enable.def
eval.o: eval.def
exec.o: exec.def
exit.o: exit.def
fc.o: fc.def
fg_bg.o: fg_bg.def
hash.o: hash.def
help.o: help.def
history.o: history.def
jobs.o: jobs.def
kill.o: kill.def
let.o: let.def
pushd.o: pushd.def
read.o: read.def
return.o: return.def
set.o: set.def
setattr.o: setattr.def
shift.o: shift.def
source.o: source.def
suspend.o: suspend.def
test.o: test.def
times.o: times.def
trap.o: trap.def
type.o: type.def
umask.o: umask.def
wait.o: wait.def
getopts.o: getopts.def
reserved.o: reserved.def
common.o: ../shell.h ../command.h ../config.h ../memalloc.h ../general.h
common.o: ../variables.h ../input.h hashcom.h ../bashhist.h
common.o: ../quit.h ../unwind_prot.h ../maxpath.h ../jobs.h ../builtins.h
common.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
common.o: ../execute_cmd.h ../error.h
alias.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
alias.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
alias.o: ../shell.h ../unwind_prot.h ../variables.h common.h ../maxpath.h
bind.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
bind.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
bind.o: ../maxpath.h ../bashline.h
bind.o: ../shell.h ../unwind_prot.h ../variables.h bashgetopt.h
break.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
break.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
break.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
builtin.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
builtin.o: ../quit.h common.h ../maxpath.h
builtin.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
builtin.o: ../shell.h ../unwind_prot.h ../variables.h
cd.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
cd.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
cd.o: ../shell.h ../unwind_prot.h ../variables.h common.h ../maxpath.h
command.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
command.o: ../quit.h bashgetopt.h ../maxpath.h
command.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
command.o: ../shell.h ../unwind_prot.h ../variables.h
declare.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
declare.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
declare.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
echo.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
echo.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
echo.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
enable.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
enable.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
enable.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
eval.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
eval.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
eval.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
exec.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
exec.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
exec.o: ../shell.h ../unwind_prot.h ../variables.h common.h ../execute_cmd.h
exec.o: ../maxpath.h ../flags.h
exit.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
exit.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
exit.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
fc.o: ../builtins.h ../command.h bashgetopt.h ../bashhist.h
fc.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
fc.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
fc.o: ../flags.h ../unwind_prot.h ../variables.h ../shell.h ../maxpath.h
fg_bg.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
fg_bg.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
fg_bg.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
getopts.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
getopts.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
getopts.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
hash.o: ../builtins.h ../command.h ../quit.h ../execute_cmd.h
hash.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
hash.o: ../shell.h ../unwind_prot.h ../variables.h common.h ../maxpath.h
help.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
help.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
help.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
history.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
history.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
history.o: ../filecntl.h ../shell.h ../unwind_prot.h ../variables.h
history.o: ../bashhist.h ../maxpath.h
inlib.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
inlib.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
inlib.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
jobs.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
jobs.o: ../quit.h bashgetopt.h ../maxpath.h
jobs.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
jobs.o: ../shell.h ../unwind_prot.h ../variables.h
kill.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
kill.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
kill.o: ../shell.h ../trap.h ../unwind_prot.h ../variables.h ../maxpath.h
let.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
let.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
let.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
pushd.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
pushd.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
pushd.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h common.h
read.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
read.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
read.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
return.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
return.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
return.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
set.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
set.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
set.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
setattr.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
setattr.o: ../quit.h common.h bashgetopt.h ../maxpath.h
setattr.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
setattr.o: ../shell.h ../unwind_prot.h ../variables.h
shift.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
shift.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
shift.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
source.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
source.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
source.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
suspend.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
suspend.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
suspend.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
test.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
test.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
test.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
times.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
times.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
times.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
trap.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
trap.o: ../quit.h common.h ../maxpath.h
trap.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
trap.o: ../shell.h ../unwind_prot.h ../variables.h ../execute_cmd.h
type.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
type.o: ../quit.h common.h ../maxpath.h
type.o: ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
type.o: ../shell.h ../unwind_prot.h ../variables.h
ulimit.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
ulimit.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
ulimit.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
umask.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
umask.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
umask.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
wait.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
wait.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
wait.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
shopt.o: ../command.h ../config.h ../memalloc.h ../error.h ../general.h
shopt.o: ../quit.h ../dispose_cmd.h ../make_cmd.h ../subst.h ../externs.h
shopt.o: ../shell.h ../unwind_prot.h ../variables.h ../maxpath.h
shopt.o: common.h bashgetopt.h
bashgetopt.o: ../bashansi.h ../ansi_stdlib.h
mkbuiltins.o: ../bashansi.h ../ansi_stdlib.h
fc.o: ../bashansi.h ../ansi_stdlib.h
#bind.o: $(RL_LIBSRC)chardefs.h $(RL_LIBSRC)readline.h $(RL_LIBSRC)keymaps.h
@@ -0,0 +1,119 @@
# This Makefile is for the Bash/documentation directory -*- text -*-.
#
CP = cp
RM = rm -f
INSTALL_DATA = install -c -m 644
DOC_SUPPORT = ../lib/doc-support/
TEXINDEX = $(DOC_SUPPORT)texindex
TEXINDSRC = $(DOC_SUPPORT)texindex.c
TEX = tex
QUIETPS = #set this to -q to shut up dvips
DVIPS = dvips -D 300 $(QUIETPS) -o $@ # tricky
TEXINPUTS = ./../lib/readline/doc
MAKEINFO = makeinfo
# Change to groff -Tascii if you don't have nroff
NROFF = nroff
# This should be a program that converts troff to postscript
GROFF = groff
HSUSER = ./../lib/readline/doc/hsuser.texinfo
RLUSER = ./../lib/readline/doc/rluser.texinfo
.SUFFIXES: .0 .1 .3 .ms .ps .txt .dvi
.1.ps:
$(RM) $@
-${GROFF} -man $< > $@
.1.0:
$(RM) $@
-${NROFF} -man $< > $@
.ms.ps:
$(RM) $@
-${GROFF} -ms $< > $@
.ms.txt:
$(RM) $@
-${NROFF} -ms $< > $@
.3.ps:
$(RM) $@
-${GROFF} -man $< > $@
.3.0:
$(RM) $@
-${NROFF} -man $< > $@
all: ps info dvi text
ps: bash.ps builtins.ps readline.ps article.ps
dvi: features.dvi features.ps
info: features.info
text: bash.0 builtins.0 readline.0
features.dvi: features.texi $(HSUSER) $(RLUSER)
TEXINPUTS=.:$(TEXINPUTS):$$TEXINPUTS $(TEX) features.texi
$(TEXINDEX) features.??
TEXINPUTS=.:$(TEXINPUTS):$$TEXINPUTS $(TEX) features.texi
features.ps: features.dvi
$(RM) $@
$(DVIPS) features.dvi
features.info: features.texi $(HSUSER) $(RLUSER)
$(MAKEINFO) --no-split -I$(TEXINPUTS) features.texi
bash.dvi: $(TEXINDEX) bash.texinfo $(HSUSER) $(RLUSER)
TEXINPUTS=.:$(TEXINPUTS):$$TEXINPUTS $(TEX) bash.texinfo
$(TEXINDEX) bash.??
TEXINPUTS=.:$(TEXINPUTS):$$TEXINPUTS $(TEX) bash.texinfo
bashman.ps: bash.dvi
rm -f $@
$(DVIPS) bash.dvi
bash.txt: bash.1
bash.ps: bash.1
builtins.ps: builtins.1 bash.1
builtins.txt: builtins.1 bash.1
readline.txt: readline.3
readline.ps: readline.3
article.ps: article.ms
$(TEXINDEX): $(TEXINDSRC)
(cd $(DOC_SUPPORT); $(MAKE) $(MFLAGS) texindex)
hsuser.texinfo: ../lib/readline/doc/hsuser.texinfo
ln -s ../lib/readline/doc/hsuser.texinfo .
rluser.texinfo: ../lib/readline/doc/rluser.texinfo
ln -s ../lib/readline/doc/rluser.texinfo .
clean:
rm -f *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
*.fns *.kys *.tps *.vrs *.o core texindex rluser.texinfo hsuser.texinfo
distclean:
rm -f *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
*.dvi *.info *.info-* *.fns *.kys *.tps *.vrs *.o core texindex \
rluser.texinfo hsuser.texinfo
realclean: clean
install: all
-[ -d $(mandir) ] || mkdir $(mandir)
$(INSTALL_DATA) bash.1 $(mandir)
sed 's:so bash.1:so man1/bash.1:' < builtins.1 > $(mandir)/bash_builtins.1
-[ -d $(man3dir) ] || mkdir $(man3dir)
$(INSTALL_DATA) readline.3 $(man3dir)
-[ -d $(infodir) ] || mkdir $(infodir)
$(INSTALL_DATA) features.info $(infodir)/bash.info
uninstall:
$(RM) $(mandir)/bash.1 $(mandir)/bash_builtins.1
$(RM) $(man3dir)/readline.3 $(infodir)/bash.info
@@ -0,0 +1,92 @@
## -*- text -*- ####################################################
# #
# Makefile for the GNU Glob Library. #
# #
####################################################################
# This Makefile is hand made from a template file, found in
# ../template. Each library must provide several Makefile
# targets: `all', `clean', `documentation', `install', and
# `what-tar'. The `what-tar' target reports the names of the
# files that need to be included in a tarfile to build the full
# code and documentation for this library.
# Please note that the values for INCLUDES, CC, AR, RM, CP,
# RANLIB, and selfdir are passed in from ../Makefile, and do
# not need to be defined here.
srcdir = .
VPATH = .:$(srcdir)
# Here is a rule for making .o files from .c files that doesn't force
# the type of the machine (like -sun3) into the flags.
.c.o:
$(CC) -c $(CFLAGS) $(INCLUDES) $(LOCAL_DEFINES) $(CPPFLAGS) $<
# LOCAL_DEFINES are flags that are specific to this library.
# Define -DUSG if you are using a System V operating system.
LOCAL_DEFINES = $(LOCAL_INCLUDES) #-DUSG
# For libraries which include headers from other libraries.
LOCAL_INCLUDES = -I..
# The name of the library target.
LIBRARY_NAME = libglob.a
# The C code source files for this library.
CSOURCES = $(srcdir)glob.c $(srcdir)fnmatch.c
# The header files for this library.
HSOURCES = $(srcdir)fnmatch.h
OBJECTS = glob.o fnmatch.o
# The texinfo files which document this library.
DOCSOURCE = doc/glob.texi
DOCOBJECT = doc/glob.dvi
DOCSUPPORT = doc/Makefile
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
SUPPORT = Makefile ChangeLog $(DOCSUPPORT)
SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
######################################################################
all: $(LIBRARY_NAME)
$(LIBRARY_NAME): $(OBJECTS)
$(RM) -f $@
$(AR) cq $@ $(OBJECTS)
-[ -n "$(RANLIB)" ] && $(RANLIB) $@
what-tar:
@for file in $(THINGS_TO_TAR); do \
echo $(selfdir)$$file; \
done
documentation: force
-(cd doc; $(MAKE) $(MFLAGS))
force:
# The rule for 'includes' is written funny so that the if statement
# always returns TRUE unless there really was an error installing the
# include files.
install:
-$(MV) $(bindir)/$(LIBRARY_NAME) $(bindir)/$(LIBRARY_NAME)-old
$(CP) $(LIBRARY_NAME) $(bindir)/$(LIBRARY_NAME)
-[ -n "$(RANLIB)" ] && $(RANLIB) -t $(bindir)/$(LIBRARY_NAME)
clean:
rm -f $(OBJECTS) $(LIBRARY_NAME)
-(cd doc; $(MAKE) $(MFLAGS) clean)
######################################################################
# #
# Dependencies for the object files which make up this library. #
# #
######################################################################
fnmatch.o: fnmatch.c fnmatch.h
@@ -0,0 +1,33 @@
# Skeleton Makefile for the GNU malloc code
#
# Maybe this should really create a library instead of just compiling
# source files
srcdir = .
VPATH = .:$(srcdir)
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
.s.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
MALLOC_SOURCE = malloc.c
ALLOCA_SOURCE = alloca.c
ALLOCA_OBJECT = alloca.o
libmalloc.a: malloc.o $(ALLOCA)
rm -f $@
ar cq $@ malloc.o $(ALLOCA)
-[ -n "$(RANLIB)" ] && $(RANLIB) $@
malloc.o: malloc.c getpagesize.h
$(ALLOCA_OBJECT): $(ALLOCA_SOURCE)
alloca.o: $(ALLOCA_SOURCE)
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
@- if [ "$(ALLOCA_OBJECT)" != alloca.o ]; then \
mv $(ALLOCA_OBJECT) alloca.o >/dev/null 2>&1 ; \
fi
@@ -0,0 +1,154 @@
## -*- text -*- ####################################################
# #
# Makefile for the GNU Readline and History Libraries. #
# #
####################################################################
srcdir = .
VPATH = .:$(srcdir)
INSTALL = install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
RANLIB = ranlib
AR = ar
RM = rm
CP = cp
MV = mv
# See the file STANDALONE for the -D defines that readline understands
DEFS =
# For libraries which include headers from other libraries.
LOCAL_INCLUDES = -I. -I..
CPPFLAGS = $(DEFS) $(LOCAL_INCLUDES)
# Here is a rule for making .o files from .c files that doesn't force
# the type of the machine (like -sun3) into the flags.
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
# The name of the main library target.
LIBRARY_NAME = libreadline.a
# The C code source files for this library.
CSOURCES = $(srcdir)readline.c $(srcdir)funmap.c $(srcdir)keymaps.c \
$(srcdir)vi_mode.c $(srcdir)parens.c $(srcdir)rltty.c \
$(srcdir)complete.c $(srcdir)bind.c $(srcdir)isearch.c \
$(srcdir)display.c $(srcdir)signals.c $(srcdir)emacs_keymap.c \
$(srcdir)vi_keymap.c $(srcdir)util.c $(srcdir)kill.c \
$(srcdir)undo.c $(srcdir)macro.c $(srcdir)input.c \
$(srcdir)callback.c $(srcdir)xmalloc.c \
$(srcdir)history.c $(srcdir)histsearch.c $(srcdir)histexpand.c \
$(srcdir)histfile.c \
$(srcdir)tilde.c \
# The header files for this library.
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
posixstat.h tilde.h rlconf.h
HISTOBJ = history.o histexpand.o histfile.o histsearch.o
TILDEOBJ= tilde.o
OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
rltty.o complete.o bind.o isearch.o display.o signals.o \
util.o kill.o undo.o macro.o input.o callback.o xmalloc.o \
$(HISTOBJ) $(TILDEOBJ)
# The texinfo files which document this library.
DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
DOCOBJECT = doc/readline.dvi
DOCSUPPORT = doc/Makefile
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
SUPPORT = Makefile ChangeLog $(DOCSUPPORT) examples/[-a-z.]*
SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h
##########################################################################
all: libreadline.a libhistory.a
libreadline.a: $(OBJECTS)
$(RM) -f $@
$(AR) cq $@ $(OBJECTS)
-[ -n "$(RANLIB)" ] && $(RANLIB) $@
libhistory.a: $(HISTOBJ) xmalloc.o
$(RM) -f $@
$(AR) cq $@ $(HISTOBJ) xmalloc.o
-[ -n "$(RANLIB)" ] && $(RANLIB) $@
documentation: force
[ ! -d doc ] && mkdir doc
(if [ -d doc ]; then cd doc; $(MAKE) $(MFLAGS); fi)
force:
# The rule for 'includes' is written funny so that the if statement
# always returns TRUE unless there really was an error installing the
# include files.
install: installdirs libreadline.a
for file in $(INSTALLED_HEADERS) ; do \
$(INSTALL_DATA) $(srcdir)/$$file $(incdir)/readline ; \
done
${INSTALL_DATA} readline.h keymaps.h chardefs.h history.h \
$(incdir)/readline
-${MV} $(libdir)/libreadline.a $(libdir)/libreadline.old
${INSTALL_DATA} libreadline.a $(bindir)/libreadline.a
-[ -n "$(RANLIB)" ] && $(RANLIB) -t $(bindir)/libreadline.a
installdirs:
-[ ! -d $(incdir)/readline ] && { \
mkdir $(incdir)/readline && chmod 755 $(incdir)/readline; }
-[ ! -d $(libdir) ] && mkdir $(libdir)
uninstall:
cd $(incdir)/readline && ${RM} -f ${INSTALLED_HEADERS}
cd $(libdir) && ${RM} -f libreadline.a libreadline.old
clean:
rm -f $(OBJECTS) *.a
(if [ -d doc ]; then cd doc; $(MAKE) $(MFLAGS) $@; fi)
tags: force
etags $(CSOURCES) $(HSOURCES)
TAGS: force
ctags -x $(CSOURCES) $(HSOURCES) > $@
readline: readline.h rldefs.h chardefs.h
readline: $(OBJECTS)
$(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
$(LOCAL_INCLUDES) -DTEST -o readline readline.c vi_mode.o funmap.o \
keymaps.o -ltermcap
realclean distclean mostlyclean: clean
# Dependencies
readline.o: readline.c readline.h rldefs.h rlconf.h chardefs.h
readline.o: keymaps.h history.h
vi_mode.o: rldefs.h rlconf.h readline.h history.h
funmap.o: funmap.c readline.h rlconf.h
keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c keymaps.h chardefs.h rlconf.h
history.o: history.h histlib.h
histexpand.o: history.h histlib.h
histsearch.o: history.h histlib.h
histfile.o: history.h histlib.h
isearch.o: readline.h history.h
search.o: readline.h history.h
display.o: readline.h history.h rldefs.h rlconf.h
complete.o: readline.h rldefs.h rlconf.h
rltty.o: rldefs.h rlconf.h readline.h
bind.o: rldefs.h rlconf.h readline.h history.h
signals.o: rldefs.h rlconf.h readline.h history.h
parens.o: readline.h
kill.o: rldefs.h rlconf.h readline.h history.h
macro.o: rldefs.h rlconf.h readline.h history.h
undo.o: rldefs.h rlconf.h readline.h history.h
input.o: rldefs.h rlconf.h readline.h history.h
callback.o: rlconf.h rldefs.h readline.h
@@ -0,0 +1,64 @@
## -*- text -*- ####################################################
# #
# Makefile for termcap replacement libbrary. #
# #
####################################################################
# Here is a rule for making .o files from .c files that doesn't force
# the type of the machine (like -sun3) into the flags.
.c.o:
$(CC) -c $(CFLAGS) $(LOCAL_INCLUDES) $(CPPFLAGS) $*.c
# Destination installation directory. The libraries are copied to DESTDIR
# when you do a `make install'.
DESTDIR = /usr/local/lib
DEBUG_FLAGS = -g
#OPTIMIZE_FLAGS = -O
LDFLAGS = $(DEBUG_FLAGS)
CFLAGS = $(DEBUG_FLAGS) $(OPTIMIZE_FLAGS)
SHELL = /bin/sh
# A good alternative is gcc -traditional.
#CC = gcc -traditional
CC = cc
RANLIB = /usr/bin/ranlib
AR = ar
RM = rm
CP = cp
CSOURCES = termcap.c tparam.c
SOURCES = $(CSOURCES)
OBJECTS = termcap.o tparam.o
DOCUMENTATION = termcap.texinfo
THINGS_TO_TAR = $(SOURCES) $(DOCUMENTATION)
##########################################################################
all: libtermcap.a
libtermcap.a: $(OBJECTS)
$(RM) -f $@
$(AR) clq $@ $(OBJECTS)
-[ -n "$(RANLIB)" ] && $(RANLIB) $@
termcap.tar: $(THINGS_TO_TAR)
tar -cf $@ $(THINGS_TO_TAR)
termcap.tar.Z: termcap.tar
compress -f termcap.tar
install: $(DESTDIR)/libtermcap.a
clean:
rm -f *.o *.a *.log *.cp *.tp *.vr *.fn *.aux *.pg *.toc
$(DESTDIR)/libtermcap.a: libtermcap.a
-mv $(DESTDIR)/libtermcap.a $(DESTDIR)/libtermcap.old
cp libtermcap.a $@
-[ -n "$(RANLIB)" ] && $(RANLIB) -t $@
@@ -0,0 +1,94 @@
## -*- text -*- ####################################################
# #
# Makefile for the GNU Tilde Library. #
# #
####################################################################
# This Makefile is hand made from a template file, found in
# ../template. Each library must provide several Makefile
# targets: `all', `clean', `documentation', `install', and
# `what-tar'. The `what-tar' target reports the names of the
# files that need to be included in a tarfile to build the full
# code and documentation for this library.
# Please note that the values for INCLUDES, CC, AR, RM, CP,
# RANLIB, and selfdir are passed in from ../Makefile, and do
# not need to be defined here.
RM = rm
srcdir = .
VPATH = .:$(srcdir)
# Here is a rule for making .o files from .c files that doesn't force
# the type of the machine (like -sun3) into the flags.
.c.o:
$(CC) -c $(CFLAGS) $(INCLUDES) $(LOCAL_DEFINES) $(CPPFLAGS) $<
# LOCAL_DEFINES are flags that are specific to this library.
# Define -DUSG if you are using a System V operating system.
LOCAL_DEFINES = $(LOCAL_INCLUDES) #-DUSG
# For libraries which include headers from other libraries.
LOCAL_INCLUDES = -I..
# The name of the library target.
LIBRARY_NAME = libtilde.a
# The C code source files for this library.
CSOURCES = $(srcdir)/tilde.c
# The header files for this library.
HSOURCES = $(srcdir)/tilde.h
OBJECTS = tilde.o
# The texinfo files which document this library.
DOCSOURCE = doc/tilde.texi
DOCOBJECT = doc/tilde.dvi
DOCSUPPORT = doc/Makefile
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
SUPPORT = Makefile ChangeLog $(DOCSUPPORT)
SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
######################################################################
all: $(LIBRARY_NAME)
$(LIBRARY_NAME): $(OBJECTS)
$(RM) -f $@
$(AR) cq $@ $(OBJECTS)
-[ -n "$(RANLIB)" ] && $(RANLIB) $@
what-tar:
@for file in $(THINGS_TO_TAR); do \
echo $(selfdir)$$file; \
done
documentation: force
-(cd doc; $(MAKE) $(MFLAGS))
force:
# The rule for 'includes' is written funny so that the if statement
# always returns TRUE unless there really was an error installing the
# include files.
install:
-$(MV) $(bindir)/$(LIBRARY_NAME) $(bindir)/$(LIBRARY_NAME)-old
$(CP) $(LIBRARY_NAME) $(bindir)/$(LIBRARY_NAME)
-[ -n "$(RANLIB)" ] && $(RANLIB) -t $(bindir)/$(LIBRARY_NAME)
clean:
$(RM) -f $(OBJECTS) $(LIBRARY_NAME)
-(cd doc; $(MAKE) $(MFLAGS) clean)
######################################################################
# #
# Dependencies for the object files which make up this library. #
# #
######################################################################
tilde.o: tilde.h tilde.c
+191
View File
@@ -0,0 +1,191 @@
/* config.h -- Configuration file for bash. */
/* This is a `minimal' configuration file. It will create a shell without:
job control
aliases
pushd and popd
readline
history
restricted shell mode
`disabled' builtins (builtin xxx finds xxx even after enable -n xxx)
process substitution
prompt string decoding (though variable expansion is still done)
the `select' command
the `help' builtin
*/
/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (_CONFIG_H_)
#define _CONFIG_H_
#include "memalloc.h"
#if defined (HPUX) || defined (UNIXPC) || defined (Xenix)
# if !defined (USG)
# define USG
# endif
#endif
#if defined (HAVE_UNISTD_H) && !defined (BUILDING_MAKEFILE)
#include <unistd.h>
#endif
/* Define JOB_CONTROL if your operating system supports
BSD-like job control. */
/* #define JOB_CONTROL */
/* Note that vanilla System V machines don't support BSD job control,
although some do support Posix job control. */
#if defined (USG) && !defined (_POSIX_JOB_CONTROL)
# undef JOB_CONTROL
#endif /* USG && !_POSIX_JOB_CONTROL */
/* Define ALIAS if you want the alias features. */
/* #define ALIAS */
/* Define PUSHD_AND_POPD if you want those commands to be compiled in.
(Also the `dirs' commands.) */
/* #define PUSHD_AND_POPD */
/* Define BRACE_EXPANSION if you want curly brace expansion a la Csh:
foo{a,b} -> fooa foob. Even if this is compiled in (the default) you
can turn it off at shell startup with `-nobraceexpansion', or during
shell execution with `set +o braceexpand'. */
/* #define BRACE_EXPANSION */
/* Define READLINE to get the nifty/glitzy editing features.
This is on by default. You can turn it off interactively
with the -nolineediting flag. */
/* #define READLINE */
/* Define BANG_HISTORY if you want to have Csh style "!" history expansion.
This is unrelated to READLINE. */
/* #define BANG_HISTORY */
/* Define HISTORY if you want to have access to previously typed commands.
If both HISTORY and READLINE are defined, you can get at the commands
with line editing commands, and you can directly manipulate the history
from the command line.
If only HISTORY is defined, the `fc' and `history' builtins are
available. */
/* #define HISTORY */
#if defined (BANG_HISTORY) && !defined (HISTORY)
/* BANG_HISTORY requires HISTORY. */
# define HISTORY
#endif /* BANG_HISTORY && !HISTORY */
#if defined (READLINE) && !defined (HISTORY)
# define HISTORY
#endif
/* Define this if you want completion that puts all alternatives into
a brace expansion shell expression. */
#if defined (BRACE_EXPANSION) && defined (READLINE)
# define BRACE_COMPLETION
#endif /* BRACE_EXPANSION */
/* The default value of the PATH variable. */
#define DEFAULT_PATH_VALUE \
"/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:."
/* The value for PATH when invoking `command -p'. This is only used when
the Posix.2 confstr () function, or CS_PATH define are not present. */
#define STANDARD_UTILS_PATH \
"/bin:/usr/bin:/usr/ucb:/usr/sbin:/etc:/usr/etc"
/* The default directory in which to look for mail files when
checking mail. The trailing slash is required. */
#if defined (USG)
# define DEFAULT_MAIL_PATH "/usr/mail/"
#else
# define DEFAULT_MAIL_PATH "/usr/spool/mail/"
#endif
/* Define V9_ECHO if you want to give the echo builtin backslash-escape
interpretation using the -e option, in the style of the Bell Labs 9th
Edition version of echo. */
#define V9_ECHO
/* Define DEFAULT_ECHO_TO_USG if you want the echo builtin to interpret
the backslash-escape characters by default, like the System V echo.
This requires that V9_ECHO be defined. */
/* #define DEFAULT_ECHO_TO_USG */
#if !defined (V9_ECHO)
# undef DEFAULT_ECHO_TO_USG
#endif
/* Define CONTINUE_AFTER_KILL_ERROR if you want the kill command to
continue processing arguments after one of them fails. */
#define CONTINUE_AFTER_KILL_ERROR
/* Define BREAK_COMPLAINS if you want the non-standard, but useful
error messages about `break' and `continue' out of context. */
#define BREAK_COMPLAINS
/* Define HELP_BUILTIN if you want the `help' shell builtin and the long
documentation strings compiled into the shell. */
/* #define HELP_BUILTIN */
/* Define RESTRICTED_SHELL if you want the generated shell to have the
ability to be a restricted one. The shell thus generated can become
restricted by being run with the name "rbash", or by setting the -r
flag. */
/* #define RESTRICTED_SHELL */
/* Define DISABLED_BUILTINS if you want "builtin foo" to always run the
shell builtin "foo", even if it has been disabled with "enable -n foo". */
/* #define DISABLED_BUILTINS */
/* Define PROCESS_SUBSTITUTION if you want the K*rn shell-like process
substitution features "<(file)". */
/* Right now, you cannot do this on machines without fully operational
FIFO support. This currently include NeXT and Alliant. */
#if !defined (MKFIFO_MISSING)
# define PROCESS_SUBSTITUTION
#endif /* !MKFIFO_MISSING */
/* Define PROMPT_STRING_DECODE if you want the backslash-escaped special
characters in PS1 and PS2 expanded. Variable expansion will still be
performed. */
/* #define PROMPT_STRING_DECODE */
/* Define BUFFERED_INPUT if you want the shell to do its own input
buffering. */
#define BUFFERED_INPUT
/* Define ONESHOT if you want sh -c 'command' to avoid forking to execute
`command' whenever possible. */
#define ONESHOT
/* Default primary and secondary prompt strings. */
#define PPROMPT "\\s\\$ "
#define SPROMPT "> "
/* Define SELECT_COMMAND if you want the Korn-shell style `select' command:
select word in word_list; do command_list; done */
/* #define SELECT_COMMAND */
/* Define ARRAY if you want ksh-style one-dimensional arrays. */
/* #define ARRAY_VARS */
#endif /* !_CONFIG_H_ */
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
#
# This shell script does nothing since Bash doesn't require
# configuration to be forced on it; it auto-configures. You can
# change the location of the source directory with +srcdir.
#
echo "Bash is configured to auto configure."
exit 0
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+16
View File
@@ -0,0 +1,16 @@
# This awk script is called from within Makefile to strip multiple blank
# lines from stdin.
BEGIN { newlines = 0 }
{
if (NF == 0)
newlines = 1;
else
{
if (newlines)
{
printf "\n";
newlines = 0;
}
print $0;
}
}
+51
View File
@@ -0,0 +1,51 @@
#!/bin/sh
# Return a full cpp specification, complete with system dependent flags.
#
# Syntax: cppmagic [ program-to-generate-flags [ guessed-cpp ]]
#
# If only one arg is present it is the name of a program to invoke
# which should generate -Dfoo defines.
#
# If two args are present the second arg is the name of the C
# preprocessor to use.
#
# Invoked with no args, provides a C preprocessor name and
# -traditional flag if that is appropriate.
#
# ../Makefile calls this file thusly: "cppmagic getcppsyms".
#
# Typical output:
#
# /lib/cpp -Dunix -Dm68k
#
Cpp=
if [ "$2" ]; then
Cpp=$2
else
for cpp in /lib/cpp /usr/lib/cpp /usr/ccs/lib/cpp; do
if [ -f $cpp ]; then
Cpp=$cpp
fi
done
if [ "$Cpp" = "" ]; then
Cpp=cpp
fi
fi
TRADITIONAL=
FLAGS=
# First flag might be `-traditional' if this is Gnu Cpp.
unknown_flag=`$Cpp -traditional /dev/null 2>&1 |
egrep 'known|recognized|valid|bad|legal'`
if [ "$unknown_flag" = "" ]; then
TRADITIONAL=-traditional
fi
if [ "$1" ]; then
FLAGS=`$1`
fi
echo $Cpp $TRADITIONAL $FLAGS
@@ -0,0 +1,427 @@
/* getcppsyms.c - Find unique compiler symbols. */
/* Copyright (C) 1993 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Some cpp's do not define any symbols, but instead let /bin/cc do it
for them. For such machines, running this file may prove useful. It
outputs the list of symbols which /bin/cc or /lib/cpp define and which
we had the foresight to guess at. */
#include <stdio.h>
int
main ()
{
#if defined (__BSD_4_4__)
printf ("-D__BSD_4_4__");
#endif /* __BSD_4_4__ */
#if defined (CMU)
printf (" -DCMU");
#endif /* CMU */
#if defined (_COFF)
printf (" -D_COFF");
#endif /* _COFF */
#if defined (DGUX)
printf (" -DDGUX");
#endif /* DGUX */
#if defined (GOULD_PN)
printf (" -DGOULD_PN");
#endif /* GOULD_PN */
#if defined (MACH)
printf (" -DMACH");
#endif /* MACH */
#if defined (MIPSEB)
printf (" -DMIPSEB");
#endif /* MIPSEB */
#if defined (MIPSEL)
printf (" -DMIPSEL");
#endif /* MIPSEL */
#if defined (MULTIMAX)
printf (" -DMULTIMAX");
#endif /* MULTIMAX */
#if defined (M_UNIX)
printf (" -DM_UNIX");
#endif /* M_UNIX */
#if defined (M_XENIX)
printf (" -DM_XENIX");
#endif /* M_XENIX */
#if defined (_M_XENIX)
printf (" -D_M_XENIX");
#endif /* _M_XENIX */
#if defined (NeXT)
printf (" -DNeXT");
#endif /* NeXT */
#if defined (__PARAGON__)
printf (" -D__PARAGON__");
#endif /* __PARAGON__ */
#if defined (_PGC_)
printf (" -D_PGC_");
#endif /* _PGC_ */
#if defined (__PGC__)
printf (" -D__PGC__");
#endif /* __PGC__ */
#if defined (RES)
printf (" -DRES");
#endif /* RES */
#if defined (RISC6000)
printf (" -DRISC6000");
#endif /* RISC6000 */
#if defined (RT)
printf (" -DRT");
#endif /* RT */
#if defined (SYSTYPE_BSD)
printf (" -DSYSTYPE_BSD");
#endif /* SYSTYPE_BSD */
#if defined (SYSTYPE_SYSV)
printf (" -DSYSTYPE_SYSV");
#endif /* SYSTYPE_SYSV */
#if defined (Sun386i)
printf (" -DSun386i");
#endif /* Sun386i */
#if defined (Tek4132)
printf (" -DTek4132");
#endif /* Tek4132 */
#if defined (Tek4300)
printf (" -DTek4300");
#endif /* Tek4300 */
#if defined (UMAXV)
printf (" -DUMAXV");
#endif /* UMAXV */
#if defined (USGr4)
printf (" -DUSGr4");
#endif /* USGr4 */
#if defined (USGr4_2)
printf (" -DUSGr4_2");
#endif /* USGr4_2 */
#if defined (__SVR4_2__)
printf (" -D__SVR4_2__");
#endif /* __SVR4_2__ */
#if defined (Xenix286)
printf (" -DXenix286");
#endif /* Xenix286 */
#if defined (_AIX)
printf (" -D_AIX");
#endif /* _AIX */
#if defined (_AIX370)
printf (" -D_AIX370");
#endif /* _AIX370 */
#if defined (_IBMESA)
printf (" -D_IBMESA");
#endif /* _IBMESA */
#if defined (__ibmesa)
printf (" -D__ibmesa");
#endif /* __ibmesa */
#if defined (_U370)
printf (" -D_U370");
#endif /* _U370 */
#if defined (_NLS)
printf (" -D_NLS");
#endif /* _NLS */
#if defined (_CX_UX)
printf (" -D_CX_UX");
#endif /* _CX_UX */
#if defined (_IBMR2)
printf (" -D_IBMR2");
#endif /* _IBMR2 */
#if defined (_M88K)
printf (" -D_M88K");
#endif /* _M88K */
#if defined (_M88KBCS_TARGET)
printf (" -D_M88KBCS_TARGET");
#endif /* _M88KBCS_TARGET */
#if defined (__DGUX__)
printf (" -D__DGUX__");
#endif /* __DGUX__ */
#if defined (__UMAXV__)
printf (" -D__UMAXV__");
#endif /* __UMAXV__ */
#if defined (__m88k)
printf (" -D__m88k");
#endif /* __m88k */
#if defined (__uxpm__)
printf (" -DUSGr4 -Du370 -D__uxpm__");
#endif /* __uxpm__ */
#if defined (__uxps__)
printf (" -D__svr4__ -D__uxps__");
#endif /* __uxps__ */
#if defined (alliant)
printf (" -Dalliant");
#endif /* alliant */
#if defined (alpha)
printf (" -Dalpha");
#endif /* alpha */
#if defined (__alpha)
printf (" -D__alpha");
#endif /* __alpha */
#if defined (aix)
printf (" -Daix");
#endif /* aix */
#if defined (aixpc)
printf (" -Daixpc");
#endif /* aixpc */
#if defined (apollo)
printf (" -Dapollo");
#endif /* apollo */
#if defined (ardent)
printf (" -Dardent");
#endif /* ardent */
#if defined (att386)
printf (" -Datt386");
#endif /* att386 */
#if defined (att3b)
printf (" -Datt3b");
#endif /* att3b */
#if defined (bsd4_2)
printf (" -Dbsd4_2");
#endif /* bsd4_2 */
#if defined (bsd4_3)
printf (" -Dbsd4_3");
#endif /* bsd4_3 */
#if defined (__bsdi__)
printf (" -D__bsdi__");
#endif /* __bsdi__ */
#if defined (bsdi)
printf (" -Dbsdi");
#endif /* bsdi */
#if defined (__386BSD__)
printf (" -D__386BSD__");
#endif /* __386BSD__ */
#if defined (cadmus)
printf (" -Dcadmus");
#endif /* cadmus */
#if defined (clipper)
printf (" -Dclipper");
#endif /* clipper */
#if defined (concurrent)
printf (" -Dconcurrent");
#endif /* concurrent */
#if defined (convex) || defined (__convex__) || defined (__convexc__)
# if !defined (__GNUC__)
printf (" -pcc");
# endif /* !__GNUC__ */
printf (" -Dconvex");
#endif /* convex */
#if defined (dmert)
printf (" -Ddmert");
#endif /* dmert */
#if defined (gcos)
printf (" -Dgcos");
#endif /* gcos */
#if defined (gcx)
printf (" -Dgcx");
#endif /* gcx */
#if defined (gould)
printf (" -Dgould");
#endif /* gould */
#if defined (hbullx20)
printf (" -Dhbullx20");
#endif /* hbullx20 */
#if defined (hcx)
printf (" -Dhcx");
#endif /* hcx */
#if defined (host_mips)
printf (" -Dhost_mips");
#endif /* host_mips */
#if defined (hp9000) || defined (__hp9000)
printf (" -Dhp9000");
#endif /* hp9000 || __hp9000 */
#if defined (hp9000s200) || defined (__hp9000s200)
printf (" -Dhp9000s200");
#endif /* hp9000s200 || __hp9000s200 */
#if defined (hp9000s300) || defined (__hp9000s300)
printf (" -Dhp9000s300");
#endif /* hp9000s300 || __hp9000s300 */
#if defined (hp9000s500) || defined (__hp9000s500)
printf (" -Dhp9000s500");
#endif /* hp9000s500 || __hp9000s500 */
#if defined (hp9000s700) || defined (__hp9000s700)
printf (" -Dhp9000s700");
#endif /* hp9000s700 || __hp9000s700 */
#if defined (hp9000s800) || defined (__hp9000s800)
printf (" -Dhp9000s800");
#endif /* hp9000s800 || __hp9000s800 */
#if defined (hppa) || defined (__hppa)
printf (" -Dhppa");
#endif /* hppa || __hppa */
#if defined (hpux) || defined (__hpux)
printf (" -Dhpux");
#endif /* hpux */
#if defined (__hp_osf)
printf (" -D__hp_osf");
#endif /* __hp_osf */
#if defined (i386)
printf (" -Di386");
#endif /* i386 */
#if defined (__i386__)
printf (" -D__i386__");
#endif
#if defined (__i860)
printf(" -D__i860");
#endif /* __i860 */
#if defined (__i860__)
printf(" -D__i860__");
#endif /* __i860__ */
#if defined (ibm)
printf (" -Dibm");
#endif /* ibm */
#if defined (ibm032)
printf (" -Dibm032");
#endif /* ibm032 */
#if defined (ibmrt)
printf (" -Dibmrt");
#endif /* ibmrt */
#if defined (interdata)
printf (" -Dinterdata");
#endif /* interdata */
#if defined (is68k)
printf (" -Dis68k");
#endif /* is68k */
#if defined (ksr1)
printf (" -Dksr1");
#endif /* ksr1 */
#if defined (__ksr1__)
printf (" -D__ksr1__");
#endif /* __ksr1__ */
#if defined (linux)
printf (" -Dlinux");
#endif /* linux */
#if defined (__linux__)
printf (" -D__linux__");
#endif /* __linux__ */
#if defined (luna88k)
printf (" -Dluna88k");
#endif /* luna88k */
#if defined (m68k)
printf (" -Dm68k");
#endif /* m68k */
#if defined (m88k)
printf (" -Dm88k");
#endif /* m88k */
#if defined (mc68010)
printf (" -Dmc68010");
#endif /* mc68010 */
#if defined (mc68020)
printf (" -Dmc68020");
#endif /* mc68020 */
#if defined (mc68030)
printf (" -Dmc68030");
#endif /* mc68030 */
#if defined (mc68040)
printf (" -Dmc68040");
#endif /* mc68040 */
#if defined (mc68k32)
printf (" -Dmc68k32");
#endif /* mc68k32 */
#if defined (mips)
printf (" -Dmips");
#endif /* mips */
#if defined (n16)
printf (" -Dn16");
#endif /* n16 */
#if defined (ns32000)
printf (" -Dns32000");
#endif /* ns32000 */
#if defined (os)
printf (" -Dos");
#endif /* os */
#if defined (osf)
printf (" -Dosf");
#endif /* osf */
#if defined (__osf__)
printf (" -D__osf__");
#endif /* __osf__ */
#if defined (__OSF1__)
printf(" -D__OSF1__");
#endif /* __OSF1__ */
#if defined (pdp11)
printf (" -Dpdp11");
#endif /* pdp11 */
#if defined (plexus)
printf (" -Dplexus")
#endif /* plexus */
#if defined (pyr)
printf (" -Dpyr");
#endif /* pyr */
#if defined (scs)
printf (" -Dscs");
#endif /* scs */
#if defined (sequent)
printf (" -Dsequent");
#endif /* sequent */
#if defined (sgi)
printf (" -Dsgi");
#endif /* sgi */
#if defined (sony)
printf (" -Dsony");
#endif /* sony */
#if defined (sparc)
printf (" -Dsparc");
#endif /* sparc */
#if defined (stardent)
printf (" -Dstardent");
#endif /* stardent */
#if defined (sun)
printf (" -Dsun");
#endif /* sun */
#if defined (sun2)
printf (" -Dsun2");
#endif /* sun2 */
#if defined (sun3)
printf (" -Dsun3");
#endif /* sun3 */
#if defined (sun4)
printf (" -Dsun4");
#endif /* sun4 */
#if defined (__svr4__)
printf (" -D__svr4__");
#endif /* __svr4__ */
#if defined (tower32)
printf (" -Dtower32");
#endif /* tower32 */
#if defined (tss)
printf (" -Dtss");
#endif /* tss */
#if defined (u370)
printf (" -Du370");
#endif /* u370 */
#if defined (u3b)
printf (" -Du3b");
#endif /* u3b */
#if defined (u3b2)
printf (" -Du3b2");
#endif /* u3b2 */
#if defined (u3b20d)
printf (" -Du3b20d");
#endif /* u3b20d */
#if defined (u3b5)
printf (" -Du3b5");
#endif /* u3b5 */
#if defined (ultrix)
printf (" -Dultrix");
#endif /* ultrix */
#if defined (unix)
printf (" -Dunix");
#endif /* unix */
#if defined (vax)
printf (" -Dvax");
#endif /* vax */
printf ("\n");
exit (0);
}
+19
View File
@@ -0,0 +1,19 @@
#! /bin/sh
#
# Search $PATH for a file the same name as $1; return TRUE if found.
#
command=$1
[ -n "$command" ] || exit 1
set `echo $PATH | sed 's/^:/.:/
s/::/:.:/g
s/:$/:./
s/:/ /g'`
while [ $# -ne 0 ] ; do
[ -f $1/$command ] && exit 0 # test -x not universal
shift
done
exit 1
+282
View File
@@ -0,0 +1,282 @@
#!/bin/sh
# This script attempts to guess a canonical system name.
# Copyright (C) 1992, 1993 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
alpha:OSF1:1.*:*)
# 1.2 uses "1.2" for uname -r.
echo alpha-dec-osf${UNAME_RELEASE}
exit 0 ;;
alpha:OSF1:V1.*:*)
# 1.3 uses "V1.3" for uname -r.
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
sun4*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:*:*)
echo sparc-sun-sunos${UNAME_RELEASE}
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
mips:*:5*:RISCos)
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
echo m88k-dg-dgux${UNAME_RELEASE}
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
*:IRIX:*:*)
echo mips-sgi-irix${UNAME_RELEASE}
exit 0 ;;
i[34]86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
echo rs6000-ibm-aix3.2
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit 0 ;;
9000/31?:HP-UX:*:*)
echo m68000-hp-hpux
exit 0 ;;
9000/[34]??:HP-UX:*:*)
echo m68k-hp-hpux
exit 0 ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit 0 ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/7??:HP-UX:*:* | 9000/8?7:HP-UX:*:* )
echo hppa1.1-hp-hpux
exit 0 ;;
9000/8??:HP-UX:*:*)
echo hppa1.0-hp-hpux
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >dummy.c
#include <unistd.h>
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
C1*:ConvexOS:*:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:*)
echo c2-convex-bsd
exit 0 ;;
CRAY*X-MP:UNICOS:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:UNICOS:*:*)
echo ymp-cray-unicos
exit 0 ;;
CRAY-2:UNICOS:*:*)
echo cray2-cray-unicos
exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
i[34]86:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd${UNAME_RELEASE}
exit 0 ;;
amiga:NetBSD:*:*)
echo m68k-cbm-netbsd{$UNAME_RELEASE}
exit 0 ;;
i[34]86:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux
exit 0 ;;
i[34]86:UNIX_SV:4.*:*)
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
else
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
i[34]86:*:3.2:*)
if /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-unknown-sysv3.2
fi
exit 0 ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M680[234]0:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:*)
uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
m680[234]0:LynxOS:2.2*:*)
echo m68k-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
i[34]86:LynxOS:2.2*:*)
echo i386-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.2*:*)
echo sparc-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
cat >dummy.c <<EOF
main()
{
#if defined (sony)
#if defined (MIPSEB)
#else
printf("m68k-sony-newsos\n"); exit(0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf("arm-acorn-riscix"); exit (0);
#endif
#if defined(hp300) && !defined(hpux)
printf("m68k-hp-bsd\n"); exit(0);
#endif
#if defined(NeXT)
printf("m68k-next-bsd\n"); exit(0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf("ns32k-encore-sysv\n"); exit(0);
#else
#if defined (CMU)
printf("ns32k-encore-mach\n"); exit(0);
#else
printf("ns32k-encore-bsd\n"); exit(0);
#endif
#endif
#endif
#if defined(__386BSD__) || (defined(__bsdi__) && defined(__i386__))
printf("i386-unknown-bsd\n"); exit(0);
#endif
#if defined(sequent)
#if defined(i386)
printf("i386-sequent-dynix\n"); exit(0);
#endif
#if defined (ns32000)
printf("ns32k-sequent-dynix\n"); exit(0);
#endif
#endif
#if defined(_SEQUENT_)
printf("i386-sequent-ptx\n"); exit(0);
#endif
exit (1);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
#echo '(Unable to guess system type)' 1>&2
exit 1
+489
View File
@@ -0,0 +1,489 @@
#!/bin/sh
#
# This file creates a file called "sysdefs.h" which contains CPP defines
# helping to describe the operating system features. We just take guesses
# by looking at random files.
# Removes any inherited definitions.
SYSDEF=
MAKE_ANSI=
while [ $# -gt 0 ]; do
case "$1" in
-s) shift; srcdir=$1; shift ;;
-i) shift; incdir="$1"; shift ;;
-A) shift; MAKE_ANSI=true ;;
*) break ;;
esac
done
sysdefs=${1-./sysdefs.h}
: ${srcdir=.}
rm -f $sysdefs
echo "/* sysdefs.h -- #defines for your system created by $0." >>$sysdefs
echo " Do NOT EDIT this file, since any changes will disappear." >>$sysdefs
echo " Instead, edit $0, or config.h, or machines.h. */" >>$sysdefs
echo "" >>$sysdefs
echo "#if !defined (_SYSDEFS_H_)" >>$sysdefs
echo "# define _SYSDEFS_H_" >>$sysdefs
# was if [ -f /usr/bin/uname ] || [ -f /bin/uname ]
if ( uname >/dev/null 2>&1 ) 2>/dev/null
then
UNAME=`uname` # SunOS
UNAME_R=`uname -r 2>/dev/null` # 4.1.2
UNAME_M=`uname -m 2>/dev/null` # sun4m
UNAME_V=`uname -v 2>/dev/null` # 13
UNAME_S=`uname -s 2>/dev/null` # SunOS
RELEASE=`expr "$UNAME_R" : '[^0-9]*\([0-9]*\)'` # 4
case "$RELEASE" in
"") RELEASE=0 ;;
*) RELEASE=`expr "$RELEASE" + 0` ;;
esac
LEVEL=`expr "$UNAME_R" : '[^0-9]*[0-9]*.\([0-9]*\)'` # 1
SUBLEVEL=`expr "$UNAME_R" : '[^0-9]*[0-9]*.[0-9]*.\([0-9]*\)'` # 2
fi
# check for versions of SunOS and BSD/OS
case "${UNAME}${RELEASE}" in
SunOS4*) SYSDEF=SunOS4 ;;
SunOS5*) SYSDEF=SunOS5 ;;
BSD/OS2*) SYSDEF=BSDI2 ;;
esac
# Test for NeXT
if [ -d /NextLibrary ]; then
MAKE_ANSI=true
fi
# Intel Paragon
case "$UNAME_M" in
paragon) MAKE_ANSI=true ;;
esac
# Test for shared libraries (this is pretty sVr4ish).
if [ -f /usr/ccs/lib/libc.so ]; then
SYSDEF=USGr4
fi
# Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which
# is contrary to all other versions of uname
if [ -n "$UNAME" ] && [ "$UNAME_S" != "$UNAME" ] && [ "$UNAME_S" = UNIX_SV ]; then
UNAME=UNIX_SV
fi
# another check for SVR4 on 386 or 486 machines
case "${UNAME_M}:${UNAME}:${UNAME_R}" in
i[34]86:UNIX_SV:4.*) SYSDEF=USGr4 ;;
esac
# A check for Mips RISCos
case "$UNAME_V" in
UMIPS|RISCos) SYSDEF=RISCos_${RELEASE}_${LEVEL} ;;
esac
# A check for Amdahl UTS
case "$UNAME" in
uts) SYSDEF=UTS ;;
esac
# Look for an error message when trying to exec bison. If we find
# what we're looking for, then we don't have it. If we get something
# else (like an error message about no grammar file), then we have
# it.
YACC=yacc
if ( cd /tmp ; bison /dev/null 2>&1 >/dev/null | grep 'no input grammar' >/dev/null 2>&1 ) 2>/dev/null; then
YACC="bison -y"
elif ( cd /tmp ; byacc /dev/null 2>&1 >/dev/null | grep 'unexpected ' >/dev/null 2>&1) 2>/dev/null; then
YACC=byacc
fi
# Try to locate ranlib. I think this is a bad idea.
if sh ${srcdir}/support/inpath ranlib; then
RANLIB_LOCATION=ranlib
elif [ -f /usr/bin/ranlib ]; then
RANLIB_LOCATION=/usr/bin/ranlib;
elif [ -f /bin/ranlib ]; then
RANLIB_LOCATION=/bin/ranlib;
elif [ -f /usr/local/bin/ranlib ]; then
RANLIB_LOCATION=/usr/local/bin/ranlib;
elif [ -f /usr/gnu/bin/ranlib ]; then
RANLIB_LOCATION=/usr/gnu/bin/ranlib
elif [ -f /usr/local/gnubin/ranlib ]; then
RANLIB_LOCATION=/usr/local/gnubin/ranlib;
else
RANLIB_LOCATION=: # XXX
fi
if [ -n "${RANLIB_LOCATION}" ]; then
echo "" >>$sysdefs
echo "#if !defined (RANLIB_LOCATION)" >>$sysdefs
echo "# define RANLIB_LOCATION ${RANLIB_LOCATION}" >>$sysdefs
echo "#endif /* RANLIB_LOCATION */" >>$sysdefs
fi
#
# Is this a Xenix system?
#
if [ -f /xenix ]; then
SYSDEF="Xenix"
case "`/bin/uname -p`" in
*286) SYSDEF="Xenix286" ;;
*386) SYSDEF="Xenix386" ;;
esac
# make sure that `i386' is defined for machines.h
if [ "$SYSDEF" = "Xenix386" ]; then
echo "" >>$sysdefs
echo "#if !defined (i386)" >>$sysdefs
echo "# define i386" >>$sysdefs
echo "#endif /* !i386 */" >>$sysdefs
fi
# Pass the release number of the OS through to the machine descriptions
# in machines.h.
if [ -f /etc/perms/soft ]; then
rel=`grep rel= /etc/perms/soft`
case "$rel" in
*2.2.*) XREL=XENIX_22 ;;
*2.3.*) XREL=XENIX_23 ;;
*3.2.*) XREL=XENIX_32 ;;
*) XREL= ;;
esac
if [ "$XREL" ]; then
echo "" >>$sysdefs
echo "#if !defined ($XREL)" >>$sysdefs
echo "# define $XREL" >>$sysdefs
echo "#endif /* !$XREL */" >>$sysdefs
fi
fi
fi
#
# Is this some kind of Sys Vish system?
#
if [ -f /unix ]; then
if [ -d /generic ]; then # This is an AIX system.
SYSDEF="aixpc"
MAKE_ANSI=true
elif [ -d /etc/conf/kconfig.d ] && [ -f /usr/include/sys/limits.h ]; then
SYSDEF="isc386" # This is a 386 running ISC?
ISCREL="ISC_$RELEASE"
echo "#if !defined ($ISCREL)" >>$sysdefs
echo "# define $ISCREL" >>$sysdefs
echo "#endif /* $ISCREL */" >>$sysdefs
elif [ -f /etc/xlc.cfg ]; then
if fgrep _IBMR2 /etc/xlc.cfg >/dev/null 2>&1; then
SYSDEF=RISC6000
MAKE_ANSI=true
fi
elif [ -f /bin/4d -a -f /bin/uname ]; then
case "$UNAME_R" in
3.*) SYSDEF="Irix3" ;;
4.*) SYSDEF="Irix4" ;;
5.*) SYSDEF="Irix5" ;;
6.*) SYSDEF="Irix6" ;;
*) SYSDEF="Irix3" ;;
esac
elif [ -d /usr/amiga ]; then
SYSDEF="amiga" # An Amiga running V.4.
elif [ -f /bin/fxc.info ]; then
SYSDEF="alliant"
fi
fi
# Is this a Unicos system?
if [ -f /unicos ]; then
MAKE_ANSI=true
UnicosMachine=
# Test for the variaous flavors of Cray machines.
if [ -x /bin/cray1 ] && /bin/cray1 2>/dev/null; then
UnicosMachine=Cray1
fi
if [ -x /bin/cray2 ] && /bin/cray2 2>/dev/null; then
UnicosMachine=Cray2
fi
if [ -x /bin/crayxmp ] && /bin/crayxmp 2>/dev/null; then
UnicosMachine=CrayXMP
fi
if [ -x /bin/crayymp ] && /bin/crayymp 2>/dev/null; then
UnicosMachine=CrayYMP
fi
if [ "$UnicosMachine" ]; then
echo "#if !defined ($UnicosMachine)" >>$sysdefs
echo "# define $UnicosMachine" >>$sysdefs
echo "#endif /* !$UnicosMachine */" >>$sysdefs
fi
fi
# Is this (and what kind of) a HPUX system?
if [ -f /hp-ux ]; then
SYSDEF=HPUX_${RELEASE}
if [ "$RELEASE" = 6 -a "$LEVEL" -lt 2 ]; then
SYSDEF=HPUX_USG
fi
fi
if [ "$SYSDEF" = "" ]; then
case "$UNAME_M" in
ESA) SYSDEF=AIXESA ;;
XD88*) SYSDEF=XD88 ;;
M88100) SYSDEF=M88100 ;; # Motorola Delta 88K
esac
fi
# What release of SCO Unix is this?
if [ "$SYSDEF" = "" -a -f /bin/uname ]; then
case `/bin/uname -X 2>/dev/null | grep '^Release' 2>/dev/null` in
*3.2v4.*) SYSDEF=SCOv4 ;;
*) SYSDEF=SCO ;;
esac
fi
#
# Default to cadmus for unknown SysVish systems
#
if [ -f /unix ] && [ "$SYSDEF" = "" ]; then
SYSDEF="cadmus"
fi
if [ "$SYSDEF" != "" ]; then
echo "" >>$sysdefs
echo "#if !defined ($SYSDEF)" >>$sysdefs
echo "# define $SYSDEF" >>$sysdefs
echo "#endif /* $SYSDEF */" >>$sysdefs
fi
# Now look for certain include files in a list of directories
# Poor substitute for autoconf
# Add any other directories where include files are found to this list or
# create another case
if [ -n "$incdir" ]; then
dirlist="$incdir"
else
case "$SYSDEF" in
RISCos*) dirlist="/bsd43/usr/include";;
*) dirlist="/usr/include /usr/include/bsd /usr/include/ansi" ;;
esac
fi
# Code fragment to be executed to find a particular include file. Make sure
# to set `file' to the pathname of the file you want, relative to /usr/include,
# before calling `eval $findf'.
findf="
found='';
for d in \$dirlist;
do
if test -f \$d/\$file;
then
found=yes;
break;
fi;
done
"
file=sys/stream.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_SYS_STREAM_H)" >>$sysdefs
echo "# define HAVE_SYS_STREAM_H" >>$sysdefs
echo "#endif /* HAVE_SYS_STREAM_H */" >>$sysdefs
fi
file=sys/ptem.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_SYS_PTEM_H)" >>$sysdefs
echo "# define HAVE_SYS_PTEM_H" >>$sysdefs
echo "#endif /* HAVE_SYS_PTEM_H */" >>$sysdefs
fi
file=sys/pte.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_SYS_PTE_H)" >>$sysdefs
echo "# define HAVE_SYS_PTE_H" >>$sysdefs
echo "#endif /* HAVE_SYS_PTE_H */" >>$sysdefs
fi
file=sys/wait.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_SYS_WAIT_H)" >>$sysdefs
echo "# define HAVE_SYS_WAIT_H" >>$sysdefs
echo "#endif /* HAVE_SYS_WAIT_H */" >>$sysdefs
fi
file=sys/resource.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_RESOURCE)" >>$sysdefs
echo "# define HAVE_RESOURCE" >>$sysdefs
echo "#endif /* HAVE_RESOURCE */" >>$sysdefs
fi
file=sys/param.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_SYS_PARAM_H)" >>$sysdefs
echo "# define HAVE_SYS_PARAM_H" >>$sysdefs
echo "#endif /* HAVE_SYS_PARAM_H */" >>$sysdefs
fi
file=unistd.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_UNISTD_H)" >>$sysdefs
echo "# define HAVE_UNISTD_H" >>$sysdefs
echo "#endif /* HAVE_UNISTD_H */" >>$sysdefs
fi
file=stdlib.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_STDLIB_H)" >>$sysdefs
echo "# define HAVE_STDLIB_H" >>$sysdefs
echo "#endif /* HAVE_STDLIB_H */" >>$sysdefs
fi
file=limits.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_LIMITS_H)" >>$sysdefs
echo "# define HAVE_LIMITS_H" >>$sysdefs
echo "#endif /* HAVE_LIMITS_H */" >>$sysdefs
fi
file=locale.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_LOCALE_H)" >>$sysdefs
echo "# define HAVE_LOCALE_H" >>$sysdefs
echo "#endif /* HAVE_LOCALE_H */" >>$sysdefs
fi
file=alloca.h
eval $findf
if [ -f /usr/include/alloca.h ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_ALLOCA_H)" >>$sysdefs
echo "# define HAVE_ALLOCA_H" >>$sysdefs
echo "#endif /* HAVE_ALLOCA_H */" >>$sysdefs
fi
file=dirent.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_DIRENT_H)" >>$sysdefs
echo "# define HAVE_DIRENT_H" >>$sysdefs
echo "#endif /* HAVE_DIRENT_H */" >>$sysdefs
fi
file=string.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_STRING_H)" >>$sysdefs
echo "# define HAVE_STRING_H" >>$sysdefs
echo "#endif /* HAVE_STRING_H */" >>$sysdefs
fi
file=varargs.h
eval $findf
if [ -n "$found" ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_VARARGS_H)" >>$sysdefs
echo "# define HAVE_VARARGS_H" >>$sysdefs
echo "#endif /* HAVE_VARARGS_H */" >>$sysdefs
fi
# Does the system have a /dev/fd directory?
if [ -d /dev/fd ]; then
echo "" >>$sysdefs
echo "#if !defined (HAVE_DEV_FD)" >>$sysdefs
echo "# define HAVE_DEV_FD" >>$sysdefs
echo "#endif /* HAVE_DEV_FD */" >>$sysdefs
fi
# Is this SVR4.2? It's subtly different from USGr4
if [ "$UNAME" = "UNIX_SV" ] && [ "$UNAME_R" = "4.2" ]; then
echo "" >>$sysdefs
echo "#if !defined (USGr4_2)" >>$sysdefs
echo "# define USGr4_2" >>$sysdefs
echo "#endif /* USGr4_2 */" >>$sysdefs
fi
# Is this AIX PS/2 1.3? Yuck.
if [ "$UNAME" = "AIX" ] && [ "$UNAME_V" = "1" ] && [ "$RELEASE" = "3" ]; then
case "$UNAME_M" in
i386|i486)
echo "" >>$sysdefs
echo "#if !defined (AIX_13)" >>$sysdefs
echo "# define AIX_13" >>$sysdefs
echo "#endif /* AIX_13 */" >>$sysdefs
;;
esac
fi
if [ -n "$YACC" ]; then
echo "" >>$sysdefs
echo "#if !defined (YACC_PROG)" >>$sysdefs
echo "# define YACC_PROG $YACC" >>$sysdefs
echo "#endif /* YACC_PROG */" >>$sysdefs
fi
# Functions to test for a la autoconf
# getwd
# getcwd
# strchr
# strcasecmp
# getgroups
# setlinebuf
# strerror
# vfprintf
# bcopy
# getdtablesize
# setdtablesize
# alloca
# gethostname
# memmove (missing)
# mkfifo (missing)
#
# Other things to test
# opendir robustness
# dup2 working
# void sighandler
# sys_siglist[]
# uid_t, gid_t
# have_getpw_decls
# reversed setvbuf args
# int getgroups
# If this system's cpp might not like `/**/#' in cpp-Makefile, make an
# alternate ansi-style cpp-Makefile.
if [ -n "$MAKE_ANSI" ]; then
grep -v '/\*\*/' ${srcdir}/cpp-Makefile >ansi-Makefile
fi
# These should be the last 2 lines in this file!
echo "" >>$sysdefs
echo "#endif /* _SYSDEFS_H_ */" >>$sysdefs
+13
View File
@@ -0,0 +1,13 @@
#! /bin/sh
#
# srcdir - print out the absolute pathname of the top of the bash source
# tree. Used for getting the right value to makes in subdirectories
#
case "$1" in
'.'|./) pwd ;;
./*|..*) echo `pwd`/"$1" ;;
*) echo "$1" ;;
esac
exit 0
+136
View File
@@ -0,0 +1,136 @@
This is a description of the changes made to bash for increased ksh
compatibility.
1. $SECONDS
"Each time this parameter is referenced, the number of seconds
since shell invocation is returned. If this parameter is assigned
a value, then the value returned will be the value that was
assigned plus the number of seconds since the assignment."
Files changed: variables.c
variables.h
subst.c
general.c
shell.c
general.h
2. $TMOUT
"If set to a value greater than 0, the shell will terminate if a
command is not entered within the prescribed number of seconds
after issuing the PS1 prompt."
Files changed: shell.c (the implementation is not perfect)
3. $RANDOM
"Each time this parameter is referenced, a random integer is
generated. The sequence of random numbers can be initialized
by assigning a numeric value to RANDOM."
Files changed: subst.c
variables.c
4. $REPLY
"This parameter is set by the `read' special command when no
arguments are supplied."
Files changed: builtins.c
5. integer variables
`declare -i' (also export) makes a variable an integer (turns on
the integer attribute). When assignment is made to a variable with
the -i attribute, arithmetic expression evaluation is done on the
value before it is assigned to the variable.
Files changed: variables.h
variables.c
builtins.c
6. Arithmetic expression evaluation.
Here is the comment at the beginning of the new file `expr.c':
ksh-style expression evaluation.
All arithmetic is done as long integers with no checking for overflow
(though division by 0 is caught and flagged as an error).
The following operators are handled, grouped into a set of levels in
order of decreasing precedence.
"-" [level 0 (unary negation)]
"!" [level 1]
"*", "/", "%" [level 2]
"+", "-" [level 3]
"<=", ">=", "<", ">" [level 4]
"==", "!=" [level 5]
"=" [level 6 (assignment)]
(Note that most of these operators have special meaning to bash, and an
entire expression should be quoted, e.g. "a=$a+1" or "a=a+1" to ensure
that it is passed intact to the evaluator).
Sub-expressions within parentheses have a precedence level greater than
all of the above levels and are evaluated first. Within a single prece-
dence group, evaluation is left-to-right, except for the arithmetic
assignment operator (`='), which is evaluated right-to-left (as in C).
The expression evaluator returns the value of the expression (assignment
statements have as a value what is returned by the RHS). The `let'
builtin, on the other hand, returns 0 if the last expression evaluates to
a non-zero, and 1 otherwise.
Implementation is a recursive-descent parser.
Files added: expr.c
7. `let' builtin
Parameters may be assigned numeric values via the `let' builtin.
Each of its arguments is an expression to be evaluated. `let'
returns 0 if the value of the last expression is non-zero, and
1 otherwise.
Note that the "((...))" form of this command has not yet been
implemented; it requires changes to the parsing functions.
Files changed: builtins.c
8. $_
$_ is set to the last argument of the previous command line, after
expansion. It is still used as before when checking for mail.
Two new keybindings have been added to insert this into the current
command line (M-_ and M-.).
Files changed: mailcheck.c
execute_cmd.c
bashline.c
9. `cd -'
Equivalent to 'cd $OLDPWD'
Files changed: builtins.c
10. "ulimit -a"
"List all of the current resource limits (BSD only)."
Files changed: builtins.c
11. ${#@} and ${#*}
These expand to the number of positional parameters.
Files changed: subst.c
Chet Ramey
Information Network Services, Case Western Reserve University
chet@ins.CWRU.Edu
+31
View File
@@ -0,0 +1,31 @@
The version of bash in this directory has been compiled on the
following systems:
By chet:
SunOS 4.1.4
SunOS 5.5
BSDI BSD/OS 2.1
FreeBSD 2.2
NetBSD 1.2
AIX 4.2
AIX 4.1.4
HP/UX 9.05, 10.01, 10.10, 10.20
Linux 2.0.29 (libc 5.3.12)
Linux 2.0.4 (libc 5.3.12)
By other testers:
SCO ODT 2.0
SCO 3.2v5.0, 3.2v4.2
SunOS 5.3
SunOS 5.5
BSD/OS 2.1
FreeBSD 2.2
SunOS 4.1.3
Irix 5.3
Irix 6.2
Linux 2.0 (unknown distribution)
Digital OSF/1 3.2
GNU Hurd 0.1
SVR4.2
+140
View File
@@ -0,0 +1,140 @@
This file details the changes between the previous release of CWRU bash
(07/11/93) and this release.
1. Bugs Fixed
Readline's vi-mode once again has TAB bound to completion; entering `posix
mode' changes it to self-insert
Bash now binds its special emacs-mode functions directly into
emacs_meta_keymap so that eight-bit character handling does not interfere
Some source restructuring: more extern functions are defined in header files
and not in C source files
The handling of `line number' inside functions is now more correct and
closer to reality
Some functions of `general use' were moved to general.c (vfree,
full_pathname)
A bug that caused some redirections to be applied twice was fixed in
execute_command_internal (dispose of redirection_undo_list after copying it;
ditto for exec_redirection_undo_list)
The exit status of a command that is not found is 126, as Posix.2 specifies
More speed improvements -- bash now runs as fast as the SunOS sh on
Haertel's `shell benchmark'
Instead of returning pointers to -1, bash and the readline, history, and
glob libraries now return pointers to special `error pointers', which the
calling code checks for in place of -1
Fixed a problem with canonicalize_pathname which made it get
confused with xxx/./yyy if yyy was `.' or `..'
Fixes to make bash recognize SVR4.2 and set USGr4_2 for SVR4.2 systems
Fixes to the HP/UX machine descriptions to make alloca work on HPUX_9
and to avoid `M_MACHINE redefined' warnings
Fixes to the CRAY machine description
Fixes to the mailpath code to make it Posix.2-compliant -- backslash
may now quote `%' and `?'
The namespace was further cleaned up, and more functions and variables
were made static
On systems with S_IFSOCK or S_ISSOCK defined in sys/stat.h, bash checks
whether fd 0 is a socket to decide whether or not it's being started by
rshd and to run the startup files
Bash now gives the signal mask it inherits to its children -- previously,
login shells cleared the signal mask
cpp-Makefile and subst.c both used the `USE_GLOB_LIBRARY' define, but
with different meanings; subst.c now uses `USE_POSIX_GLOB_LIBRARY'
Fixed pattern substitution so that ${a%%$b}, where b was unset, no longer
causes a core dump
Changed the `test_exit' define in test.c to no longer use `longjmp' as
the rhs or a comma-ized expression; this causes core dumps on some
optimizer/machine combinations
A speed hack in variables.c: if no local variables are defined for a level
of shell context, kill_all_local_variables does not need to search the
whole variable hash table when popping a context
Fixed the `bind' builtin so that -m now changes the keymap for all of the
subsequent operations
Changed some more builtins to use internal_getopt: bind, command, export,
readonly, declare, typeset
Fixed fc to use the Posix.2 format for listing commands in the
history list
Changed bg to set `!', as Posix.2 specifies
Fixed ulimit.def to compile if RLIMIT_RSS is not defined,
as some systems seem to have it
Replaced lib/malloc/alloca.c with the version from emacs 19. The old one
lives in alloca.c.old
malloc.c now uses the ANSI C features to `stringize' macro arguments if
__STDC__ is defined
Fixes to the GNU malloc library from glibc 1.06 and Mike Haertel
Fixes to readline key binding and lookup for Cray systems, which don't
like the casting that readline does
Fixes to all readline library source files to clean up the code: make sure
`int'-returning functions use `return x;' rather than `return;', declare all
arguments, even the `int' ones, and make some functions void. Cleaned up
the code formatting a little, too.
The readline completer now double-quotes filenames with special word-break
characters, so that tilde expansion still works
^C now breaks out of keyboard macros
If being compiled as part of the shell, readline no longer attempts to
handle SIGTTIN, SIGTTOU, or SIGTSTP
tilde_expansion_failure_hook is now a CPFunction rather than a Function,
since that's how it's used
Readline vi-mode `change case' function now skips over characters which
are neither upper nor lower case
Readline vi-mode now allows replacement to be redoable with `.'
2. New Features
A `strict Posix.2' mode, enabled with the -posix startup option or
setting the POSIXLY_CORRECT variable (see CWRU/POSIX.NOTES for a
description of the changed behavior)
`ONESHOT' is now an option in config.h
cpp-Makefile assumes that fixed header files are present if gcc is being
used
The redirections attached to a function declaration are now part of that
function, applied when the function is executed, as specified by Posix.2.
This caused a change to parse.y that resulted in 66 shift/reduce
conflicts(!)
All of the OP= functions that Posix.2 specifies are now implemented for
both `let' and arithmetic substitution
The `command' builtin has acquired the Posix.2 `-v' and `-V' options
(this shares code with the `type' builtin)
A new `bash_builtins' man page, like the `csh_builtins' page on some
systems
+54
View File
@@ -0,0 +1,54 @@
This is a description of the changes made to bash to provide a `restricted'
shell, `rbash', organized by changes to various source files.
1. shell.c
Moved the declaration of restricted to flags.c; it is now declared
extern here. Changed the detection of a restricted shell; now, any
instance of the shell for which *(basename(argv[0])) == 'r' (where
basename returns either everything after the last '/' in its
argument or its argument is restricted. Also, if SHELL is set on
entry to the shell, and it's basename is "rbash", the shell is
restricted.
This paragraph applies only to CWRU, or to those who have compiled
the shell with "CWRU" defined. When a shell is determined to be
restricted, and it is a login shell, the file "/etc/rprofile" (and
only that file) is executed. There is no execution of ~/.profile
or ~/.bash_profile. The .bashrc file is executed, but after the
restrictions have been turned on (users may customize their instances
of the shell in this file while not compromising any kind of security
arrangements set up by the administrator).
2. builtins.c
cd_builtin was modified to return failure if bash is operating in
`restricted mode', so changing directories is not allowed.
3. variables.c
initialize_shell_variables () was modified to make PATH and SHELL
read-only when restricted == 1. These variables may not be unset
in a restricted shell.
4. flags.c
The variable `restricted' is now declared here. A new flag `-r',
to turn on restricted mode, has been added. `change_flag' has
been modified to disallow `set +r' if restricted == 1.
5. execute_cmd.c
execute_simple_command () was modified to disallow commands and
file names that contain a slash.
Code was added to do_redirections () and do_redirection() to
disallow output file redirection specifications if restricted is
1.
Chet Ramey
Information Network Services, Case Western Reserve University
chet@ins.CWRU.Edu
(I took almost all of this stuff out again after putting it in.)
+53
View File
@@ -0,0 +1,53 @@
This describes how bash users create, destroy, assign, and reference array
variables. Array variables are variables whose values are arrays of strings,
and whose elements may be referenced individually.
CREATING
- any variable may be declared as an array using `typeset -a'
- an ordinary variable may be converted to an array using
`typeset -a'; the value becomes array[0]
- there is a question of notation used to simultaneously declare
an array variable and populate it with values sequentially,
like ksh does with `set -A'. `set -A' is a horrible choice;
it should be discarded immediately.
- we can use `typeset -a array [values...]'
DESTROYING
- `unset name' will destroy the array `name'
- how to treat `typeset +a array'?
- I think we should keep the variable, convert it from an
array to an `ordinary' variable, and make the value at
the smallest index of the array the value of the new
variable
ASSIGNING
- array[index]=value will serve to assign values to individual
elements of the array
- the subscript can be an arbitrary arithmetic expression; it
will be run through the expression evaluator
- this can create arrays, too
- this is analogous to defining a variable by simply
assigning to it
REFERENCING
- $array will expand to all elements of the array, just like $*
expands to all the positional parameters
- "$array" is like "$@"
- ${array[index]} is used to reference array element `index', where
`index' can be an arbitrary arithmetic expression
- two special values for `index': * and @ expand to all
elements of the array, just like $* and $@. Quoting
behavior is the same, too
- using a subscript is an error if a variable has not been declared
as an array (is this wise?)
- ${#variable}, if `variable' is an array, expands to the number of
elements in the array
- ${#variable[n]} expands to the length of variable[n]. n
may be an arbitrary arithmetic expression
- ${#variable[*]} and ${#variable[@]} expand to the number of
elements in the array
OPEN QUESTIONS
- should we allow them to be exported? Ksh does not, but rc does
File diff suppressed because it is too large Load Diff
+87
View File
@@ -0,0 +1,87 @@
# This script is for bash-maintainers only! It takes a freshly unpacked Bash,
# and reorganizes it so that there is exactly one version of any given
# source file.
#
if [ "$0" != "./fixdist" ]; then
echo "You must run 'fixdist' from the 'support' directory!"
exit 1
fi
cd ../lib
must_exist="posixheaders/posixstat.h posixheaders/ansi_stdlib.h"
must_exist="$must_exist tilde/tilde.c tilde/tilde.h"
must_exist="$must_exist malloc/xmalloc.c"
for filename in $must_exist; do
if [ ! -f $filename ]; then
echo "The file lib/$filename doesn't exist, but it must!"
exit 1
fi
done
echo -n "Relinking neccessary files in lib/readline..."
cd readline
for filename in tilde.c tilde.h; do
rm $filename
ln -s ../tilde/$filename .
done
rm posixstat.h && ln -s ../posixheaders/posixstat.h .
rm ansi_stdlib.h && ln -s ../posixheaders/ansi_stdlib.h .
rm xmalloc.c && ln -s ../malloc/xmalloc.c .
echo "done."
echo -n "Linking files in . ..."
cd ../..
rm posixstat.h && ln -s lib/posixheaders/posixstat.h .
rm ansi_stdlib.h && ln -s lib/posixheaders/ansi_stdlib.h .
echo "done."
echo "Should I move the \"lib\" directory to \"../lib\" if I wouldn't"
echo -n "clobber anything by doing so (y/n)? "
read reply
if [ "$reply" != 'y' ]; then
echo "You said no, so in that case I'm all done."
exit 0
fi
# Try as hard as we can to move the lib directory to ../lib.
#
if [ -d ../lib ]; then
echo "The directory $(cd ../lib; pwd) already exists. It looks like:"
echo $(cd ../lib; ls -ldg .; ls -lF)
echo "I can:"
echo " 1) Move the directory to another name,"
echo " 2) Delete matching directories from within it,"
echo " 3) Copy files into existing directories, or"
echo " 4) Quit now, while you are ahead."
echo ""
echo -n "Which will it be? "
read reply
case "$reply" in
1)
echo "I would be moving the directory to lib-old now"
;;
2)
echo "I would be deleting the matching directories now"
;;
3)
echo "I would just go ahead and copy the directories now"
;;
4)
echo "Probably a good move. Look at the script support/mklinks."
;;
esac
else
echo -n "Moving lib to ../lib, and relinking lib in this directory..."
mv lib ../lib
mkdir lib
cd lib
../support/mklinks ../../lib
echo "done."
fi
echo "That concludes this fixing of the distribution."
exit 0
+110
View File
@@ -0,0 +1,110 @@
This file is histctl.def, from which is created histctl.c.
It implements the builtin "histctl" in Bash.
Copyright (C) 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
$PRODUCES histctl.c
$BUILTIN histctl
$FUNCTION histctl_builtin
$DEPENDS_ON HISTORY
$SHORT_DOC histctl [-cC] [-iI space|dups|both|none]
Control how lines are saved into the command history. An option
of -c enables command-oriented history, in which all lines of a
compound command are saved as a single history entry. The -i
option permits certain lines to be discarded without being stored
in the history: SPACE means to ignore lines beginning with a space;
DUPS means to ignore lines the same as the last command entered
into the history; BOTH enables SPACE and DUPS; and NONE means to
store all lines.
$END
#include "../shell.h"
#if defined (HISTORY)
#include "bashgetopt.h"
#include "../bashhist.h"
#define HIGNORE_NONE 0x0
#define HIGNORE_SPACE 0x01
#define HIGNORE_DUPS 0x02
#define HIGNORE_BOTH (HIGNORE_SPACE | HIGNORE_DUPS)
int
histctl_builtin (list)
WORD_LIST *list;
{
int opt;
char *spec;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "CcI:i:")) != -1)
{
switch (opt)
{
case 'c':
command_oriented_history++;
break;
case 'C':
command_oriented_history = 0;
break;
case 'i':
spec = list_optarg;
if (strcmp (spec, "none") == 0)
history_control = HIGNORE_NONE;
else if (strcmp (spec, "space") == 0)
history_control |= HIGNORE_SPACE;
else if (strcmp (spec, "dups") == 0)
history_control |= HIGNORE_DUPS;
else if (strcmp (spec, "both") == 0)
history_control |= HIGNORE_BOTH;
else
{
builtin_error ("invalid argument to -i: %s", spec);
builtin_error ("usage: histctl [-cC] [-iI space|dups|both|none]");
return (EX_USAGE);
}
break;
case 'I':
spec = list_optarg;
if (strcmp (spec, "none") == 0)
history_control = HIGNORE_NONE;
else if (strcmp (spec, "space") == 0)
history_control &= ~HIGNORE_SPACE;
else if (strcmp (spec, "dups") == 0)
history_control &= ~HIGNORE_DUPS;
else if (strcmp (spec, "both") == 0)
history_control &= ~HIGNORE_BOTH;
else
{
builtin_error ("invalid argument to -I: %s", spec);
builtin_error ("usage: histctl [-cC] [-iI space|dups|both|none]");
return (EX_USAGE);
}
break;
default:
report_bad_option ();
builtin_error ("usage: histctl [-cC] [-iI space|dups|both|none]");
return (EX_USAGE);
}
}
return (EXECUTION_SUCCESS);
}
#endif /* HISTORY */
+50
View File
@@ -0,0 +1,50 @@
/* The answer to this question is 24. */
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
#include "siglist.h"
/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
main (argc, argv)
int argc;
char **argv;
{
int longest, length = 0;
int i;
for (i = 0; i < NSIG; i++)
{
printf ("%2d) %s\n", i, sys_siglist[i]);
if (strlen (sys_siglist[i]) > length)
{
longest = i;
length = strlen (sys_siglist[i]);
}
}
printf ("The longest name is %d:\"%s\", which is %d chars in length.\n",
longest, sys_siglist[longest], length);
}
/*
* Local variables:
* compile-command: "cc -o longest_sig longest_sig.c"
* end:
*/
+41
View File
@@ -0,0 +1,41 @@
# Yet another script which requires an already built Bash.
#
# This makes links in the current directory to the directory specified as
# the first argument.
#
topdir=$1
if [ ! "$topdir" ]; then
echo "No directory specified. Read the script $0."
exit 1
fi
function clone_files ()
{
local dir=$1;
local files;
files=$(cd $dir; echo *);
if [ ! "$files" ]; then
return 0;
fi
for filename in $files; do
if [ -d $dir/$filename ]; then
# If the file to clone is this directory, then skip it.
if [ $(cd $dir/$filename; pwd) = $(pwd) ]; then
continue;
fi
mkdir $filename;
(cd $filename; clone_files ../$dir/$filename)
else
ln -s $dir/$filename .;
fi
done
rm -f \#* *~ .*~ *.bak .*.bak *.tmp .*.tmp *.o core a.out;
}
clone_files $topdir
+74
View File
@@ -0,0 +1,74 @@
#!/bin/sh
# How to make a distribution tarfile.
#
# $1 is the name of the program.
# $2 is the version number.
# Remaining args are files to tar.
# Optional argument of "~+notar" means don't create the actual tar file,
# just create the symlinked directory.
tar_inhibited=""
if [ "$1" = "+notar" ]; then
tar_inhibited=yes
shift
fi
PROGRAM=$1
VERSION=$2
if [ "$PROGRAM" = "" -o "$VERSION" = "" ]; then
echo "Usage: mktarfile [+notar] <progname> <version> <file ...>"
echo "Using the \`+notar' option causes a clone directory to be made."
exit 2;
fi
shift; shift
TARFILE=$PROGRAM.tar
TARDIR=$PROGRAM-$VERSION
# Delete the tarfile if we are to create it.
if [ ! "tar_inhibited" ]; then
rm -rf $TARFILE
fi
# Delete the destination directory if it already exists.
rm -rf $TARDIR
# Make the destination directory.
echo "Making directory $TARDIR..."
mkdir $TARDIR
topdir=`pwd`
where_I_am=$TARDIR
trap "cd $topdir" 3
for i in $*; do
filename=$i
while [ "$filename" ]; do
remainder=`echo $filename | sed 's@[-_a-zA-Z~0-9.]*/@@'`
dir=`echo $filename | sed "s@$remainder\\\$@@" | sed "s@/@@"`
if [ "$dir" ]; then
if [ ! -d $where_I_am/$dir ]; then
echo "Making directory $where_I_am/$dir..."
mkdir $where_I_am/$dir
fi
cd $where_I_am/$dir; where_I_am=`pwd`
filename=$remainder
else
break
fi
done
cd $topdir; where_I_am=$TARDIR
ln -s $topdir/$i $TARDIR/$i
done
if [ ! "$tar_inhibited" ]; then
echo "tar -chf $TARFILE $TARDIR"
tar -chf $TARFILE $TARDIR
echo "rm -rf $TARDIR"
rm -rf $TARDIR
fi
exit 0
+305
View File
@@ -0,0 +1,305 @@
/* Simple program to make new version numbers for the shell.
Big deal, but it was getting out of hand to do everything
in the makefile. */
/* Copyright (C) 1989 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "config.h"
#include <sys/types.h>
#include "posixstat.h"
#include <stdio.h>
#include "bashansi.h"
char *progname;
char *dir;
char *status;
FILE *must_open ();
main (argc, argv)
int argc;
char **argv;
{
FILE *file;
float distver = 0.0;
int buildver = 0, patchlevel = 0;
int dist = 0, build = 0, patch = 0;
int dist_inc = 0, build_inc = 0, patch_inc = 0;
int dot_dist_needs_making = 0;
int arg_index = 1;
struct stat sb;
progname = argv[0];
status = dir = (char *)0;
while (arg_index < argc && argv[arg_index][0] == '-')
{
if (strcmp (argv[arg_index], "-dist") == 0)
{
dist++;
dist_inc++;
}
else if (strcmp (argv[arg_index], "-build") == 0)
{
build++;
build_inc++;
}
else if (strcmp (argv[arg_index], "-patch") == 0)
{
patch++;
patch_inc++;
}
else if (strcmp (argv[arg_index], "-dir") == 0)
{
dir = argv[++arg_index];
if (dir == 0)
{
fprintf (stderr, "%s: `-dir' requires an argument\n", progname);
exit (1);
}
if (stat (dir, &sb) < 0)
{
fprintf (stderr, "%s: cannot stat %s\n", progname, dir);
exit (1);
}
if ((sb.st_mode & S_IFMT) != S_IFDIR)
{
fprintf (stderr, "%s: not a directory\n", progname);
exit (1);
}
}
else if (strcmp (argv[arg_index], "-status") == 0)
{
status = argv[++arg_index];
if (status == 0)
{
fprintf (stderr, "%s: `-status' requires an argument\n", progname);
exit (1);
}
}
else
{
fprintf (stderr, "%s: unknown option: %s\n", progname, argv[arg_index]);
fprintf (stderr, "usage: %s [-dist|-patch|-build] [-dir directory]\n", progname);
exit (1);
}
arg_index++;
}
if (get_float_from_file (".distribution", &distver, 1) == 0)
dot_dist_needs_making++;
if (get_int_from_file (".patchlevel", &patchlevel, 1) == 0)
{
patchlevel = 0;
patch_inc = 0;
}
if (get_int_from_file (".build", &buildver, 0) == 0)
buildver = 0;
/* Setting distribution version. */
if (dist && arg_index < argc)
if (sscanf (argv[arg_index], "%f", &distver) != 1)
{
fprintf (stderr, "%s: Bad input `%s'. Expected float value for -dist.\n",
progname, argv[arg_index]);
exit (1);
}
else
{
arg_index++;
dist_inc = 0;
}
/* Setting patchlevel via argument. */
if (patch && arg_index < argc)
if (sscanf (argv[arg_index], "%d", &patchlevel) != 1)
{
fprintf (stderr, "%s: Bad input `%s'. Expected int value for -patch.\n",
progname, argv[arg_index]);
exit (1);
}
else
{
arg_index++;
patch_inc = 0;
}
if (build && arg_index < argc)
if (sscanf (argv[arg_index], "%d", &buildver) != 1)
{
fprintf (stderr, "%s: Bad input `%s'. Expected int value for -build.\n",
progname, argv[arg_index]);
exit (1);
}
else
{
arg_index++;
build_inc = 0;
}
if (dot_dist_needs_making && !distver)
{
fprintf (stderr, "%s: There is no `.distribution' file to infer from.\n", progname);
exit (1);
}
if (dist_inc)
distver = distver + 0.01;
if (patch_inc)
patchlevel++;
if (build_inc)
buildver++;
file = must_open ("newversion.h", "w");
/* Output the leading comment. */
fprintf (file,
"/* Version control for the shell. This file gets changed when you say\n\
`make newversion' to the Makefile. It is created by mkversion. */\n");
fprintf (file, "\n/* The distribution version number of this shell. */\n");
fprintf (file, "#define DISTVERSION \"%.2f\"\n", distver);
fprintf (file, "\n/* The patch level of this version of the shell. */\n");
fprintf (file, "#define PATCHLEVEL %d\n", patchlevel);
fprintf (file, "\n/* The last built version of this shell. */\n");
fprintf (file, "#define BUILDVERSION %d\n", buildver);
if (status)
{
fprintf (file, "\n/* The release status of this shell. */\n");
fprintf (file, "#define RELSTATUS \"%s\"\n", status);
}
fprintf (file, "\n/* A version string for use by sccs and the what command. */\n\n");
if (status)
fprintf (file, "#define SCCSVERSION \"@(#)Bash version %.2f.%d(%d) %s GNU\"\n\n",
distver, patchlevel, buildver, status);
else
fprintf (file, "#define SCCSVERSION \"@(#)Bash version %.2f.%d(%d) GNU\"\n\n",
distver, patchlevel, buildver);
fclose (file);
file = must_open (".build", "w");
fprintf (file, "%d\n", buildver);
fclose (file);
/* Making a new distribution. */
if (dist)
{
file = must_open (".distribution", "w");
fprintf (file, "%.2f\n", distver);
fclose (file);
}
/* Releasing a new patch level. */
if (patch)
{
file = must_open (".patchlevel", "w");
fprintf (file, "%d\n", patchlevel);
fclose (file);
}
exit (0);
}
char *
makename (fn, from_srcdir)
char *fn;
{
char *ret;
int dlen;
dlen = (from_srcdir && dir) ? strlen (dir) + 1 : 0;
ret = (char *)malloc (dlen + strlen (fn) + 1);
if (ret == 0)
{
fprintf (stderr, "%s: malloc failed\n", progname);
exit (1);
}
if (from_srcdir && dir)
sprintf (ret, "%s/%s", dir, fn);
else
(void)strcpy (ret, fn);
return ret;
}
get_float_from_file (filename, var, from_srcdir)
char *filename;
float *var;
int from_srcdir;
{
FILE *stream;
int result;
char *name;
name = makename (filename, from_srcdir);
stream = fopen (name, "r");
free (name);
if (stream == (FILE *)NULL)
return (0);
result = fscanf (stream, "%f\n", var);
fclose (stream);
return (result == 1);
}
get_int_from_file (filename, var, from_srcdir)
char *filename;
int *var, from_srcdir;
{
FILE *stream;
int result;
char *name;
name = makename (filename, from_srcdir);
stream = fopen (name, "r");
free (name);
if (stream == (FILE *)NULL)
return (0);
result = fscanf (stream, "%d\n", var);
fclose (stream);
return (result == 1);
}
FILE *
must_open (name, mode)
char *name, *mode;
{
FILE *temp = fopen (name, mode);
if (!temp)
{
fprintf (stderr, "%s: Cannot open `%s' for mode `%s'.\n",
progname, name, mode);
fprintf
(stderr,
"Perhaps you don't have %s permission to the file or directory.\n",
(strcmp (mode, "w") == 0) ? "write" : "read");
exit (3);
}
return (temp);
}
+64
View File
@@ -0,0 +1,64 @@
/*
* getpagesize - print the system pagesize
*
* Chet Ramey
* chet@ins.cwru.edu
*/
#include <stdio.h>
/*
* I know these systems have getpagesize(2)
*/
#if defined (Bsd) || defined (Ultrix) || defined (sun)
# define HAVE_GETPAGESIZE
#endif
#if !defined (HAVE_GETPAGESIZE)
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
# if defined (_SC_PAGESIZE)
# define getpagesize() sysconf(_SC_PAGESIZE)
# endif /* _SC_PAGESIZE */
#endif
#if !defined (getpagesize)
# include <sys/param.h>
# if defined (PAGESIZE)
# define getpagesize() PAGESIZE
# else /* !PAGESIZE */
# if defined (EXEC_PAGESIZE)
# define getpagesize() EXEC_PAGESIZE
# else /* !EXEC_PAGESIZE */
# if defined (NBPG)
# if !defined (CLSIZE)
# define CLSIZE 1
# endif /* !CLSIZE */
# define getpagesize() (NBPG * CLSIZE)
# else /* !NBPG */
# if defined (NBPC)
# define getpagesize() NBPC
# endif /* NBPC */
# endif /* !NBPG */
# endif /* !EXEC_PAGESIZE */
# endif /* !PAGESIZE */
#endif /* !getpagesize */
#if !defined (getpagesize)
# define getpagesize() 4096 /* Just punt and use reasonable value */
#endif
#endif /* no EXEC_PAGESIZE */
#endif /* not HAVE_GETPAGESIZE */
main()
{
#if defined (HAVE_GETPAGESIZE) || defined (getpagesize)
printf ("%ld\n", getpagesize ());
#else
puts ("1024");
#endif
}
+20
View File
@@ -0,0 +1,20 @@
#! /bin/sh
#
# pagesize.sh -- determine this system's page size, and write a define to
# lib/malloc/pagesize.h for the Gnu malloc's valloc().
echo "/*"
echo " * pagesize.h"
echo " *"
echo " * This file is automatically generated by pagesize.sh"
echo " * Do not edit!"
echo " */"
echo ""
if [ -x /bin/pagesize ]; then
echo "#define getpagesize() `/bin/pagesize`"
else
echo "#define getpagesize() `./support/pagesize.aux`"
fi
exit 0
File diff suppressed because it is too large Load Diff
+293
View File
@@ -0,0 +1,293 @@
This file is read.def, from which is created read.c.
It implements the builtin "read" in Bash.
Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
$PRODUCES read.c
$BUILTIN read
$FUNCTION read_builtin
$SHORT_DOC read [-r] [-p prompt] [-a array] [name ...]
One line is read from the standard input, and the first word is
assigned to the first NAME, the second word to the second NAME, etc.
with leftover words assigned to the last NAME. Only the characters
found in $IFS are recognized as word delimiters. The return code is
zero, unless end-of-file is encountered. If the -r option is given,
this signifies `raw' input, and backslash processing is disabled. If
the `-p' option is supplied, the string supplied as an argument is
output without a trailing newline before attempting to read. If -a
is supplied, the words read are assigned to sequential indices of ARRAY,
starting at zero.
$END
#include <stdio.h>
#include "../shell.h"
#include "common.h"
#include "bashgetopt.h"
static int stream_close ();
extern int interrupt_immediately;
/* Read the value of the shell variables whose names follow.
The reading is done from the current input stream, whatever
that may be. Successive words of the input line are assigned
to the variables mentioned in LIST. The last variable in LIST
gets the remainder of the words on the line. If no variables
are mentioned in LIST, then the default variable is $REPLY. */
read_builtin (list)
WORD_LIST *list;
{
register char *varname;
int size, c, i, fildes, raw_mode, pass_next, saw_escape, opt, retval;
char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname;
FILE *input_stream;
SHELL_VAR *ifs;
#if defined (ARRAY_VARS)
SHELL_VAR *v;
WORD_LIST *alist;
#endif
i = 0; /* Index into the string that we are reading. */
raw_mode = 0; /* Not reading raw input be default. */
arrayname = prompt = (char *)NULL;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "rp:a:")) != -1)
{
switch (opt)
{
case 'r':
raw_mode = 1;
break;
case 'p':
prompt = list_optarg;
break;
#if defined (ARRAY_VARS)
case 'a':
arrayname = list_optarg;
break;
#endif
default:
builtin_usage ();
return (EX_USAGE);
}
}
list = loptend;
/* We need unbuffered input from stdin. So we make a new stream with
the same file descriptor as stdin, then unbuffer it. */
fildes = dup (fileno (stdin));
if (fildes == -1)
return (EXECUTION_FAILURE);
input_stream = fdopen (fildes, "r");
if (!input_stream)
{
close (fildes);
return (EXECUTION_FAILURE);
}
ifs = find_variable ("IFS");
if (ifs == 0)
ifs_chars = " \t\n";
else
ifs_chars = value_cell (ifs);
input_string = xmalloc (size = 128);
setbuf (input_stream, (char *)NULL);
begin_unwind_frame ("read_builtin");
add_unwind_protect (xfree, input_string);
add_unwind_protect (stream_close, input_stream);
interrupt_immediately++;
if (prompt && isatty (0))
{
fprintf (stderr, "%s", prompt);
fflush (stderr);
}
pass_next = 0; /* Non-zero signifies last char was backslash. */
saw_escape = 0; /* Non-zero signifies that we saw an escape char */
while ((c = getc (input_stream)) != EOF)
{
if (i + 2 >= size)
input_string = xrealloc (input_string, size += 128);
/* If the next character is to be accepted verbatim, a backslash
newline pair still disappears from the input. */
if (pass_next)
{
if (c == '\n')
i--; /* back up over the CTLESC */
else
input_string[i++] = c;
pass_next = 0;
continue;
}
if (c == '\\' && !raw_mode)
{
pass_next++;
saw_escape++;
input_string[i++] = CTLESC;
continue;
}
if (c == '\n')
break;
if (c == CTLESC || c == CTLNUL)
input_string[i++] = CTLESC;
input_string[i++] = c;
}
input_string[i] = '\0';
interrupt_immediately--;
discard_unwind_frame ("read_builtin");
fclose (input_stream);
if (c == EOF)
{
retval = EXECUTION_FAILURE;
input_string[0] = '\0';
}
else
retval = EXECUTION_SUCCESS;
#if defined (ARRAY_VARS)
/* If -a was given, take the string read, break it into a list of words,
an assign them to `arrayname' in turn. */
if (arrayname)
{
v = find_variable (arrayname);
if (v == 0)
v = make_new_array_variable (arrayname);
else if (array_p (v) == 0)
v = convert_var_to_array (v);
alist = list_string (input_string, " \t\n", 0);
if (alist)
{
assign_word_list (array_cell (v), alist);
dispose_words (alist);
}
free (input_string);
return (retval);
}
#endif /* ARRAY_VARS */
if (!list)
{
SHELL_VAR *var;
char *t;
if (saw_escape)
{
t = dequote_string (input_string);
var = bind_variable ("REPLY", t);
free (t);
}
else
var = bind_variable ("REPLY", input_string);
var->attributes &= ~att_invisible;
free (input_string);
}
else
{
SHELL_VAR *var;
char *t;
/* This code implements the Posix.2 spec for splitting the words
read and assigning them to variables. If $IFS is unset, we
use the default value of " \t\n". */
if (!ifs_chars)
ifs_chars = "";
orig_input_string = input_string;
while (list->next)
{
char *e, *t1;
varname = list->word->word;
/* If there are more variables than words read from the input,
the remaining variables are set to the empty string. */
if (*input_string)
{
/* This call updates INPUT_STRING. */
t = get_word_from_string (&input_string, ifs_chars, &e);
if (t)
*e = '\0';
/* Don't bother to remove the CTLESC unless we added one
somewhere while reading the string. */
if (t && saw_escape)
{
t1 = dequote_string (t);
var = bind_variable (varname, t1);
free (t1);
}
else
var = bind_variable (varname, t);
}
else
{
t = (char *)0;
var = bind_variable (varname, "");
}
stupidly_hack_special_variables (varname);
var->attributes &= ~att_invisible;
if (t)
free (t);
list = list->next;
}
if (saw_escape)
{
t = dequote_string (input_string);
var = bind_variable (list->word->word, t);
free (t);
}
else
var = bind_variable (list->word->word, input_string);
stupidly_hack_special_variables (list->word->word);
var->attributes &= ~att_invisible;
free (orig_input_string);
}
return (retval);
}
/* This way I don't have to know whether fclose () is a
function or a macro. */
static int
stream_close (file)
FILE *file;
{
return (fclose (file));
}

Some files were not shown because too many files have changed in this diff Show More