summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CWRU/CWRU.chlog115
-rw-r--r--MANIFEST1
-rw-r--r--builtins/history.def2
-rwxr-xr-xconfigure4
-rw-r--r--doc/bash.14
-rw-r--r--doc/bashref.texi4
-rw-r--r--jobs.c17
-rw-r--r--lib/readline/util.c4
-rw-r--r--make_cmd.c8
-rw-r--r--nojobs.c15
-rw-r--r--subst.c4
-rwxr-xr-xtests/RUN-ONE-TEST2
-rw-r--r--tests/histexp.right5
-rw-r--r--tests/histexp.tests1
-rw-r--r--tests/histexp2.sub11
15 files changed, 148 insertions, 49 deletions
diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog
index 85c0231d..1ca1ead8 100644
--- a/CWRU/CWRU.chlog
+++ b/CWRU/CWRU.chlog
@@ -6554,7 +6554,7 @@ jobs.c
to 1 if terminal pgrp != shell pgrp
- {stop_pipeline,make_child,wait_for}: if we are running in the
background, don't mess with the terminal's process group; assume that
- the parent shell will do that. Fixes bug reprted by Greg Wooledge
+ the parent shell will do that. Fixes bug reported by Greg Wooledge
<wooledg@eeg.ccf.org>
shell.c
@@ -6880,9 +6880,10 @@ builtins/evalstring.c
10/2
----
jobs.c
- - bgp_prune: don't do anything if bgpids.npid == 0 or bgpids.list == NULL.
- This can happen if something gets run before the job control framework
- is initialized. Bug report from <mancha1@zoho.com>
+ - bgp_prune: don't do anything if bgpids.npid == 0 or
+ bgpids.list == NULL. This can happen if something gets run before
+ the job control framework is initialized. Bug report from
+ <mancha1@zoho.com>
10/3
----
@@ -9224,14 +9225,15 @@ general.h
enable for load and unload hook functions
builtins/enable.def
- - dyn_load_builtin: attempt to execute a function named BUILTIN_builtin_load,
- where BUILTIN is the name of the command being loaded. If that
- function returns 0, the load fails
- - dyn_unload_builtin: attempt to execute a function named BUILTIN_builtin_unload,
- where BUILTIN is the name of the command being unloaded. It offers a
- dynamic builtin a way to clean up after itself. Inspired by
- suggestion from Piotr Grzybowski <narsil.pl@gmail.com> in response
- to a bug report from isabella parakiss <izaberina@gmail.com>
+ - dyn_load_builtin: attempt to execute a function named
+ BUILTIN_builtin_load, where BUILTIN is the name of the command being
+ loaded. If that function returns 0, the load fails
+ - dyn_unload_builtin: attempt to execute a function named
+ BUILTIN_builtin_unload, where BUILTIN is the name of the command
+ being unloaded. It offers a dynamic builtin a way to clean up after
+ itself. Inspired by suggestion from Piotr Grzybowski
+ <narsil.pl@gmail.com> in response to a bug report from isabella
+ parakiss <izaberina@gmail.com>
8/6
---
@@ -9319,8 +9321,8 @@ execute_cmd.c
8/10
----
config-top.h
- - OPENLOG_OPTS: if SYSLOG_HISTORY is defined, define to LOG_PID, so each
- message is tagged with the pid
+ - OPENLOG_OPTS: if SYSLOG_HISTORY is defined, define to LOG_PID, so
+ each message is tagged with the pid
bashhist.h
- bash_syslog_history: the first time it's called, call openlog with
@@ -9591,8 +9593,8 @@ variables.c
9/17
----
subst.c
- - do_compound_assignment: make sure to dispose of word list generated by
- expand_compound_array_assignment; fixes memory leak reported in
+ - do_compound_assignment: make sure to dispose of word list generated
+ by expand_compound_array_assignment; fixes memory leak reported in
https://bugzilla.redhat.com/show_bug.cgi?id=1264101
variables.c
@@ -9616,10 +9618,10 @@ array.c
generate the value instead of using sh_double_quote unconditionally
assoc.c
- - assoc_to_assign: if either the key or the value of an associative array
- element contains non-printable characters (ansic_shouldquote returns
- true), use ansic_quote to quote them instead of using double quotes
- unconditionally
+ - assoc_to_assign: if either the key or the value of an associative
+ array element contains non-printable characters (ansic_shouldquote
+ returns true), use ansic_quote to quote them instead of using double
+ quotes unconditionally
9/19
----
@@ -9666,10 +9668,10 @@ lib/readline/rlconf.h
9/24
----
jobs.c
- - waitchld: if we get a SIGINT while waiting for a child to exit, but the
- kernel doesn't interrupt the waitpid(2) call, assume the child caught
- SIGINT if it exited for some reason other than SIGINT. Fix suggested
- by Stephane Chazelas <stephane.chazelas@gmail.com>
+ - waitchld: if we get a SIGINT while waiting for a child to exit, but
+ the kernel doesn't interrupt the waitpid(2) call, assume the child
+ caught SIGINT if it exited for some reason other than SIGINT. Fix
+ suggested by Stephane Chazelas <stephane.chazelas@gmail.com>
input.c
- make_buffered_stream: use B_TEXT in buffered stream flags instead
@@ -9690,8 +9692,8 @@ execute_cmd.c
10/1
----
builtins/kill.def
- - kill_builtin: make -L equivalent to -l for compatibility with other (Linux)
- versions of kill
+ - kill_builtin: make -L equivalent to -l for compatibility with other
+ (Linux) versions of kill
doc/{bash.1,bashref.texi}
- kill: document new `-L' option
@@ -9792,9 +9794,10 @@ doc/{bash.1,bashref.texi}
<446240525@qq.com>
lib/readline/histfile.c
- - history_do_write: make sure that we only create and use the tempfile if
- the history file exists and is a regular file. Reported several times,
- most recent check the result of a report from <marko.teiste@gmail.com>
+ - history_do_write: make sure that we only create and use the tempfile
+ if the history file exists and is a regular file. Reported several
+ times, most recent check the result of a report from
+ <marko.teiste@gmail.com>
10/22
-----
@@ -9878,11 +9881,12 @@ doc/{bash.1,bashref.texi}
10/30
-----
eval.c
- - reader_loop: if PS0 is set in an interactive shell, expand and display it
- after reading a (complete) command but before executing it. This differs
- from the DEBUG trap because the DEBUG trap is executed once for each
- simple command (and some others, like each time through a for loop). From
- a patch submitted by Dan Stromberg <dstromberglists@gmail.com>
+ - reader_loop: if PS0 is set in an interactive shell, expand and
+ display it after reading a (complete) command but before executing
+ it. This differs from the DEBUG trap because the DEBUG trap is
+ executed once for each simple command (and some others, like each
+ time through a for loop). From a patch submitted by Dan Stromberg
+ <dstromberglists@gmail.com>
parse.y
- prompt_again: set ps0_prompt from $PS0 in an interactive shell
@@ -9902,3 +9906,46 @@ subst.c
doc/{bash.1,builtins.texi}
- inherit_errexit: add to shopt description; modify Posix mode
description
+
+ 11/9
+ ----
+lib/readline/util.c
+ - rl_tilde_expand: fix out-of-bounds read caused when this function
+ is invoked with rl_point == 0. Bug reported by Hanno Böck
+ <hanno@hboeck.de>
+
+ 11/11
+ -----
+{nojobs,jobs}.c
+ - get_original_tty_job_signals: force the original signal disposition
+ for SIGTSTP/SIGTTIN/SIGTTOU to SIG_DFL in interactive shells. This
+ will force child processes to get SIG_DFL even if the shell is
+ started with those signals ignored. From a bug report from
+ Keith Thompson <keithsthompson@gmail.com>
+
+ 11/13
+ -----
+make_cmd.c
+ - make_function_def: if a function is being defined without a source
+ file, and the shell has not been initialized, assume that the
+ function is being imported from the environment and set the
+ source_file struct member to "environment". Set to "main" if the
+ shell has been initialized. Fixes bug reported on savannah by
+ Arno-Can Uestuensoez
+ https://savannah.gnu.org/support/index.php?108903
+
+subst.c
+ - skip_to_delim: if the shell is in posix mode (posixly_correct != 0)
+ and performing history expansion ((flags & SD_HISTEXP) != 0), allow
+ double quotes to quote the history expansion character. TENTATIVE
+ CHANGE, inspired by
+ https://savannah.gnu.org/support/index.php?108491
+ NEEDS DOCUMENTATION
+
+ 11/14
+ -----
+jobs.c
+ - wait_for: modify change from 4/23 to only give the terminal to
+ shell_pgrp if not running in the background and subshell_environment
+ indicates we're not in a pipeline and not an async command. Fixes
+ bug reported by konsolebox <konsolebox@gmail.com>
diff --git a/MANIFEST b/MANIFEST
index 29362c47..0a173e88 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1015,6 +1015,7 @@ tests/herestr.right f
tests/herestr1.sub f
tests/histexp.tests f
tests/histexp1.sub f
+tests/histexp2.sub f
tests/histexp.right f
tests/history.tests f
tests/history.right f
diff --git a/builtins/history.def b/builtins/history.def
index 0e33ede1..dfa4fb72 100644
--- a/builtins/history.def
+++ b/builtins/history.def
@@ -35,10 +35,10 @@ Options:
-a append history lines from this session to the history file
-n read all history lines not already read from the history file
+ and append them to the history list
-r read the history file and append the contents to the history
list
-w write the current history to the history file
- and append them to the history list
-p perform history expansion on each ARG and display the result
without storing it in the history list
diff --git a/configure b/configure
index 97890fc9..3bd5c9b5 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac for Bash 4.4, version 4.074.
+# From configure.ac for Bash 4.4, version 4.075.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 4.4-beta.
#
@@ -16062,6 +16062,8 @@ case "${host_os}-${CC}" in
aix4.2*-*gcc*) LOCAL_LDFLAGS="-Xlinker -bexpall -Xlinker -brtl" ;;
aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl" ;;
bsdi4*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
+bsdi5*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
+hpux11*-gcc*) LOCAL_LDFLAGS="-Wl,-E" ;; # allow dynamic loading
esac
case "${host_os}" in
diff --git a/doc/bash.1 b/doc/bash.1
index 4452fe34..96f4f739 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -3925,10 +3925,10 @@ The \fIword\fP undergoes
brace expansion, tilde expansion, parameter and variable expansion,
command substitution, arithmetic expansion, and quote removal.
Pathname expansion and word splitting are not performed.
-The result is supplied as a single string to the command on its
+The result is supplied as a single string, with a newline appended,
+to the command on its
standard input (or file descriptor \fIn\fP if \fIn\fP is specified).
.SS "Duplicating File Descriptors"
-
.PP
The redirection operator
.RS
diff --git a/doc/bashref.texi b/doc/bashref.texi
index ee8dba1e..efea432f 100644
--- a/doc/bashref.texi
+++ b/doc/bashref.texi
@@ -2745,7 +2745,9 @@ The @var{word} undergoes
brace expansion, tilde expansion, parameter and variable expansion,
command substitution, arithmetic expansion, and quote removal.
Pathname expansion and word splitting are not performed.
-The result is supplied as a single string to the command on its
+The result is supplied as a single string,
+with a newline appended,
+to the command on its
standard input (or file descriptor @var{n} if @var{n} is specified).
@subsection Duplicating File Descriptors
diff --git a/jobs.c b/jobs.c
index 8d9d8a43..fee1130f 100644
--- a/jobs.c
+++ b/jobs.c
@@ -2125,9 +2125,18 @@ get_original_tty_job_signals ()
if (fetched == 0)
{
- get_original_signal (SIGTSTP);
- get_original_signal (SIGTTIN);
- get_original_signal (SIGTTOU);
+ if (interactive_shell)
+ {
+ set_original_signal (SIGTSTP, SIG_DFL);
+ set_original_signal (SIGTTIN, SIG_DFL);
+ set_original_signal (SIGTTOU, SIG_DFL);
+ }
+ else
+ {
+ get_original_signal (SIGTSTP);
+ get_original_signal (SIGTTIN);
+ get_original_signal (SIGTTOU);
+ }
fetched = 1;
}
}
@@ -2779,7 +2788,7 @@ if (job == NO_JOB)
itrace("wait_for: job == NO_JOB, giving the terminal to shell_pgrp (%ld)", (long)shell_pgrp);
#endif
/* Don't modify terminal pgrp if we are running in background or a subshell */
- if (running_in_background == 0 && subshell_environment == 0)
+ if (running_in_background == 0 && (subshell_environment&(SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0)
give_terminal_to (shell_pgrp, 0);
}
diff --git a/lib/readline/util.c b/lib/readline/util.c
index 4840494b..aec4af5f 100644
--- a/lib/readline/util.c
+++ b/lib/readline/util.c
@@ -198,12 +198,14 @@ rl_tilde_expand (ignore, key)
xfree (homedir);
return (0);
}
- else if (rl_line_buffer[start] != '~')
+ else if (start >= 0 && rl_line_buffer[start] != '~')
{
for (; !whitespace (rl_line_buffer[start]) && start >= 0; start--)
;
start++;
}
+ else if (start < 0)
+ start = 0;
end = start;
do
diff --git a/make_cmd.c b/make_cmd.c
index 73f3c0e6..170abcaf 100644
--- a/make_cmd.c
+++ b/make_cmd.c
@@ -56,6 +56,7 @@
extern int line_number, current_command_line_count, parser_state;
extern int last_command_exit_value;
+extern int shell_initialized;
/* Object caching */
sh_obj_cache_t wdcache = {0, 0, 0};
@@ -793,11 +794,18 @@ make_function_def (name, command, lineno, lstart)
if (bash_source_a && array_num_elements (bash_source_a) > 0)
temp->source_file = array_reference (bash_source_a, 0);
#endif
+ /* Assume that shell functions without a source file before the shell is
+ initialized come from the environment. Otherwise default to "main"
+ (usually functions being defined interactively) */
+ if (temp->source_file == 0)
+ temp->source_file = shell_initialized ? "main" : "environment";
+
#if defined (DEBUGGER)
bind_function_def (name->word, temp);
#endif
temp->source_file = temp->source_file ? savestring (temp->source_file) : 0;
+
return (make_command (cm_function_def, (SIMPLE_COM *)temp));
}
diff --git a/nojobs.c b/nojobs.c
index d8b85bfe..b91d94e0 100644
--- a/nojobs.c
+++ b/nojobs.c
@@ -614,9 +614,18 @@ get_original_tty_job_signals ()
if (fetched == 0)
{
#if defined (SIGTSTP)
- get_original_signal (SIGTSTP);
- get_original_signal (SIGTTIN);
- get_original_signal (SIGTTOU);
+ if (interactive_shell)
+ {
+ set_original_signal (SIGTSTP, SIG_DFL);
+ set_original_signal (SIGTTIN, SIG_DFL);
+ set_original_signal (SIGTTOU, SIG_DFL);
+ }
+ else
+ {
+ get_original_signal (SIGTSTP);
+ get_original_signal (SIGTTIN);
+ get_original_signal (SIGTTOU);
+ }
#endif
fetched = 1;
}
diff --git a/subst.c b/subst.c
index 6c81f845..5517fa61 100644
--- a/subst.c
+++ b/subst.c
@@ -1847,7 +1847,9 @@ skip_to_delim (string, start, delims, flags)
i = skip_single_quoted (string, slen, ++i, SX_COMPLETE);
else if (c == '\'')
i = skip_single_quoted (string, slen, ++i, 0);
- else if (histexp && c == '"')
+ /* The posixly_correct test makes posix-mode shells allow double quotes
+ to quote the history expansio character */
+ else if (histexp && posixly_correct == 0 && c == '"')
{
dquote = 1 - dquote;
i++;
diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST
index d29259a9..a5ab273d 100755
--- a/tests/RUN-ONE-TEST
+++ b/tests/RUN-ONE-TEST
@@ -1,4 +1,4 @@
-BUILD_DIR=/usr/local/build/chet/bash/bash-current
+BUILD_DIR=/usr/local/build/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
diff --git a/tests/histexp.right b/tests/histexp.right
index 425a8eae..1dc1ab4c 100644
--- a/tests/histexp.right
+++ b/tests/histexp.right
@@ -143,3 +143,8 @@ echo a b c d 2 > /dev/null
\!
\!
\!
+a
+b
+c
+echo "#!/bin/bash" set -o posix
+#!/bin/bash set -o posix
diff --git a/tests/histexp.tests b/tests/histexp.tests
index f166967c..681f1310 100644
--- a/tests/histexp.tests
+++ b/tests/histexp.tests
@@ -129,3 +129,4 @@ echo !shopt-1
echo !shopt*
${THIS_SH} ./histexp1.sub
+${THIS_SH} ./histexp2.sub
diff --git a/tests/histexp2.sub b/tests/histexp2.sub
new file mode 100644
index 00000000..bd63d52a
--- /dev/null
+++ b/tests/histexp2.sub
@@ -0,0 +1,11 @@
+LANG=C LC_ALL=C
+
+set -o history
+echo a
+echo b
+echo c
+
+set -o histexpand
+set -o posix
+
+echo "#!/bin/bash" !!