commit bash-20180914 snapshot

This commit is contained in:
Chet Ramey
2018-09-17 11:46:57 -04:00
parent b52e30b8dd
commit 9282e182d8
19 changed files with 131 additions and 25 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ 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 is exactly the screenwidth.
accept-line when the line length is exactly the screenwidth.
3. New Features in Bash
+1 -1
View File
@@ -79,7 +79,7 @@ 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 is exactly the screenwidth.
accept-line when the line length is exactly the screenwidth.
3. New Features in Bash
+46
View File
@@ -4303,3 +4303,49 @@ configure.ac
- openbsd needs DEV_FD_STAT_BROKEN defined
[bash-5.0-beta frozen]
9/11
----
builtins/exec.def
- exec_builtin: make sure to sync the buffered stream where bash is
reading input (especially if it's fd 0) so a command exec'd by the
script can read the rest of stdin after the exec
9/15
----
lib/readline/histexpand.c
- history_tokenize_internal: if the event contains embedded newlines
(e.g., bash with command-oriented history and lithist), use them as
word delimiters, equivalent to space and tab, so they don't end up
as separate words. Fixes issue pointed out by Viktor Dukhovni
<ietf-dane@dukhovni.org>
- history_tokenize_word: don't break if we get a newline (though we
shouldn't get one due to the loop in history_tokenize_internal
- history_expand_internal: use newline as a whitespace character when
expanding by words, as we do with history_tokenize_internal
jobs.h
- J_PIPEFAIL: new flag for `flags' element of job struct
jobs.c
- stop_pipeline: if pipefail_opt set, newjob gets J_PIPEFAIL in its
flags word
- raw_job_exit_status: use J_PIPEFAIL (setting of pipefail when job
created) instead of current setting of pipefail status to determine
how to compute exit status of pipeline. Tentative implementation of
Posix proposal
expr.c
- exp0: don't call expr_bind_variable with a NULL string. Fixes
fuzzing bug reported by Eduardo Bustamante <dualbus@gmail.com>
- expr_bind_variable: don't try to do anything with a NULL or empty
LHS
9/16
----
lib/readline/undo.c
- rl_do_undo: before we release the undo list entry we've just
processed, make sure we avoid any pointer aliasing issues caused
by having the entry being removed as part of the undo list in
_rl_saved_line_for_history. Fixes fuzzing bug reported by
Eduardo Bustamante <dualbus@gmail.com>
+6
View File
@@ -68,6 +68,7 @@ $END
#endif
#include "common.h"
#include "bashgetopt.h"
#include "input.h"
/* Not all systems declare ERRNO in errno.h... and some systems #define it! */
#if !defined (errno)
@@ -221,6 +222,11 @@ exec_builtin (list)
default_tty_job_signals (); /* undo initialize_job_signals */
#endif /* JOB_CONTROL */
#if defined (BUFFERED_INPUT)
if (default_buffered_input >= 0)
sync_buffered_stream (default_buffered_input);
#endif
exit_value = shell_execve (command, args, env);
/* We have to set this to NULL because shell_execve has called realloc()
Vendored
+2 -2
View File
@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac for Bash 5.0, version 5.002.
# From configure.ac for Bash 5.0, version 5.003.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 5.0-beta.
#
@@ -16180,7 +16180,7 @@ linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
*) $as_echo "#define PGRP_PIPE 1" >>confdefs.h
;;
esac ;;
openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
netbsd*|openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
*qnx[67]*) LOCAL_LIBS="-lncurses" ;;
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
+2 -2
View File
@@ -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 5.0, version 5.002])dnl
AC_REVISION([for Bash 5.0, version 5.003])dnl
define(bashvers, 5.0)
define(relstatus, beta)
@@ -1116,7 +1116,7 @@ linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
1.*|2.[[0123]]*) : ;;
*) AC_DEFINE(PGRP_PIPE) ;;
esac ;;
openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
netbsd*|openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
*qnx[[67]]*) LOCAL_LIBS="-lncurses" ;;
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
+1 -1
View File
@@ -748,7 +748,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
reap_procsubs ();
# endif
if (variable_context != 0)
if (variable_context != 0) /* XXX - also if sourcelevel != 0? */
{
ofifo = num_fifos ();
ofifo_list = copy_fifo_list ((int *)&osize);
+5 -1
View File
@@ -325,6 +325,9 @@ expr_bind_variable (lhs, rhs)
SHELL_VAR *v;
int aflags;
if (lhs == 0 || *lhs == 0)
return; /* XXX */
#if defined (ARRAY_VARS)
aflags = (assoc_expand_once && already_expanded) ? ASS_NOEXPAND : 0;
#else
@@ -1012,7 +1015,8 @@ exp0 ()
expr_bind_array_element (curlval.tokstr, curlval.ind, vincdec);
else
#endif
expr_bind_variable (tokstr, vincdec);
if (tokstr)
expr_bind_variable (tokstr, vincdec);
}
free (vincdec);
val = v2;
+7 -1
View File
@@ -630,6 +630,8 @@ stop_pipeline (async, deferred)
pipeline_pgrp = 0;
newjob->flags = 0;
if (pipefail_opt)
newjob->flags |= J_PIPEFAIL;
/* Flag to see if in another pgrp. */
if (job_control)
@@ -688,7 +690,7 @@ stop_pipeline (async, deferred)
{
newjob->flags |= J_FOREGROUND;
/*
* !!!!! NOTE !!!!! (chet@ins.cwru.edu)
* !!!!! NOTE !!!!! (chet@po.cwru.edu)
*
* The currently-accepted job control wisdom says to set the
* terminal's process group n+1 times in an n-step pipeline:
@@ -2639,7 +2641,11 @@ raw_job_exit_status (job)
int fail;
WAIT ret;
#if 0
if (pipefail_opt)
#else
if (jobs[job]->flags & J_PIPEFAIL)
#endif
{
fail = 0;
p = jobs[job]->pipe;
+1
View File
@@ -103,6 +103,7 @@ typedef enum { JNONE = -1, JRUNNING = 1, JSTOPPED = 2, JDEAD = 4, JMIXED = 8 } J
#define J_NOHUP 0x08 /* Don't send SIGHUP to job if shell gets SIGHUP. */
#define J_STATSAVED 0x10 /* A process in this job had had status saved via $! */
#define J_ASYNC 0x20 /* Job was started asynchronously */
#define J_PIPEFAIL 0x40 /* pipefail set when job was started */
#define IS_FOREGROUND(j) ((jobs[j]->flags & J_FOREGROUND) != 0)
#define IS_NOTIFIED(j) ((jobs[j]->flags & J_NOTIFIED) != 0)
+5 -3
View File
@@ -55,6 +55,8 @@
#define slashify_in_quotes "\\`\"$"
#define fielddelim(c) (whitespace(c) || (c) == '\n')
typedef int _hist_search_func_t PARAMS((const char *, int));
static char error_pointer;
@@ -769,7 +771,7 @@ history_expand_internal (char *string, int start, int qc, int *end_index_ptr, ch
the last time. */
if (subst_bywords && si > we)
{
for (; temp[si] && whitespace (temp[si]); si++)
for (; temp[si] && fielddelim (temp[si]); si++)
;
ws = si;
we = history_tokenize_word (temp, si);
@@ -1446,7 +1448,7 @@ history_tokenize_word (const char *string, int ind)
i = ind;
delimiter = nestdelim = 0;
if (member (string[i], "()\n"))
if (member (string[i], "()\n")) /* XXX - included \n, but why? been here forever */
{
i++;
return i;
@@ -1604,7 +1606,7 @@ history_tokenize_internal (const char *string, int wind, int *indp)
for (i = result_index = size = 0, result = (char **)NULL; string[i]; )
{
/* Skip leading whitespace. */
for (; string[i] && whitespace (string[i]); i++)
for (; string[i] && fielddelim (string[i]); i++)
;
if (string[i] == 0 || string[i] == history_comment_char)
return (result);
+26 -1
View File
@@ -51,6 +51,8 @@
extern void _hs_replace_history_data PARAMS((int, histdata_t *, histdata_t *));
extern HIST_ENTRY *_rl_saved_line_for_history;
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
the undo list. */
int _rl_doing_an_undo = 0;
@@ -166,7 +168,7 @@ _rl_copy_undo_list (UNDO_LIST *head)
int
rl_do_undo (void)
{
UNDO_LIST *release;
UNDO_LIST *release, *search;
int waiting_for_begin, start, end;
HIST_ENTRY *cur, *temp;
@@ -223,6 +225,7 @@ rl_do_undo (void)
release = rl_undo_list;
rl_undo_list = rl_undo_list->next;
release->next = 0; /* XXX */
/* If we are editing a history entry, make sure the change is replicated
in the history entry's line */
@@ -235,8 +238,30 @@ rl_do_undo (void)
xfree (temp);
}
/* Make sure there aren't any history entries with that undo list */
_hs_replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
/* And make sure this list isn't anywhere in the saved line for history */
if (_rl_saved_line_for_history && _rl_saved_line_for_history->data)
{
/* Brute force; no finesse here */
search = (UNDO_LIST *)_rl_saved_line_for_history->data;
if (search == release)
_rl_saved_line_for_history->data = rl_undo_list;
else
{
while (search->next)
{
if (search->next == release)
{
search->next = rl_undo_list;
break;
}
search = search->next;
}
}
}
xfree (release);
}
while (waiting_for_begin);
+1 -1
View File
@@ -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
+1 -1
View File
@@ -4,7 +4,7 @@ export LC_COLLATE=C
#
expect()
{
echo expect "$@"
: # if needed, change me to echo expect "$@"
}
# First, a test that bash-2.01.1 fails
+2
View File
@@ -231,6 +231,7 @@ echo one
1 set -o histexpand
2 echo one
3 for f in a b c; do echo echo one; done
4 history
two
echo echo two
echo two
@@ -238,3 +239,4 @@ echo two
echo two
1 echo two
2 for f in a b c; do echo echo two; done
3 history
+1
View File
@@ -1,3 +1,4 @@
unset HISTIGNORE
HISTFILE=$TMPDIR/bashhist-$$
set -o history
+12 -6
View File
@@ -68,6 +68,12 @@ unset -f bug
count_lines()
{
wc -l < $1
# case "$1" in
# *sh-np*) [ -e "$1" ] || { echo 0; echo 0; echo 0; echo 0; return; } ;;
# *) ;;
# esac
wc -l < $1
wc -l < $1
true | wc -l < $1
@@ -80,12 +86,12 @@ unset -f count_lines
echo extern
FN=$TMPDIR/bashtest-$$
cat >$FN <<EOF
wc -l < \$1
wc -l < \$1
wc -l < \$1
true | wc -l < \$1
wc -l < \$1
cat >$FN << \EOF
wc -l < $1
wc -l < $1
wc -l < $1
true | wc -l < $1
wc -l < $1
EOF
${THIS_SH} -c "source $FN <(date)" | _cut_leading_spaces
+5 -2
View File
@@ -1,4 +1,7 @@
PATH=$PATH:`pwd`
export PATH
${THIS_SH} ./glob.tests 2>&1 | grep -v '^expect' > ${BASH_TSTOUT}
diff ${BASH_TSTOUT} glob.right && rm -f ${BASH_TSTOUT}
( diff -a glob.right glob.right >/dev/null 2>&1 ) && AFLAG=-a
${THIS_SH} ./glob.tests > ${BASH_TSTOUT} 2>&1
diff ${AFLAG} ${BASH_TSTOUT} glob.right && rm -f ${BASH_TSTOUT}
+6 -2
View File
@@ -1,4 +1,8 @@
# See whether or not we can use `diff -a'
( diff -a ./nquote4.right ./nquote4.right >/dev/null 2>&1 ) && AFLAG=-a
echo warning: some of these tests will fail if you do not have UTF-8 >&2
echo warning: locales installed on your system >&2
${THIS_SH} ./nquote4.tests 2>&1 | grep -v '^expect' > ${BASH_TSTOUT}
diff ${BASH_TSTOUT} nquote4.right && rm -f ${BASH_TSTOUT}
${THIS_SH} ./nquote4.tests > ${BASH_TSTOUT} 2>&1
diff ${AFLAG} ${BASH_TSTOUT} nquote4.right && rm -f ${BASH_TSTOUT}