mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 15:43:18 +02:00
commit bash-20110513 snapshot
This commit is contained in:
@@ -11577,3 +11577,87 @@ builtins/printf.def
|
||||
ferror(stdout) true, and PRETURN is going to be called, let PRETURN
|
||||
print the error message rather than doubling up the messages. Fixes
|
||||
problem reported by Roman Rakus <rrakus@redhat.com>
|
||||
|
||||
5/9
|
||||
---
|
||||
doc/{bash.1,bashref.texi}
|
||||
- add note to the effect that lists inside compound command can be
|
||||
terminated by newlines as well as semicolons. Suggested by
|
||||
Roman Byshko <rbyshko@gmail.com>
|
||||
|
||||
5/10
|
||||
----
|
||||
subst.c
|
||||
- remove_quoted_nulls: fix problem that caused it to skip over the
|
||||
character after a CTLNUL, which had the effect of skipping every
|
||||
other of a series of CTLNULs. Fixes bug reported by
|
||||
Marten Wikstrom <marten.wikstrom@keystream.se>
|
||||
|
||||
5/11
|
||||
----
|
||||
subst.c
|
||||
- extract_process_subst: add SX_COMMAND flag to call to
|
||||
extract_delimited_string, since we're expanding the same sort of
|
||||
command as command substitution. Fixes bug reported in Ubuntu
|
||||
bug 779848
|
||||
|
||||
5/12
|
||||
----
|
||||
configure.in
|
||||
- set the prefer_shared and prefer_static variables appropriately
|
||||
depending on the value of $opt_static_link
|
||||
|
||||
aclocal.m4
|
||||
- AC_LIB_LINKFLAGS_BODY: change to not prefer shared versions of the
|
||||
libraries it's searching for if the prefer_shared variable is "no".
|
||||
Fixes problem reported by Cedric Arbogast <arbogast.cedric@gmail.com>
|
||||
|
||||
5/13
|
||||
----
|
||||
lib/readline/readline.c
|
||||
- _rl_internal_teardown: add call to _rl_disable_meta_key to make the
|
||||
meta key active only for the duration of the call to readline()
|
||||
- _rl_internal_setup: move call to _rl_enable_meta_key here from
|
||||
readline_initialize_everything so the meta key is active only for
|
||||
the duration of the call to readline(). Suggestion from Miroslav
|
||||
Lichvar <mlichvar@redhat.com>
|
||||
|
||||
builtins/help.def
|
||||
- help_builtin: change strncmp to strcmp so that `help read' no longer
|
||||
matches `readonly'. Suggested by Clark Wang <dearvoid@gmail.com>
|
||||
|
||||
config.h.in
|
||||
- add define for GLIBC21, checked using jm_GLIBC21 as part of the tests
|
||||
for libintl
|
||||
|
||||
lib/malloc/malloc.c
|
||||
- internal_free: don't use the cached value of memtop when deciding
|
||||
whether or not to adjust the break and give memory back to the kernel
|
||||
when using the GNU C library, since glibc uses sbrk for its own
|
||||
internal purposes. From Debian bug 614815, reported by Samuel
|
||||
Thibault <samuel.thibault@gnu.org>
|
||||
|
||||
aclocal.m4
|
||||
- BASH_STRUCT_WEXITSTATUS_OFFSET: change AC_RUN_IFELSE to AC_TRY_RUN
|
||||
to avoid warning about not using AC_LANG_SOURCE
|
||||
|
||||
5/14
|
||||
----
|
||||
bashline.[ch]
|
||||
- two new functions, bashline_set_event_hook and bashline_reset_event_hook,
|
||||
to set rl_event_hook to bash_event_hook and back to NULL, respectively
|
||||
- don't set rl_event_hook unconditionally
|
||||
|
||||
sig.c
|
||||
- termsig_sighandler: if the shell is currently interactive and
|
||||
readline is active, call bashline_set_event_hook to cause
|
||||
termsig_handler to be called via bash_event_hook when the shell
|
||||
returns from the signal handler
|
||||
|
||||
5/15
|
||||
----
|
||||
lib/readline/display.c
|
||||
- _rl_col_width: Mac OS X has a bug in wcwitdh: it does not return 0
|
||||
for UTF-8 combining characters. Added workaround dependent on
|
||||
MACOSX. Fixes problem pointed out by Thomas De Contes
|
||||
<d.l.tDecontes@free.fr>
|
||||
|
||||
+236
-1
@@ -9648,7 +9648,7 @@ lib/sh/eaccess.c
|
||||
- eaccess(2) apparently does only half the job: it does not check that
|
||||
the permission bits on a file actually allow, for instance, execution.
|
||||
Need to augment with a call to sh_stataccess if eaccess returns
|
||||
success on FreeBSD. Fixes FreeBSD problem reported by Jonan Hattne
|
||||
success on FreeBSD. Fixes FreeBSD problem reported by Johan Hattne
|
||||
<johan.hattne@utsouthwestern.edu>
|
||||
|
||||
3/28
|
||||
@@ -11413,8 +11413,243 @@ lib/readline/display.c
|
||||
- don't call tputs on DJGPP; there is no good terminfo support
|
||||
|
||||
lib/readline/terminal.c
|
||||
- include <pc.h> on MDOS
|
||||
- get and set screen size using DJGPP-specific calls on MSDOS
|
||||
- use DJGPP-specific initialization on MSDOS, zeroing all the
|
||||
_rl_term_* variables
|
||||
- don't call tputs on DJGPP; there is no good terminfo support
|
||||
DJGPP support from Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
4/6
|
||||
---
|
||||
|
||||
config-top.h
|
||||
- change DEFAULT_PATH_VALUE to something more useful and modern
|
||||
|
||||
4/8
|
||||
---
|
||||
tests/printf2.sub
|
||||
- make sure LC_ALL and LC_CTYPE are set so LANG assignment takes effect.
|
||||
Reported by Cedric Arbogast <arbogast.cedric@gmail.com>
|
||||
|
||||
4/11
|
||||
----
|
||||
include/chartypes.h
|
||||
- fix a couple of dicey defines (though ones that don't cause any
|
||||
compiler warnings) in IN_CTYPE_DOMAIN
|
||||
|
||||
doc/{bashref.texi,bash.1}
|
||||
- add note referring to duplicating file descriptors in sections
|
||||
describing redirecting stdout and stderr and appending to stdout
|
||||
and stderr. Suggested by Matthew Dinger <mdinger.bugzilla@gmail.com>
|
||||
|
||||
pcomplete.c
|
||||
- it_init_helptopics: new function to support completing on help topics,
|
||||
not just builtins
|
||||
- it_helptopics: new programmable completion list of help topics
|
||||
- build list of helptopic completions in gen_action_completions on
|
||||
demand
|
||||
|
||||
pcomplete.h
|
||||
- new extern declaration for it_helptopics
|
||||
|
||||
builtins/complete.def
|
||||
- the `helptopic' action now maps to CA_HELPTOPIC intead of CA_BUILTIN,
|
||||
since there are more help topics than just builtins. Suggested by
|
||||
Clark Wang <dearvoid@gmail.com>
|
||||
|
||||
4/12
|
||||
----
|
||||
print_cmd.c
|
||||
- fix print_arith_for_command to add a call to PRINT_DEFERRED_HEREDOCS
|
||||
before ending the body of the command, so heredocs get attached to
|
||||
the right command instead of to the loop. From gentoo bug 363371
|
||||
http://bugs.gentoo.org/show_bug.cgi?id=363371
|
||||
|
||||
execute_cmd.c
|
||||
- change coproc_pidchk to unset the appropriate shell variables when
|
||||
the (currently single) known coproc pid terminates
|
||||
- cleanup and new functions to fully support multiple coprocesses when
|
||||
and if I decide to go there
|
||||
|
||||
4/13
|
||||
----
|
||||
print_cmd.c
|
||||
- fix print_group_command to add a call to PRINT_DEFERRED_HEREDOCS
|
||||
after call to make_command_string_internal before printing closing
|
||||
`}'
|
||||
- fix make_command_string_internal to add a call to
|
||||
PRINT_DEFERRED_HEREDOCS after recursive call to
|
||||
make_command_string_internal in case cm_subshell before printing
|
||||
closing `)'
|
||||
|
||||
4/14
|
||||
----
|
||||
print_cmd.c
|
||||
- change overlapping strcpy in named_function_string to memmove
|
||||
|
||||
sig.h
|
||||
- UNBLOCK_SIGNAL: convenience define, same as UNBLOCK_CHILD, just
|
||||
restores an old signal mask
|
||||
|
||||
trap.c
|
||||
- set_signal: instead of setting the signal handler to SIG_IGN while
|
||||
installing the new trap handler, block the signal and unblock it
|
||||
after the new handler is installed. Fixes bug reported by Roman
|
||||
Rakus <rrakus@redhat.com>
|
||||
|
||||
4/15
|
||||
----
|
||||
doc/{bash.1,bashref.texi}
|
||||
- make it clear that enabling monitor mode means that all jobs run in
|
||||
separate process groups
|
||||
|
||||
4/18
|
||||
----
|
||||
builtins/fc.def
|
||||
- update fix of 4/15/2010 to not take saved_command_line_count into
|
||||
account when stepping down the history list to make sure that
|
||||
last_hist indexes something that is valid. Fixes bug reported by
|
||||
<piuma@piumalab.org>
|
||||
|
||||
4/19
|
||||
----
|
||||
builtins/fc.def
|
||||
- fc_gethnum: make sure the calculation to decide the last history
|
||||
entry is exactly the same as fc_builtin. Fixes bug uncovered by
|
||||
fix of 4/18 to stop seg fault
|
||||
|
||||
4/22
|
||||
----
|
||||
lib/readline/terminal.c
|
||||
- change _rl_enable_meta_key to set a flag indicating that it sent the
|
||||
enable-meta sequence
|
||||
- _rl_disable_meta_key: new function to turn off meta mode after we
|
||||
turned it on with _rl_enable_meta_key
|
||||
|
||||
lib/readline/rlprivate.h
|
||||
- extern declaration for _rl_disable_meta_key
|
||||
|
||||
configure.in
|
||||
- if not cross-compiling, set CFLAGS_FOR_BUILD from any CFLAGS inherited
|
||||
from the environment. Fixes HP/UX build problem reported by
|
||||
"Daniel Richard G." <skunk@iSKUNK.ORG>
|
||||
|
||||
4/26
|
||||
----
|
||||
config-top.h
|
||||
- define MULTIPLE_COPROCS to 0 so the code is still disabled but easy
|
||||
to enable via configure option or editing this file
|
||||
|
||||
4/29
|
||||
----
|
||||
lib/sh/eaccess.c
|
||||
- freebsd provides faccessat, with the same misfeature as their eaccess
|
||||
and access implementations (X_OK returns true for uid==0 regardless
|
||||
of the actual file permissions), so reorganize code to check the
|
||||
file permissions as with eaccess. Report and fix from Johan Hattne
|
||||
<johan.hattne@utsouthwestern.edu>
|
||||
|
||||
5/2
|
||||
---
|
||||
doc/{bash.1,bashref.texi}
|
||||
- add forward reference to `Pattern Matching' from `Pathname
|
||||
Expansion', suggested by Greg Wooledge <wooledg@eeg.ccf.org>
|
||||
|
||||
5/5
|
||||
---
|
||||
pcomplib.c
|
||||
- the bash_completion project now distributes over 200 completions
|
||||
for various programs, with no end in sight, so increase the value
|
||||
of COMPLETE_HASH_BUCKETS from 32 to 128
|
||||
|
||||
pathexp.c
|
||||
- quote_string_for_globbing: make sure CTLESC quoting CTLESC is
|
||||
translated into \<CTLESC> even if the flags include QGLOB_REGEXP.
|
||||
We don't want to process the second CTLESC as a quote character.
|
||||
Fixes bug reported by Shawn Bohrer <sbohrer@rgmadvisors.com>
|
||||
|
||||
5/6
|
||||
---
|
||||
builtins/printf.def
|
||||
- change PRETURN to not call fflush if ferror(stdout) is true
|
||||
- if a call to one of the stdio functions or printstr leaves
|
||||
ferror(stdout) true, and PRETURN is going to be called, let PRETURN
|
||||
print the error message rather than doubling up the messages. Fixes
|
||||
problem reported by Roman Rakus <rrakus@redhat.com>
|
||||
|
||||
5/9
|
||||
---
|
||||
doc/{bash.1,bashref.texi}
|
||||
- add note to the effect that lists inside compound command can be
|
||||
terminated by newlines as well as semicolons. Suggested by
|
||||
Roman Byshko <rbyshko@gmail.com>
|
||||
|
||||
5/10
|
||||
----
|
||||
subst.c
|
||||
- remove_quoted_nulls: fix problem that caused it to skip over the
|
||||
character after a CTLNUL, which had the effect of skipping every
|
||||
other of a series of CTLNULs. Fixes bug reported by
|
||||
Marten Wikstrom <marten.wikstrom@keystream.se>
|
||||
|
||||
5/11
|
||||
----
|
||||
subst.c
|
||||
- extract_process_subst: add SX_COMMAND flag to call to
|
||||
extract_delimited_string, since we're expanding the same sort of
|
||||
command as command substitution. Fixes bug reported in Ubuntu
|
||||
bug 779848
|
||||
|
||||
5/12
|
||||
----
|
||||
configure.in
|
||||
- set the prefer_shared and prefer_static variables appropriately
|
||||
depending on the value of $opt_static_link
|
||||
|
||||
aclocal.m4
|
||||
- AC_LIB_LINKFLAGS_BODY: change to not prefer shared versions of the
|
||||
libraries it's searching for if the prefer_shared variable is "no".
|
||||
Fixes problem reported by Cedric Arbogast <arbogast.cedric@gmail.com>
|
||||
|
||||
5/13
|
||||
----
|
||||
lib/readline/readline.c
|
||||
- _rl_internal_teardown: add call to _rl_disable_meta_key to make the
|
||||
meta key active only for the duration of the call to readline()
|
||||
- _rl_internal_setup: move call to _rl_enable_meta_key here from
|
||||
readline_initialize_everything so the meta key is active only for
|
||||
the duration of the call to readline(). Suggestion from Miroslav
|
||||
Lichvar <mlichvar@redhat.com>
|
||||
|
||||
builtins/help.def
|
||||
- help_builtin: change strncmp to strcmp so that `help read' no longer
|
||||
matches `readonly'. Suggested by Clark Wang <dearvoid@gmail.com>
|
||||
|
||||
config.h.in
|
||||
- add define for GLIBC21, checked using jm_GLIBC21 as part of the tests
|
||||
for libintl
|
||||
|
||||
lib/malloc/malloc.c
|
||||
- internal_free: don't use the cached value of memtop when deciding
|
||||
whether or not to adjust the break and give memory back to the kernel
|
||||
when using the GNU C library, since glibc uses sbrk for its own
|
||||
internal purposes. From Debian bug 614815, reported by Samuel
|
||||
Thibault <samuel.thibault@gnu.org>
|
||||
|
||||
aclocal.m4
|
||||
- BASH_STRUCT_WEXITSTATUS_OFFSET: change AC_RUN_IFELSE to AC_TRY_RUN
|
||||
to avoid warning about not using AC_LANG_SOURCE
|
||||
|
||||
5/14
|
||||
----
|
||||
bashline.[ch]
|
||||
- two new functions, bashline_set_event_hook and bashline_reset_event_hook,
|
||||
to set rl_event_hook to bash_event_hook and back to NULL, respectively
|
||||
- don't set rl_event_hook unconditionally
|
||||
|
||||
sig.c
|
||||
- termsig_sighandler: if the shell is currently interactive and
|
||||
readline is active, call bashline_set_event_hook to cause
|
||||
termsig_handler to be called via bash_event_hook when the shell
|
||||
returns from the signal handler
|
||||
|
||||
@@ -864,6 +864,7 @@ tests/exp2.sub f
|
||||
tests/exp3.sub f
|
||||
tests/exp4.sub f
|
||||
tests/exp5.sub f
|
||||
tests/exp6.sub f
|
||||
tests/extglob.tests f
|
||||
tests/extglob.right f
|
||||
tests/extglob1.sub f
|
||||
|
||||
Vendored
+3
-3
@@ -3098,7 +3098,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
||||
found_so=
|
||||
found_a=
|
||||
if test $use_additional = yes; then
|
||||
if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
found_dir="$additional_libdir"
|
||||
found_so="$additional_libdir/lib$name.$shlibext"
|
||||
if test -f "$additional_libdir/lib$name.la"; then
|
||||
@@ -3120,7 +3120,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
||||
case "$x" in
|
||||
-L*)
|
||||
dir=`echo "X$x" | sed -e 's/^X-L//'`
|
||||
if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/lib$name.$shlibext"
|
||||
if test -f "$dir/lib$name.la"; then
|
||||
@@ -4123,7 +4123,7 @@ main()
|
||||
AC_DEFUN(BASH_STRUCT_WEXITSTATUS_OFFSET,
|
||||
[AC_MSG_CHECKING(for offset of exit status in return status from wait)
|
||||
AC_CACHE_VAL(bash_cv_wexitstatus_offset,
|
||||
[AC_RUN_IFELSE([
|
||||
[AC_TRY_RUN([
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
+10
-8
@@ -1,5 +1,5 @@
|
||||
@%:@! /bin/sh
|
||||
@%:@ From configure.in for Bash 4.2, version 4.040.
|
||||
@%:@ From configure.in for Bash 4.2, version 4.041.
|
||||
@%:@ Guess values for system-dependent variables and create Makefiles.
|
||||
@%:@ Generated by GNU Autoconf 2.68 for bash 4.2-maint.
|
||||
@%:@
|
||||
@@ -4856,10 +4856,12 @@ if test "$opt_profiling" = "yes"; then
|
||||
DEBUG= MALLOC_DEBUG=
|
||||
fi
|
||||
|
||||
prefer_shared=yes
|
||||
prefer_static=no
|
||||
|
||||
if test "$opt_static_link" = yes; then
|
||||
enable_static=yes
|
||||
enable_shared=no
|
||||
enable_rpath=no
|
||||
prefer_static=yes
|
||||
prefer_shared=no
|
||||
# if we're using gcc, add `-static' to LDFLAGS, except on Solaris >= 2
|
||||
if test -n "$GCC" || test "$ac_cv_c_compiler_gnu" = "yes"; then
|
||||
STATIC_LD="-static"
|
||||
@@ -7565,7 +7567,7 @@ fi
|
||||
found_so=
|
||||
found_a=
|
||||
if test $use_additional = yes; then
|
||||
if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
found_dir="$additional_libdir"
|
||||
found_so="$additional_libdir/lib$name.$shlibext"
|
||||
if test -f "$additional_libdir/lib$name.la"; then
|
||||
@@ -7595,7 +7597,7 @@ fi
|
||||
case "$x" in
|
||||
-L*)
|
||||
dir=`echo "X$x" | sed -e 's/^X-L//'`
|
||||
if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/lib$name.$shlibext"
|
||||
if test -f "$dir/lib$name.la"; then
|
||||
@@ -8355,7 +8357,7 @@ fi
|
||||
found_so=
|
||||
found_a=
|
||||
if test $use_additional = yes; then
|
||||
if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
found_dir="$additional_libdir"
|
||||
found_so="$additional_libdir/lib$name.$shlibext"
|
||||
if test -f "$additional_libdir/lib$name.la"; then
|
||||
@@ -8385,7 +8387,7 @@ fi
|
||||
case "$x" in
|
||||
-L*)
|
||||
dir=`echo "X$x" | sed -e 's/^X-L//'`
|
||||
if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/lib$name.$shlibext"
|
||||
if test -f "$dir/lib$name.la"; then
|
||||
|
||||
+18
-18
@@ -15,55 +15,55 @@
|
||||
'configure.in'
|
||||
],
|
||||
{
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'AM_PROG_F77_C_O' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'_AM_COND_IF' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'AC_CANONICAL_TARGET' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'_AM_COND_IF' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'AC_FC_SRCEXT' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_FC_SRCEXT' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AM_PATH_GUILE' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AM_PATH_GUILE' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'AC_REQUIRE_AUX_FILE' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'AC_REQUIRE_AUX_FILE' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AM_NLS' => 1,
|
||||
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
|
||||
'AM_MAKEFILE_INCLUDE' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'AM_MAKEFILE_INCLUDE' => 1,
|
||||
'AM_PROG_CXX_C_O' => 1,
|
||||
'_AM_MAKEFILE_INCLUDE' => 1,
|
||||
'_AM_COND_ENDIF' => 1,
|
||||
'_AM_MAKEFILE_INCLUDE' => 1,
|
||||
'AM_ENABLE_MULTILIB' => 1,
|
||||
'AM_SILENT_RULES' => 1,
|
||||
'AM_PROG_MOC' => 1,
|
||||
'AC_CONFIG_FILES' => 1,
|
||||
'include' => 1,
|
||||
'LT_INIT' => 1,
|
||||
'AM_PROG_AR' => 1,
|
||||
'include' => 1,
|
||||
'AM_GNU_GETTEXT' => 1,
|
||||
'AM_PROG_AR' => 1,
|
||||
'AC_LIBSOURCE' => 1,
|
||||
'AM_PROG_FC_C_O' => 1,
|
||||
'AC_CANONICAL_BUILD' => 1,
|
||||
'AM_PROG_FC_C_O' => 1,
|
||||
'AC_FC_FREEFORM' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'sinclude' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AM_XGETTEXT_OPTION' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'sinclude' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AM_XGETTEXT_OPTION' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'AM_POT_TOOLS' => 1,
|
||||
|
||||
+1385
-1387
File diff suppressed because it is too large
Load Diff
+13
-2
@@ -540,8 +540,6 @@ initialize_readline ()
|
||||
rl_filename_dequoting_function = bash_dequote_filename;
|
||||
rl_char_is_quoted_p = char_is_quoted;
|
||||
|
||||
rl_event_hook = bash_event_hook;
|
||||
|
||||
#if 0
|
||||
/* This is superfluous and makes it impossible to use tab completion in
|
||||
vi mode even when explicitly binding it in ~/.inputrc. sv_strict_posix()
|
||||
@@ -560,6 +558,18 @@ bashline_reinitialize ()
|
||||
bash_readline_initialized = 0;
|
||||
}
|
||||
|
||||
void
|
||||
bashline_set_event_hook ()
|
||||
{
|
||||
rl_event_hook = bash_event_hook;
|
||||
}
|
||||
|
||||
void
|
||||
bashline_reset_event_hook ()
|
||||
{
|
||||
rl_event_hook = 0;
|
||||
}
|
||||
|
||||
/* On Sun systems at least, rl_attempted_completion_function can end up
|
||||
getting set to NULL, and rl_completion_entry_function set to do command
|
||||
word completion if Bash is interrupted while trying to complete a command
|
||||
@@ -3743,6 +3753,7 @@ bash_dequote_text (text)
|
||||
static int
|
||||
bash_event_hook ()
|
||||
{
|
||||
itrace("bash_event_hook");
|
||||
CHECK_TERMSIG;
|
||||
}
|
||||
|
||||
|
||||
+3754
File diff suppressed because it is too large
Load Diff
@@ -33,6 +33,9 @@ extern void bashline_reset __P((void));
|
||||
extern void bashline_reinitialize __P((void));
|
||||
extern int bash_re_edit __P((char *));
|
||||
|
||||
extern void bashline_set_event_hook __P((void));
|
||||
extern void bashline_reset_event_hook __P((void));
|
||||
|
||||
extern int bind_keyseq_to_unix_command __P((char *));
|
||||
|
||||
extern char **bash_default_completion __P((const char *, int, int, int, int));
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/* bashline.h -- interface to the bash readline functions in bashline.c. */
|
||||
|
||||
/* Copyright (C) 1993-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 (_BASHLINE_H_)
|
||||
#define _BASHLINE_H_
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
extern int bash_readline_initialized;
|
||||
|
||||
extern void posix_readline_initialize __P((int));
|
||||
extern void reset_completer_word_break_chars __P((void));
|
||||
extern int enable_hostname_completion __P((int));
|
||||
extern void initialize_readline __P((void));
|
||||
extern void bashline_reset __P((void));
|
||||
extern void bashline_reinitialize __P((void));
|
||||
extern int bash_re_edit __P((char *));
|
||||
|
||||
extern int bind_keyseq_to_unix_command __P((char *));
|
||||
|
||||
extern char **bash_default_completion __P((const char *, int, int, int, int));
|
||||
|
||||
/* Used by programmable completion code. */
|
||||
extern char *command_word_completion_function __P((const char *, int));
|
||||
extern char *bash_groupname_completion_function __P((const char *, int));
|
||||
extern char *bash_servicename_completion_function __P((const char *, int));
|
||||
|
||||
extern char **get_hostname_list __P((void));
|
||||
extern void clear_hostname_list __P((void));
|
||||
|
||||
extern char **bash_directory_completion_matches __P((const char *));
|
||||
extern char *bash_dequote_text __P((const char *));
|
||||
|
||||
#endif /* _BASHLINE_H_ */
|
||||
+1
-1
@@ -140,7 +140,7 @@ help_builtin (list)
|
||||
for (i = 0; name = shell_builtins[i].name; i++)
|
||||
{
|
||||
QUIT;
|
||||
if ((strncmp (pattern, name, plen) == 0) ||
|
||||
if ((strcmp (pattern, name) == 0) ||
|
||||
(strmatch (pattern, name, FNMATCH_EXTFLAG) != FNM_NOMATCH))
|
||||
{
|
||||
match_found++;
|
||||
|
||||
@@ -1028,6 +1028,8 @@
|
||||
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
/* Are we running the GNU C library, version 2.1 or later? */
|
||||
#undef GLIBC21
|
||||
|
||||
/* Define if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#! /bin/sh
|
||||
# From configure.in for Bash 4.2, version 4.040.
|
||||
# From configure.in for Bash 4.2, version 4.041.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.68 for bash 4.2-maint.
|
||||
#
|
||||
@@ -4856,10 +4856,12 @@ if test "$opt_profiling" = "yes"; then
|
||||
DEBUG= MALLOC_DEBUG=
|
||||
fi
|
||||
|
||||
prefer_shared=yes
|
||||
prefer_static=no
|
||||
|
||||
if test "$opt_static_link" = yes; then
|
||||
enable_static=yes
|
||||
enable_shared=no
|
||||
enable_rpath=no
|
||||
prefer_static=yes
|
||||
prefer_shared=no
|
||||
# if we're using gcc, add `-static' to LDFLAGS, except on Solaris >= 2
|
||||
if test -n "$GCC" || test "$ac_cv_c_compiler_gnu" = "yes"; then
|
||||
STATIC_LD="-static"
|
||||
@@ -7565,7 +7567,7 @@ fi
|
||||
found_so=
|
||||
found_a=
|
||||
if test $use_additional = yes; then
|
||||
if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
found_dir="$additional_libdir"
|
||||
found_so="$additional_libdir/lib$name.$shlibext"
|
||||
if test -f "$additional_libdir/lib$name.la"; then
|
||||
@@ -7595,7 +7597,7 @@ fi
|
||||
case "$x" in
|
||||
-L*)
|
||||
dir=`echo "X$x" | sed -e 's/^X-L//'`
|
||||
if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/lib$name.$shlibext"
|
||||
if test -f "$dir/lib$name.la"; then
|
||||
@@ -8355,7 +8357,7 @@ fi
|
||||
found_so=
|
||||
found_a=
|
||||
if test $use_additional = yes; then
|
||||
if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
found_dir="$additional_libdir"
|
||||
found_so="$additional_libdir/lib$name.$shlibext"
|
||||
if test -f "$additional_libdir/lib$name.la"; then
|
||||
@@ -8385,7 +8387,7 @@ fi
|
||||
case "$x" in
|
||||
-L*)
|
||||
dir=`echo "X$x" | sed -e 's/^X-L//'`
|
||||
if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/lib$name.$shlibext"
|
||||
if test -f "$dir/lib$name.la"; then
|
||||
|
||||
+6
-4
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AC_REVISION([for Bash 4.2, version 4.040])dnl
|
||||
AC_REVISION([for Bash 4.2, version 4.041])dnl
|
||||
|
||||
define(bashvers, 4.2)
|
||||
define(relstatus, maint)
|
||||
@@ -460,10 +460,12 @@ if test "$opt_profiling" = "yes"; then
|
||||
DEBUG= MALLOC_DEBUG=
|
||||
fi
|
||||
|
||||
prefer_shared=yes
|
||||
prefer_static=no
|
||||
|
||||
if test "$opt_static_link" = yes; then
|
||||
enable_static=yes
|
||||
enable_shared=no
|
||||
enable_rpath=no
|
||||
prefer_static=yes
|
||||
prefer_shared=no
|
||||
# if we're using gcc, add `-static' to LDFLAGS, except on Solaris >= 2
|
||||
if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
|
||||
STATIC_LD="-static"
|
||||
|
||||
+6
-3
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@po.cwru.edu
|
||||
.\"
|
||||
.\" Last Change: Mon Apr 11 16:56:54 EDT 2011
|
||||
.\" Last Change: Mon May 9 12:23:35 EDT 2011
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2011 April 11" "GNU Bash 4.2"
|
||||
.TH BASH 1 "2011 May 9" "GNU Bash 4.2"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -646,7 +646,10 @@ AND and OR lists is the exit status of the last command
|
||||
executed in the list.
|
||||
.SS Compound Commands
|
||||
.PP
|
||||
A \fIcompound command\fP is one of the following:
|
||||
A \fIcompound command\fP is one of the following.
|
||||
In most cases a \fIlist\fP in a command's description may be separated from
|
||||
the rest of the command by one or more newlines, and may be followed by a
|
||||
newline in place of a semicolon.
|
||||
.TP
|
||||
(\fIlist\fP)
|
||||
\fIlist\fP is executed in a subshell environment (see
|
||||
|
||||
@@ -753,6 +753,10 @@ terminated by a corresponding reserved word or operator.
|
||||
Any redirections (@pxref{Redirections}) associated with a compound command
|
||||
apply to all commands within that compound command unless explicitly overridden.
|
||||
|
||||
In most cases a list of commands in a compound command's description may be
|
||||
separated from the rest of the command by one or more newlines, and may be
|
||||
followed by a newline in place of a semicolon.
|
||||
|
||||
Bash provides looping constructs, conditional commands, and mechanisms
|
||||
to group commands and execute them as a unit.
|
||||
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2011 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Mon Apr 11 16:56:36 EDT 2011
|
||||
@set LASTCHANGE Mon May 9 12:23:18 EDT 2011
|
||||
|
||||
@set EDITION 4.2
|
||||
@set VERSION 4.2
|
||||
@set UPDATED 11 April 2011
|
||||
@set UPDATED-MONTH April 2011
|
||||
@set UPDATED 9 May 2011
|
||||
@set UPDATED-MONTH May 2011
|
||||
|
||||
+3
-3
@@ -901,10 +901,10 @@ internal_free (mem, file, line, flags)
|
||||
if (mg.i != p->mh_nbytes)
|
||||
xbotch (mem, ERR_ASSERT_FAILED, _("free: start and end chunk sizes differ"), file, line);
|
||||
|
||||
#if 1
|
||||
if (nunits >= LESSCORE_MIN && ((char *)p + binsize(nunits) == memtop))
|
||||
#if GLIBC21
|
||||
if (nunits >= LESSCORE_MIN && ((char *)p + binsize(nunits) == sbrk (0)))
|
||||
#else
|
||||
if (((char *)p + binsize(nunits) == memtop) && nunits >= LESSCORE_MIN)
|
||||
if (nunits >= LESSCORE_MIN && ((char *)p + binsize(nunits) == memtop))
|
||||
#endif
|
||||
{
|
||||
/* If above LESSCORE_FRC, give back unconditionally. This should be set
|
||||
|
||||
@@ -2721,6 +2721,13 @@ _rl_ttymsg ("_rl_col_width: called with MB_CUR_MAX == 1");
|
||||
{
|
||||
point += tmp;
|
||||
max -= tmp;
|
||||
#if defined (MACOSX)
|
||||
/* Mac OS X has a bug where wcwidth returns 1 for UTF-8 combining
|
||||
characters */
|
||||
if (wc >= 769 && wc <= 833)
|
||||
tmp = 0;
|
||||
else
|
||||
#endif
|
||||
tmp = wcwidth(wc);
|
||||
width += (tmp >= 0) ? tmp : 1;
|
||||
}
|
||||
|
||||
+28
-2
@@ -41,6 +41,10 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __MSDOS__
|
||||
# include <pc.h>
|
||||
#endif
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
#include "rlmbutil.h"
|
||||
@@ -2057,9 +2061,18 @@ _rl_move_vert (to)
|
||||
}
|
||||
else
|
||||
{ /* delta < 0 */
|
||||
#ifdef __DJGPP__
|
||||
int row, col;
|
||||
|
||||
fflush (rl_outstream);
|
||||
ScreenGetCursor (&row, &col);
|
||||
ScreenSetCursor (row + delta, col);
|
||||
i = -delta;
|
||||
#else
|
||||
if (_rl_term_up && *_rl_term_up)
|
||||
for (i = 0; i < -delta; i++)
|
||||
tputs (_rl_term_up, 1, _rl_output_character_function);
|
||||
#endif /* !__DJGPP__ */
|
||||
}
|
||||
|
||||
_rl_last_v_pos = to; /* Now TO is here */
|
||||
@@ -2342,10 +2355,13 @@ void
|
||||
_rl_clear_to_eol (count)
|
||||
int count;
|
||||
{
|
||||
#ifndef __MSDOS__
|
||||
if (_rl_term_clreol)
|
||||
tputs (_rl_term_clreol, 1, _rl_output_character_function);
|
||||
else if (count)
|
||||
space_to_eol (count);
|
||||
else
|
||||
#endif
|
||||
if (count)
|
||||
space_to_eol (count);
|
||||
}
|
||||
|
||||
/* Clear to the end of the line using spaces. COUNT is the minimum
|
||||
@@ -2365,10 +2381,15 @@ space_to_eol (count)
|
||||
void
|
||||
_rl_clear_screen ()
|
||||
{
|
||||
#ifndef __DJGPP__
|
||||
if (_rl_term_clrpag)
|
||||
tputs (_rl_term_clrpag, 1, _rl_output_character_function);
|
||||
else
|
||||
rl_crlf ();
|
||||
#else
|
||||
ScreenClear ();
|
||||
ScreenSetCursor (0, 0);
|
||||
#endif /* __DJGPP__ */
|
||||
}
|
||||
|
||||
/* Insert COUNT characters from STRING to the output stream at column COL. */
|
||||
@@ -2700,6 +2721,11 @@ _rl_ttymsg ("_rl_col_width: called with MB_CUR_MAX == 1");
|
||||
{
|
||||
point += tmp;
|
||||
max -= tmp;
|
||||
#if defined (MACOSX)
|
||||
if (wc >= 769 && wc <= 833)
|
||||
tmp = 0;
|
||||
else
|
||||
#endif
|
||||
tmp = wcwidth(wc);
|
||||
width += (tmp >= 0) ? tmp : 1;
|
||||
}
|
||||
|
||||
@@ -369,6 +369,11 @@ readline_internal_setup ()
|
||||
_rl_in_stream = rl_instream;
|
||||
_rl_out_stream = rl_outstream;
|
||||
|
||||
/* Enable the meta key only for the duration of readline(), if this
|
||||
terminal has one. */
|
||||
if (_rl_enable_meta)
|
||||
_rl_enable_meta_key ();
|
||||
|
||||
if (rl_startup_hook)
|
||||
(*rl_startup_hook) ();
|
||||
|
||||
@@ -437,6 +442,9 @@ readline_internal_teardown (eof)
|
||||
if (rl_undo_list)
|
||||
rl_free_undo_list ();
|
||||
|
||||
/* Disable the meta key, if this terminal has one. */
|
||||
_rl_disable_meta_key ();
|
||||
|
||||
/* Restore normal cursor, if available. */
|
||||
_rl_set_insert_mode (RL_IM_INSERT, 0);
|
||||
|
||||
@@ -1091,10 +1099,6 @@ readline_initialize_everything ()
|
||||
/* Try to bind a common arrow key prefix, if not already bound. */
|
||||
bind_arrow_keys ();
|
||||
|
||||
/* Enable the meta key, if this terminal has one. */
|
||||
if (_rl_enable_meta)
|
||||
_rl_enable_meta_key ();
|
||||
|
||||
/* If the completion parser's default word break characters haven't
|
||||
been set yet, then do so now. */
|
||||
if (rl_completer_word_break_characters == (char *)NULL)
|
||||
|
||||
@@ -3208,7 +3208,11 @@ parse_matched_pair (qc, open, close, lenp, flags)
|
||||
}
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
#if 0
|
||||
if MBTEST(ch == CTLESC || ch == CTLNUL)
|
||||
#else
|
||||
if MBTEST(ch == CTLESC)
|
||||
#endif
|
||||
ret[retind++] = CTLESC;
|
||||
ret[retind++] = ch;
|
||||
continue;
|
||||
@@ -3527,7 +3531,11 @@ eof_error:
|
||||
}
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
#if 0
|
||||
if MBTEST(ch == CTLESC || ch == CTLNUL)
|
||||
#else
|
||||
if MBTEST(ch == CTLESC)
|
||||
#endif
|
||||
ret[retind++] = CTLESC;
|
||||
ret[retind++] = ch;
|
||||
continue;
|
||||
|
||||
@@ -516,6 +516,11 @@ termsig_sighandler (sig)
|
||||
termsig_handler (sig);
|
||||
}
|
||||
|
||||
#if defined (READLINE)
|
||||
if (interactive_shell && interactive && no_line_editing == 0)
|
||||
bashline_set_event_hook ();
|
||||
#endif
|
||||
|
||||
SIGRETURN (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,682 @@
|
||||
/* sig.c - interface for shell signal handlers and signal initialization. */
|
||||
|
||||
/* Copyright (C) 1994-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 "config.h"
|
||||
|
||||
#include "bashtypes.h"
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# ifdef _MINIX
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "bashintl.h"
|
||||
|
||||
#include "shell.h"
|
||||
#if defined (JOB_CONTROL)
|
||||
#include "jobs.h"
|
||||
#endif /* JOB_CONTROL */
|
||||
#include "siglist.h"
|
||||
#include "sig.h"
|
||||
#include "trap.h"
|
||||
|
||||
#include "builtins/common.h"
|
||||
|
||||
#if defined (READLINE)
|
||||
# include "bashline.h"
|
||||
# include <readline/readline.h>
|
||||
#endif
|
||||
|
||||
#if defined (HISTORY)
|
||||
# include "bashhist.h"
|
||||
#endif
|
||||
|
||||
extern int last_command_exit_value;
|
||||
extern int last_command_exit_signal;
|
||||
extern int return_catch_flag;
|
||||
extern int loop_level, continuing, breaking, funcnest;
|
||||
extern int executing_list;
|
||||
extern int comsub_ignore_return;
|
||||
extern int parse_and_execute_level, shell_initialized;
|
||||
#if defined (HISTORY)
|
||||
extern int history_lines_this_session;
|
||||
#endif
|
||||
extern int no_line_editing;
|
||||
|
||||
extern void initialize_siglist ();
|
||||
|
||||
/* Non-zero after SIGINT. */
|
||||
volatile int interrupt_state = 0;
|
||||
|
||||
/* Non-zero after SIGWINCH */
|
||||
volatile int sigwinch_received = 0;
|
||||
|
||||
/* Set to the value of any terminating signal received. */
|
||||
volatile int terminating_signal = 0;
|
||||
|
||||
/* The environment at the top-level R-E loop. We use this in
|
||||
the case of error return. */
|
||||
procenv_t top_level;
|
||||
|
||||
#if defined (JOB_CONTROL) || defined (HAVE_POSIX_SIGNALS)
|
||||
/* The signal masks that this shell runs with. */
|
||||
sigset_t top_level_mask;
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
/* When non-zero, we throw_to_top_level (). */
|
||||
int interrupt_immediately = 0;
|
||||
|
||||
/* When non-zero, we call the terminating signal handler immediately. */
|
||||
int terminate_immediately = 0;
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
static SigHandler *old_winch = (SigHandler *)SIG_DFL;
|
||||
#endif
|
||||
|
||||
static void initialize_shell_signals __P((void));
|
||||
|
||||
void
|
||||
initialize_signals (reinit)
|
||||
int reinit;
|
||||
{
|
||||
initialize_shell_signals ();
|
||||
initialize_job_signals ();
|
||||
#if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_UNDER_SYS_SIGLIST) && !defined (HAVE_STRSIGNAL)
|
||||
if (reinit == 0)
|
||||
initialize_siglist ();
|
||||
#endif /* !HAVE_SYS_SIGLIST && !HAVE_UNDER_SYS_SIGLIST && !HAVE_STRSIGNAL */
|
||||
}
|
||||
|
||||
/* A structure describing a signal that terminates the shell if not
|
||||
caught. The orig_handler member is present so children can reset
|
||||
these signals back to their original handlers. */
|
||||
struct termsig {
|
||||
int signum;
|
||||
SigHandler *orig_handler;
|
||||
int orig_flags;
|
||||
};
|
||||
|
||||
#define NULL_HANDLER (SigHandler *)SIG_DFL
|
||||
|
||||
/* The list of signals that would terminate the shell if not caught.
|
||||
We catch them, but just so that we can write the history file,
|
||||
and so forth. */
|
||||
static struct termsig terminating_signals[] = {
|
||||
#ifdef SIGHUP
|
||||
{ SIGHUP, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGINT
|
||||
{ SIGINT, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGILL
|
||||
{ SIGILL, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGTRAP
|
||||
{ SIGTRAP, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGIOT
|
||||
{ SIGIOT, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGDANGER
|
||||
{ SIGDANGER, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGEMT
|
||||
{ SIGEMT, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGFPE
|
||||
{ SIGFPE, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGBUS
|
||||
{ SIGBUS, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGSEGV
|
||||
{ SIGSEGV, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGSYS
|
||||
{ SIGSYS, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGPIPE
|
||||
{ SIGPIPE, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGALRM
|
||||
{ SIGALRM, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGTERM
|
||||
{ SIGTERM, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGXCPU
|
||||
{ SIGXCPU, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGXFSZ
|
||||
{ SIGXFSZ, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGVTALRM
|
||||
{ SIGVTALRM, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#ifdef SIGPROF
|
||||
{ SIGPROF, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SIGLOST
|
||||
{ SIGLOST, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGUSR1
|
||||
{ SIGUSR1, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
|
||||
#ifdef SIGUSR2
|
||||
{ SIGUSR2, NULL_HANDLER, 0 },
|
||||
#endif
|
||||
};
|
||||
|
||||
#define TERMSIGS_LENGTH (sizeof (terminating_signals) / sizeof (struct termsig))
|
||||
|
||||
#define XSIG(x) (terminating_signals[x].signum)
|
||||
#define XHANDLER(x) (terminating_signals[x].orig_handler)
|
||||
#define XSAFLAGS(x) (terminating_signals[x].orig_flags)
|
||||
|
||||
static int termsigs_initialized = 0;
|
||||
|
||||
/* Initialize signals that will terminate the shell to do some
|
||||
unwind protection. For non-interactive shells, we only call
|
||||
this when a trap is defined for EXIT (0) or when trap is run
|
||||
to display signal dispositions. */
|
||||
void
|
||||
initialize_terminating_signals ()
|
||||
{
|
||||
register int i;
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
struct sigaction act, oact;
|
||||
#endif
|
||||
|
||||
if (termsigs_initialized)
|
||||
return;
|
||||
|
||||
/* The following code is to avoid an expensive call to
|
||||
set_signal_handler () for each terminating_signals. Fortunately,
|
||||
this is possible in Posix. Unfortunately, we have to call signal ()
|
||||
on non-Posix systems for each signal in terminating_signals. */
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
act.sa_handler = termsig_sighandler;
|
||||
act.sa_flags = 0;
|
||||
sigemptyset (&act.sa_mask);
|
||||
sigemptyset (&oact.sa_mask);
|
||||
for (i = 0; i < TERMSIGS_LENGTH; i++)
|
||||
sigaddset (&act.sa_mask, XSIG (i));
|
||||
for (i = 0; i < TERMSIGS_LENGTH; i++)
|
||||
{
|
||||
/* If we've already trapped it, don't do anything. */
|
||||
if (signal_is_trapped (XSIG (i)))
|
||||
continue;
|
||||
|
||||
sigaction (XSIG (i), &act, &oact);
|
||||
XHANDLER(i) = oact.sa_handler;
|
||||
XSAFLAGS(i) = oact.sa_flags;
|
||||
/* Don't do anything with signals that are ignored at shell entry
|
||||
if the shell is not interactive. */
|
||||
/* XXX - should we do this for interactive shells, too? */
|
||||
if (interactive_shell == 0 && XHANDLER (i) == SIG_IGN)
|
||||
{
|
||||
sigaction (XSIG (i), &oact, &act);
|
||||
set_signal_ignored (XSIG (i));
|
||||
}
|
||||
#if defined (SIGPROF) && !defined (_MINIX)
|
||||
if (XSIG (i) == SIGPROF && XHANDLER (i) != SIG_DFL && XHANDLER (i) != SIG_IGN)
|
||||
sigaction (XSIG (i), &oact, (struct sigaction *)NULL);
|
||||
#endif /* SIGPROF && !_MINIX */
|
||||
}
|
||||
|
||||
#else /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
for (i = 0; i < TERMSIGS_LENGTH; i++)
|
||||
{
|
||||
/* If we've already trapped it, don't do anything. */
|
||||
if (signal_is_trapped (XSIG (i)))
|
||||
continue;
|
||||
|
||||
XHANDLER(i) = signal (XSIG (i), termsig_sighandler);
|
||||
XSAFLAGS(i) = 0;
|
||||
/* Don't do anything with signals that are ignored at shell entry
|
||||
if the shell is not interactive. */
|
||||
/* XXX - should we do this for interactive shells, too? */
|
||||
if (interactive_shell == 0 && XHANDLER (i) == SIG_IGN)
|
||||
{
|
||||
signal (XSIG (i), SIG_IGN);
|
||||
set_signal_ignored (XSIG (i));
|
||||
}
|
||||
#ifdef SIGPROF
|
||||
if (XSIG (i) == SIGPROF && XHANDLER (i) != SIG_DFL && XHANDLER (i) != SIG_IGN)
|
||||
signal (XSIG (i), XHANDLER (i));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
termsigs_initialized = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
initialize_shell_signals ()
|
||||
{
|
||||
if (interactive)
|
||||
initialize_terminating_signals ();
|
||||
|
||||
#if defined (JOB_CONTROL) || defined (HAVE_POSIX_SIGNALS)
|
||||
/* All shells use the signal mask they inherit, and pass it along
|
||||
to child processes. Children will never block SIGCHLD, though. */
|
||||
sigemptyset (&top_level_mask);
|
||||
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &top_level_mask);
|
||||
# if defined (SIGCHLD)
|
||||
sigdelset (&top_level_mask, SIGCHLD);
|
||||
# endif
|
||||
#endif /* JOB_CONTROL || HAVE_POSIX_SIGNALS */
|
||||
|
||||
/* And, some signals that are specifically ignored by the shell. */
|
||||
set_signal_handler (SIGQUIT, SIG_IGN);
|
||||
|
||||
if (interactive)
|
||||
{
|
||||
set_signal_handler (SIGINT, sigint_sighandler);
|
||||
set_signal_handler (SIGTERM, SIG_IGN);
|
||||
set_sigwinch_handler ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
reset_terminating_signals ()
|
||||
{
|
||||
register int i;
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
struct sigaction act;
|
||||
#endif
|
||||
|
||||
if (termsigs_initialized == 0)
|
||||
return;
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
act.sa_flags = 0;
|
||||
sigemptyset (&act.sa_mask);
|
||||
for (i = 0; i < TERMSIGS_LENGTH; i++)
|
||||
{
|
||||
/* Skip a signal if it's trapped or handled specially, because the
|
||||
trap code will restore the correct value. */
|
||||
if (signal_is_trapped (XSIG (i)) || signal_is_special (XSIG (i)))
|
||||
continue;
|
||||
|
||||
act.sa_handler = XHANDLER (i);
|
||||
act.sa_flags = XSAFLAGS (i);
|
||||
sigaction (XSIG (i), &act, (struct sigaction *) NULL);
|
||||
}
|
||||
#else /* !HAVE_POSIX_SIGNALS */
|
||||
for (i = 0; i < TERMSIGS_LENGTH; i++)
|
||||
{
|
||||
if (signal_is_trapped (XSIG (i)) || signal_is_special (XSIG (i)))
|
||||
continue;
|
||||
|
||||
signal (XSIG (i), XHANDLER (i));
|
||||
}
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
}
|
||||
#undef XSIG
|
||||
#undef XHANDLER
|
||||
|
||||
/* Run some of the cleanups that should be performed when we run
|
||||
jump_to_top_level from a builtin command context. XXX - might want to
|
||||
also call reset_parser here. */
|
||||
void
|
||||
top_level_cleanup ()
|
||||
{
|
||||
/* Clean up string parser environment. */
|
||||
while (parse_and_execute_level)
|
||||
parse_and_execute_cleanup ();
|
||||
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
unlink_fifo_list ();
|
||||
#endif /* PROCESS_SUBSTITUTION */
|
||||
|
||||
run_unwind_protects ();
|
||||
loop_level = continuing = breaking = funcnest = 0;
|
||||
executing_list = comsub_ignore_return = return_catch_flag = 0;
|
||||
}
|
||||
|
||||
/* What to do when we've been interrupted, and it is safe to handle it. */
|
||||
void
|
||||
throw_to_top_level ()
|
||||
{
|
||||
int print_newline = 0;
|
||||
|
||||
if (interrupt_state)
|
||||
{
|
||||
print_newline = 1;
|
||||
DELINTERRUPT;
|
||||
}
|
||||
|
||||
if (interrupt_state)
|
||||
return;
|
||||
|
||||
last_command_exit_signal = (last_command_exit_value > 128) ?
|
||||
(last_command_exit_value - 128) : 0;
|
||||
last_command_exit_value |= 128;
|
||||
|
||||
/* Run any traps set on SIGINT. */
|
||||
run_interrupt_trap ();
|
||||
|
||||
/* Clean up string parser environment. */
|
||||
while (parse_and_execute_level)
|
||||
parse_and_execute_cleanup ();
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
give_terminal_to (shell_pgrp, 0);
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
#if defined (JOB_CONTROL) || defined (HAVE_POSIX_SIGNALS)
|
||||
/* This should not be necessary on systems using sigsetjmp/siglongjmp. */
|
||||
sigprocmask (SIG_SETMASK, &top_level_mask, (sigset_t *)NULL);
|
||||
#endif
|
||||
|
||||
reset_parser ();
|
||||
|
||||
#if defined (READLINE)
|
||||
if (interactive)
|
||||
bashline_reset ();
|
||||
#endif /* READLINE */
|
||||
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
unlink_fifo_list ();
|
||||
#endif /* PROCESS_SUBSTITUTION */
|
||||
|
||||
run_unwind_protects ();
|
||||
loop_level = continuing = breaking = funcnest = 0;
|
||||
executing_list = comsub_ignore_return = return_catch_flag = 0;
|
||||
|
||||
if (interactive && print_newline)
|
||||
{
|
||||
fflush (stdout);
|
||||
fprintf (stderr, "\n");
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
/* An interrupted `wait' command in a script does not exit the script. */
|
||||
if (interactive || (interactive_shell && !shell_initialized) ||
|
||||
(print_newline && signal_is_trapped (SIGINT)))
|
||||
jump_to_top_level (DISCARD);
|
||||
else
|
||||
jump_to_top_level (EXITPROG);
|
||||
}
|
||||
|
||||
/* This is just here to isolate the longjmp calls. */
|
||||
void
|
||||
jump_to_top_level (value)
|
||||
int value;
|
||||
{
|
||||
longjmp (top_level, value);
|
||||
}
|
||||
|
||||
sighandler
|
||||
termsig_sighandler (sig)
|
||||
int sig;
|
||||
{
|
||||
/* If we get called twice with the same signal before handling it,
|
||||
terminate right away. */
|
||||
if (
|
||||
#ifdef SIGHUP
|
||||
sig != SIGHUP &&
|
||||
#endif
|
||||
#ifdef SIGINT
|
||||
sig != SIGINT &&
|
||||
#endif
|
||||
#ifdef SIGDANGER
|
||||
sig != SIGDANGER &&
|
||||
#endif
|
||||
#ifdef SIGPIPE
|
||||
sig != SIGPIPE &&
|
||||
#endif
|
||||
#ifdef SIGALRM
|
||||
sig != SIGALRM &&
|
||||
#endif
|
||||
#ifdef SIGTERM
|
||||
sig != SIGTERM &&
|
||||
#endif
|
||||
#ifdef SIGXCPU
|
||||
sig != SIGXCPU &&
|
||||
#endif
|
||||
#ifdef SIGXFSZ
|
||||
sig != SIGXFSZ &&
|
||||
#endif
|
||||
#ifdef SIGVTALRM
|
||||
sig != SIGVTALRM &&
|
||||
#endif
|
||||
#ifdef SIGLOST
|
||||
sig != SIGLOST &&
|
||||
#endif
|
||||
#ifdef SIGUSR1
|
||||
sig != SIGUSR1 &&
|
||||
#endif
|
||||
#ifdef SIGUSR2
|
||||
sig != SIGUSR2 &&
|
||||
#endif
|
||||
sig == terminating_signal)
|
||||
terminate_immediately = 1;
|
||||
|
||||
terminating_signal = sig;
|
||||
|
||||
/* XXX - should this also trigger when interrupt_immediately is set? */
|
||||
if (terminate_immediately)
|
||||
{
|
||||
#if defined (HISTORY)
|
||||
/* XXX - will inhibit history file being written */
|
||||
# if defined (READLINE)
|
||||
if (interactive_shell == 0 || interactive == 0 || (sig != SIGHUP && sig != SIGTERM) || no_line_editing || (RL_ISSTATE (RL_STATE_READCMD) == 0))
|
||||
# endif
|
||||
history_lines_this_session = 0;
|
||||
#endif
|
||||
terminate_immediately = 0;
|
||||
termsig_handler (sig);
|
||||
}
|
||||
|
||||
SIGRETURN (0);
|
||||
}
|
||||
|
||||
void
|
||||
termsig_handler (sig)
|
||||
int sig;
|
||||
{
|
||||
static int handling_termsig = 0;
|
||||
|
||||
/* Simple semaphore to keep this function from being executed multiple
|
||||
times. Since we no longer are running as a signal handler, we don't
|
||||
block multiple occurrences of the terminating signals while running. */
|
||||
if (handling_termsig)
|
||||
return;
|
||||
handling_termsig = 1;
|
||||
terminating_signal = 0; /* keep macro from re-testing true. */
|
||||
|
||||
/* I don't believe this condition ever tests true. */
|
||||
if (sig == SIGINT && signal_is_trapped (SIGINT))
|
||||
run_interrupt_trap ();
|
||||
|
||||
#if defined (HISTORY)
|
||||
if (interactive_shell && sig != SIGABRT)
|
||||
maybe_save_shell_history ();
|
||||
#endif /* HISTORY */
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
if (sig == SIGHUP && (interactive || (subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB))))
|
||||
hangup_all_jobs ();
|
||||
end_job_control ();
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
unlink_fifo_list ();
|
||||
#endif /* PROCESS_SUBSTITUTION */
|
||||
|
||||
/* Reset execution context */
|
||||
loop_level = continuing = breaking = funcnest = 0;
|
||||
executing_list = comsub_ignore_return = return_catch_flag = 0;
|
||||
|
||||
run_exit_trap ();
|
||||
set_signal_handler (sig, SIG_DFL);
|
||||
kill (getpid (), sig);
|
||||
}
|
||||
|
||||
/* What we really do when SIGINT occurs. */
|
||||
sighandler
|
||||
sigint_sighandler (sig)
|
||||
int sig;
|
||||
{
|
||||
#if defined (MUST_REINSTALL_SIGHANDLERS)
|
||||
signal (sig, sigint_sighandler);
|
||||
#endif
|
||||
|
||||
/* interrupt_state needs to be set for the stack of interrupts to work
|
||||
right. Should it be set unconditionally? */
|
||||
if (interrupt_state == 0)
|
||||
ADDINTERRUPT;
|
||||
|
||||
if (interrupt_immediately)
|
||||
{
|
||||
interrupt_immediately = 0;
|
||||
last_command_exit_value = 128 + sig;
|
||||
throw_to_top_level ();
|
||||
}
|
||||
|
||||
SIGRETURN (0);
|
||||
}
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
sighandler
|
||||
sigwinch_sighandler (sig)
|
||||
int sig;
|
||||
{
|
||||
#if defined (MUST_REINSTALL_SIGHANDLERS)
|
||||
set_signal_handler (SIGWINCH, sigwinch_sighandler);
|
||||
#endif /* MUST_REINSTALL_SIGHANDLERS */
|
||||
sigwinch_received = 1;
|
||||
SIGRETURN (0);
|
||||
}
|
||||
#endif /* SIGWINCH */
|
||||
|
||||
void
|
||||
set_sigwinch_handler ()
|
||||
{
|
||||
#if defined (SIGWINCH)
|
||||
old_winch = set_signal_handler (SIGWINCH, sigwinch_sighandler);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
unset_sigwinch_handler ()
|
||||
{
|
||||
#if defined (SIGWINCH)
|
||||
set_signal_handler (SIGWINCH, old_winch);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Signal functions used by the rest of the code. */
|
||||
#if !defined (HAVE_POSIX_SIGNALS)
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
/* Perform OPERATION on NEWSET, perhaps leaving information in OLDSET. */
|
||||
sigprocmask (operation, newset, oldset)
|
||||
int operation, *newset, *oldset;
|
||||
{
|
||||
int old, new;
|
||||
|
||||
if (newset)
|
||||
new = *newset;
|
||||
else
|
||||
new = 0;
|
||||
|
||||
switch (operation)
|
||||
{
|
||||
case SIG_BLOCK:
|
||||
old = sigblock (new);
|
||||
break;
|
||||
|
||||
case SIG_SETMASK:
|
||||
old = sigsetmask (new);
|
||||
break;
|
||||
|
||||
default:
|
||||
internal_error (_("sigprocmask: %d: invalid operation"), operation);
|
||||
}
|
||||
|
||||
if (oldset)
|
||||
*oldset = old;
|
||||
}
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
#else
|
||||
|
||||
#if !defined (SA_INTERRUPT)
|
||||
# define SA_INTERRUPT 0
|
||||
#endif
|
||||
|
||||
#if !defined (SA_RESTART)
|
||||
# define SA_RESTART 0
|
||||
#endif
|
||||
|
||||
SigHandler *
|
||||
set_signal_handler (sig, handler)
|
||||
int sig;
|
||||
SigHandler *handler;
|
||||
{
|
||||
struct sigaction act, oact;
|
||||
|
||||
act.sa_handler = handler;
|
||||
act.sa_flags = 0;
|
||||
|
||||
/* XXX - bash-4.2 */
|
||||
/* We don't want a child death to interrupt interruptible system calls, even
|
||||
if we take the time to reap children */
|
||||
if (sig == SIGCHLD)
|
||||
act.sa_flags |= SA_RESTART; /* XXX */
|
||||
|
||||
sigemptyset (&act.sa_mask);
|
||||
sigemptyset (&oact.sa_mask);
|
||||
sigaction (sig, &act, &oact);
|
||||
return (oact.sa_handler);
|
||||
}
|
||||
#endif /* HAVE_POSIX_SIGNALS */
|
||||
@@ -1170,7 +1170,7 @@ extract_process_subst (string, starter, sindex)
|
||||
char *starter;
|
||||
int *sindex;
|
||||
{
|
||||
return (extract_delimited_string (string, sindex, starter, "(", ")", 0));
|
||||
return (extract_delimited_string (string, sindex, starter, "(", ")", SX_COMMAND));
|
||||
}
|
||||
#endif /* PROCESS_SUBSTITUTION */
|
||||
|
||||
@@ -3709,7 +3709,10 @@ remove_quoted_nulls (string)
|
||||
break;
|
||||
}
|
||||
else if (string[i] == CTLNUL)
|
||||
i++;
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
prev_i = i;
|
||||
ADVANCE_CHAR (string, slen, i);
|
||||
@@ -8359,7 +8362,10 @@ add_twochars:
|
||||
temp = (char *)NULL;
|
||||
|
||||
/* We do not want to add quoted nulls to strings that are only
|
||||
partially quoted; we can throw them away. */
|
||||
partially quoted; we can throw them away. The execption to
|
||||
this is when we are going to be performing word splitting,
|
||||
since we have to preserve a null argument if the next character
|
||||
will cause word splitting. */
|
||||
if (temp == 0 && quoted_state == PARTIALLY_QUOTED && (word->flags & (W_NOSPLIT|W_NOSPLIT2)))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -40,3 +40,10 @@ v="one two buckle my shoe"
|
||||
[[ ${v} =~ (one two) ]] && echo matches 8
|
||||
|
||||
[[ ${v} =~ one\ two ]] && echo matches 9
|
||||
|
||||
# problems in pre-patched bash-4.2
|
||||
[[ "helloworld" =~ llo ]] && echo match control-a 1
|
||||
[[ "helloworld" =~ world ]] && echo match control-a 2
|
||||
[[ "helloworld" =~ world$ ]] && echo match control-a 3
|
||||
[[ "helloworld" =~ ]] && echo match control-a 4
|
||||
[[ "helloworld" =~ oworld$ ]] && echo match control-a 5
|
||||
|
||||
@@ -59,3 +59,8 @@ rematch 1
|
||||
matches 7
|
||||
matches 8
|
||||
matches 9
|
||||
match control-a 1
|
||||
match control-a 2
|
||||
match control-a 3
|
||||
match control-a 4
|
||||
match control-a 5
|
||||
|
||||
+21
-10
@@ -1,9 +1,9 @@
|
||||
argv[1] = <^A>
|
||||
argv[1] = <^A>
|
||||
argv[1] = <^B>
|
||||
argv[1] = <^B>
|
||||
argv[1] = <^?>
|
||||
argv[1] = <^?>
|
||||
argv[1] = <^A>
|
||||
argv[1] = <^B>
|
||||
argv[1] = <^?>
|
||||
argv[1] = <abcdefgh>
|
||||
argv[1] = <abcdefgh>
|
||||
argv[1] = <abcdefgh>
|
||||
@@ -25,11 +25,11 @@ argv[1] = <abc>
|
||||
argv[1] = <abcdef>
|
||||
argv[1] = <abcdef>
|
||||
argv[1] = <^A>
|
||||
argv[1] = <^B>
|
||||
argv[1] = <^?>
|
||||
argv[1] = <^A>
|
||||
argv[1] = <^B>
|
||||
argv[1] = <^?>
|
||||
argv[1] = <^A>
|
||||
argv[1] = <^B>
|
||||
argv[1] = <^?>
|
||||
argv[1] = <>
|
||||
argv[1] = <>
|
||||
argv[1] = <>
|
||||
@@ -42,13 +42,13 @@ argv[1] = <\\>
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
argv[1] = <^A>
|
||||
argv[2] = <^B>
|
||||
argv[2] = <^?>
|
||||
argv[1] = <**>
|
||||
argv[1] = <\.\./*/>
|
||||
argv[1] = <^A^B^A^B>
|
||||
argv[1] = <^A^?^A^?>
|
||||
argv[1] = <^A^A>
|
||||
argv[1] = <^A^B>
|
||||
argv[1] = <^A^A^B>
|
||||
argv[1] = <^A^?>
|
||||
argv[1] = <^A^A^?>
|
||||
argv[1] = < abc>
|
||||
argv[2] = <def>
|
||||
argv[3] = <ghi>
|
||||
@@ -178,3 +178,14 @@ hello
|
||||
|
||||
hello
|
||||
eo
|
||||
argv[1] = <a>
|
||||
argv[1] = <a>
|
||||
argv[1] = <^?>
|
||||
argv[1] = <^?b>
|
||||
argv[1] = <b^?>
|
||||
argv[1] = <c>
|
||||
argv[1] = <c>
|
||||
argv[1] = <c>
|
||||
argv[1] = <c>
|
||||
argv[1] = <c>
|
||||
argv[1] = <c>
|
||||
|
||||
+23
-21
@@ -22,14 +22,14 @@ expect "<^A>"
|
||||
recho `echo ''`
|
||||
expect "<^A>"
|
||||
recho `echo ""`
|
||||
expect "<^B>"
|
||||
recho `echo ''`
|
||||
expect "<^B>"
|
||||
recho `echo ""`
|
||||
expect "<^?>"
|
||||
recho `echo ''`
|
||||
expect "<^?>"
|
||||
recho `echo ""`
|
||||
expect "<^A>"
|
||||
recho `echo `
|
||||
expect "<^B>"
|
||||
recho `echo `
|
||||
expect "<^?>"
|
||||
recho `echo `
|
||||
|
||||
# Test null strings without variable expansion
|
||||
expect "<abcdefgh>"
|
||||
@@ -89,16 +89,16 @@ unset xxx yyy
|
||||
# Test the unquoted special quoting characters
|
||||
expect "<^A>"
|
||||
recho
|
||||
expect "<^B>"
|
||||
recho
|
||||
expect "<^?>"
|
||||
recho
|
||||
expect "<^A>"
|
||||
recho ""
|
||||
expect "<^B>"
|
||||
recho ""
|
||||
expect "<^?>"
|
||||
recho ""
|
||||
expect "<^A>"
|
||||
recho ''
|
||||
expect "<^B>"
|
||||
recho ''
|
||||
expect "<^?>"
|
||||
recho ''
|
||||
|
||||
# Test expansion of a variable that is unset
|
||||
expect nothing
|
||||
@@ -139,9 +139,9 @@ expect '<a> <b>'
|
||||
FOO=`echo 'a b' | tr ' ' '\012'`
|
||||
recho $FOO
|
||||
|
||||
# This should give argv[1] = ^A argv[2] = ^B
|
||||
expect '<^A> <^B>'
|
||||
FOO=`echo ' ' | tr ' ' '\012'`
|
||||
# This should give argv[1] = ^A argv[2] = ^?
|
||||
expect '<^A> <^?>'
|
||||
FOO=`echo ' ' | tr ' ' '\012'`
|
||||
recho $FOO
|
||||
|
||||
# Test quoted and unquoted globbing characters
|
||||
@@ -153,14 +153,14 @@ recho "\.\./*/"
|
||||
|
||||
# Test patterns that come up when the shell quotes funny character
|
||||
# combinations
|
||||
expect '<^A^B^A^B>'
|
||||
recho ''
|
||||
expect '<^A^?^A^?>'
|
||||
recho ''
|
||||
expect '<^A^A>'
|
||||
recho ''
|
||||
expect '<^A^B>'
|
||||
recho ''
|
||||
expect '<^A^A^B>'
|
||||
recho ''
|
||||
expect '<^A^?>'
|
||||
recho ''
|
||||
expect '<^A^A^?>'
|
||||
recho ''
|
||||
|
||||
# More tests of "$@"
|
||||
set abc def ghi jkl
|
||||
@@ -388,3 +388,5 @@ ${THIS_SH} ./exp3.sub
|
||||
${THIS_SH} ./exp4.sub
|
||||
|
||||
${THIS_SH} ./exp5.sub
|
||||
|
||||
${THIS_SH} ./exp6.sub
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
recho """"a
|
||||
recho a""""
|
||||
|
||||
recho """"
|
||||
|
||||
recho """"b
|
||||
recho b""""
|
||||
|
||||
recho """"""c
|
||||
recho c""""""
|
||||
|
||||
recho """"""c""""
|
||||
recho """"c""""""
|
||||
|
||||
recho """"""""c
|
||||
recho c""""""""
|
||||
Reference in New Issue
Block a user