commit bash-20190913 snapshot

This commit is contained in:
Chet Ramey
2019-09-16 15:31:57 -04:00
parent ad66335110
commit db26b1cf58
13 changed files with 251 additions and 31 deletions
+30
View File
@@ -6530,3 +6530,33 @@ bashline.c
- edit_and_execute_command: reset the readahead token after calling
restore_parser_state, in case some call to reset_parser set
token_to_read. Fixes bug reported by null <avalonvales@protonmail.com>
9/9
---
execute_cmd.c
- execute_command_internal: if we're executing a command list
(executing_list != 0), save the old fifo list and close any new
FIFOs that the command opens. Fixes bug reported by
Kamil Cukrowski <kamilcukrowski@gmail.com>
9/10
----
aclocal.m4,m4/intdiv0.m4
- make sure `exit' is used consistently with <stdlib.h> included
- make sure `main' isn't declared to implicitly return int
- include <ulimit.h> before using ulimit
- include <string.h> before testing string functions
- fixes from Florian Weimer <fweimer@redhat.com>
configure.ac
- setresuid,setresgid: use AC_CHECK_FUNCS instead of AC_CHECK_DECL,
which always fails
shell.c
- disable_priv_mode: use HAVE_SETRESUID and HAVE_SETRESGID instead of
the HAVE_DECL variants, which always fail configure tests
m4/intl.m4
- gt_INTL_SUBDIR_CORE: add back check for localeconv, removed in
newer gettext releases
+1 -1
View File
@@ -1243,7 +1243,7 @@ tests/posixpat.right f
tests/posixpipe.tests f
tests/posixpipe.right f
tests/prec.right f
tests/precedence f
tests/precedence.tests f
tests/printf.tests f
tests/printf.right f
tests/printf1.sub f
Vendored
+44 -3
View File
@@ -139,6 +139,7 @@ typedef int (*_bashfunc)(const char *, ...);
typedef int (*_bashfunc)();
#endif
#include <stdlib.h>
int
main()
{
_bashfunc pf;
@@ -200,6 +201,7 @@ AC_CACHE_VAL(bash_cv_under_sys_siglist,
#ifndef UNDER_SYS_SIGLIST_DECLARED
extern char *_sys_siglist[];
#endif
int
main()
{
char *msg = (char *)_sys_siglist[2];
@@ -228,6 +230,7 @@ AC_CACHE_VAL(bash_cv_sys_siglist,
#if !HAVE_DECL_SYS_SIGLIST
extern char *sys_siglist[];
#endif
int
main()
{
char *msg = sys_siglist[2];
@@ -281,6 +284,7 @@ AC_CACHE_VAL(bash_cv_dup2_broken,
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
int
main()
{
int fd1, fd2, fl;
@@ -308,7 +312,8 @@ AC_DEFUN(BASH_FUNC_STRSIGNAL,
[AC_MSG_CHECKING([for the existence of strsignal])
AC_CACHE_VAL(bash_cv_have_strsignal,
[AC_TRY_LINK([#include <sys/types.h>
#include <signal.h>],
#include <signal.h>
#include <string.h>],
[char *s = (char *)strsignal(2);],
bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)])
AC_MSG_RESULT($bash_cv_have_strsignal)
@@ -329,6 +334,9 @@ AC_CACHE_VAL(bash_cv_opendir_not_robust,
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#if defined(HAVE_DIRENT_H)
# include <dirent.h>
#else
@@ -344,6 +352,7 @@ AC_CACHE_VAL(bash_cv_opendir_not_robust,
# endif
#endif /* HAVE_DIRENT_H */
#include <stdlib.h>
int
main()
{
DIR *dir;
@@ -524,6 +533,7 @@ AC_TRY_RUN([
#include <sys/time.h>
#include <sys/resource.h>
#include <stdlib.h>
int
main()
{
#ifdef HAVE_QUAD_T
@@ -609,6 +619,7 @@ getenv (name)
{
return "42";
}
int
main()
{
char *s;
@@ -695,6 +706,11 @@ AC_DEFUN(BASH_FUNC_ULIMIT_MAXFDS,
[AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize)
AC_CACHE_VAL(bash_cv_ulimit_maxfds,
[AC_TRY_RUN([
#include <stdlib.h>
#ifdef HAVE_ULIMIT_H
#include <ulimit.h>
#endif
int
main()
{
long maxfds = ulimit(4, 0L);
@@ -718,7 +734,9 @@ AC_CACHE_VAL(bash_cv_getcwd_malloc,
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
int
main()
{
char *xpwd;
@@ -768,12 +786,13 @@ AC_CACHE_VAL(bash_cv_fnm_extmatch,
[AC_TRY_RUN([
#include <fnmatch.h>
int
main()
{
#ifdef FNM_EXTMATCH
exit (0);
return (0);
#else
exit (1);
return (1);
#endif
}
], bash_cv_fnm_extmatch=yes, bash_cv_fnm_extmatch=no,
@@ -799,6 +818,7 @@ AC_CACHE_VAL(bash_cv_func_sigsetjmp,
#include <setjmp.h>
#include <stdlib.h>
int
main()
{
#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
@@ -847,7 +867,10 @@ AC_CACHE_VAL(bash_cv_func_strcoll_broken,
#if defined (HAVE_LOCALE_H)
#include <locale.h>
#endif
#include <string.h>
#include <stdlib.h>
int
main(c, v)
int c;
char *v[];
@@ -947,6 +970,7 @@ AC_CACHE_VAL(bash_cv_struct_stat_st_blocks,
#include <sys/stat.h>
],
[
int
main()
{
static struct stat a;
@@ -1254,7 +1278,11 @@ AC_CACHE_VAL(bash_cv_pgrp_pipe,
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#include <stdlib.h>
int
main()
{
# ifdef GETPGRP_VOID
@@ -1350,6 +1378,7 @@ int s;
nsigint++;
}
int
main()
{
nsigint = 0;
@@ -1433,9 +1462,11 @@ AC_CACHE_VAL(bash_cv_sys_named_pipes,
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
/* Add more tests in here as appropriate. */
int
main()
{
int fd, err;
@@ -1673,6 +1704,7 @@ AC_CACHE_VAL(bash_cv_unusable_rtsigs,
# define NSIG 64
#endif
int
main ()
{
int n_sigs = 2 * NSIG;
@@ -1787,6 +1819,7 @@ bash_cv_wcwidth_broken,
#include <locale.h>
#include <wchar.h>
int
main(c, v)
int c;
char **v;
@@ -1855,6 +1888,7 @@ AC_CACHE_VAL(ac_cv_rl_version,
extern int rl_gnu_readline_p;
int
main()
{
FILE *fp;
@@ -1944,7 +1978,9 @@ AC_CACHE_VAL(bash_cv_func_ctype_nonascii,
#endif
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
int
main(c, v)
int c;
char *v[];
@@ -1987,10 +2023,12 @@ AC_CACHE_VAL(bash_cv_wcontinued_broken,
#include <sys/wait.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#ifndef errno
extern int errno;
#endif
int
main()
{
int x;
@@ -2058,6 +2096,7 @@ AC_DEFUN([BASH_FUNC_SNPRINTF],
#include <stdio.h>
#include <stdlib.h>
int
main()
{
int n;
@@ -2114,6 +2153,7 @@ foo(format, va_alist)
return n;
}
int
main()
{
int n;
@@ -2143,6 +2183,7 @@ AC_CACHE_VAL(bash_cv_wexitstatus_offset,
#include <sys/wait.h>
int
main(c, v)
int c;
char **v;
Vendored
+67 -15
View File
@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac for Bash 5.0, version 5.011.
# From configure.ac for Bash 5.0, version 5.014.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 5.0-maint.
#
@@ -5396,6 +5396,7 @@ else
extern int rl_gnu_readline_p;
int
main()
{
FILE *fp;
@@ -7886,13 +7887,13 @@ static void
sigfpe_handler (int sig)
{
/* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
_exit (sig != SIGFPE);
exit (sig != SIGFPE);
}
int x = 1;
int y = 0;
int z;
int nan;
int xnan;
int main ()
{
@@ -7907,7 +7908,7 @@ int main ()
#endif
z = x / y;
nan = y / y;
xnan = y / y;
exit (2);
}
@@ -10665,6 +10666,18 @@ if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_func in localeconv
do :
ac_fn_c_check_func "$LINENO" "localeconv" "ac_cv_func_localeconv"
if test "x$ac_cv_func_localeconv" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LOCALECONV 1
_ACEOF
fi
done
@@ -14240,17 +14253,6 @@ cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_SETREGID $ac_have_decl
_ACEOF
ac_fn_c_check_decl "$LINENO" "" "ac_cv_have_decl_" "$ac_includes_default"
if test "x$ac_cv_have_decl_" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_ $ac_have_decl
_ACEOF
(setresuid, setresgid)
ac_fn_c_check_decl "$LINENO" "strcpy" "ac_cv_have_decl_strcpy" "$ac_includes_default"
if test "x$ac_cv_have_decl_strcpy" = xyes; then :
ac_have_decl=1
@@ -14274,6 +14276,19 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
for ac_func in setresuid setresgid
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
ac_fn_c_check_decl "$LINENO" "strtold" "ac_cv_have_decl_strtold" "$ac_includes_default"
if test "x$ac_cv_have_decl_strtold" = xyes; then :
ac_have_decl=1
@@ -15415,6 +15430,7 @@ else
#include <locale.h>
#include <wchar.h>
int
main(c, v)
int c;
char **v;
@@ -16857,7 +16873,9 @@ else
#endif
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
int
main(c, v)
int c;
char *v[];
@@ -16917,6 +16935,7 @@ else
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
int
main()
{
int fd1, fd2, fl;
@@ -16968,7 +16987,11 @@ else
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#include <stdlib.h>
int
main()
{
# ifdef GETPGRP_VOID
@@ -17186,6 +17209,7 @@ else
#if !HAVE_DECL_SYS_SIGLIST
extern char *sys_siglist[];
#endif
int
main()
{
char *msg = sys_siglist[2];
@@ -17268,6 +17292,7 @@ else
#ifndef UNDER_SYS_SIGLIST_DECLARED
extern char *_sys_siglist[];
#endif
int
main()
{
char *msg = (char *)_sys_siglist[2];
@@ -17673,6 +17698,7 @@ else
#include <sys/time.h>
#include <sys/resource.h>
#include <stdlib.h>
int
main()
{
#ifdef HAVE_QUAD_T
@@ -18200,6 +18226,7 @@ else
#include <sys/wait.h>
int
main(c, v)
int c;
char **v;
@@ -18528,6 +18555,7 @@ else
/* end confdefs.h. */
#include <sys/types.h>
#include <signal.h>
#include <string.h>
int
main ()
{
@@ -18572,6 +18600,9 @@ else
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#if defined(HAVE_DIRENT_H)
# include <dirent.h>
#else
@@ -18587,6 +18618,7 @@ else
# endif
#endif /* HAVE_DIRENT_H */
#include <stdlib.h>
int
main()
{
DIR *dir;
@@ -18638,6 +18670,11 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#ifdef HAVE_ULIMIT_H
#include <ulimit.h>
#endif
int
main()
{
long maxfds = ulimit(4, 0L);
@@ -18716,6 +18753,7 @@ getenv (name)
{
return "42";
}
int
main()
{
char *s;
@@ -18767,7 +18805,9 @@ else
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
int
main()
{
char *xpwd;
@@ -18824,6 +18864,7 @@ else
#include <setjmp.h>
#include <stdlib.h>
int
main()
{
#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
@@ -18892,7 +18933,10 @@ else
#if defined (HAVE_LOCALE_H)
#include <locale.h>
#endif
#include <string.h>
#include <stdlib.h>
int
main(c, v)
int c;
char *v[];
@@ -18964,6 +19008,7 @@ else
#include <stdio.h>
#include <stdlib.h>
int
main()
{
int n;
@@ -19043,6 +19088,7 @@ foo(format, va_alist)
return n;
}
int
main()
{
int n;
@@ -19346,6 +19392,7 @@ int s;
nsigint++;
}
int
main()
{
nsigint = 0;
@@ -19467,9 +19514,11 @@ else
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
/* Add more tests in here as appropriate. */
int
main()
{
int fd, err;
@@ -19664,10 +19713,12 @@ else
#include <sys/wait.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#ifndef errno
extern int errno;
#endif
int
main()
{
int x;
@@ -19784,6 +19835,7 @@ else
# define NSIG 64
#endif
int
main ()
{
int n_sigs = 2 * NSIG;
+5 -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.011])dnl
AC_REVISION([for Bash 5.0, version 5.014])dnl
define(bashvers, 5.0)
define(relstatus, maint)
@@ -850,10 +850,13 @@ AC_CHECK_DECLS([confstr])
AC_CHECK_DECLS([printf])
AC_CHECK_DECLS([sbrk])
AC_CHECK_DECLS([setregid])
AC_CHECK_DECLS[(setresuid, setresgid])
dnl AC_CHECK_DECLS[(setresuid])
dnl AC_CHECK_DECLS[(setresgid])
AC_CHECK_DECLS([strcpy])
AC_CHECK_DECLS([strsignal])
AC_CHECK_FUNCS(setresuid setresgid)
dnl Extra test to detect the horribly broken HP/UX 11.00 strtold(3)
AC_CHECK_DECLS([strtold], [
AC_MSG_CHECKING([for broken strtold])
+2 -1
View File
@@ -753,7 +753,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
reap_procsubs ();
# endif
if (variable_context != 0) /* XXX - also if sourcelevel != 0? */
if (variable_context != 0 || executing_list) /* XXX - also if sourcelevel != 0? */
{
ofifo = num_fifos ();
ofifo_list = copy_fifo_list ((int *)&osize);
@@ -2694,6 +2694,7 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close)
}
executing_list++;
QUIT;
#if 1
execute_command (command->value.Connection->first);
#else
+3 -3
View File
@@ -38,13 +38,13 @@ static void
sigfpe_handler (int sig)
{
/* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
_exit (sig != SIGFPE);
exit (sig != SIGFPE);
}
int x = 1;
int y = 0;
int z;
int nan;
int xnan;
int main ()
{
@@ -59,7 +59,7 @@ int main ()
#endif
z = x / y;
nan = y / y;
xnan = y / y;
exit (2);
}
]])],
+3
View File
@@ -243,6 +243,9 @@ AC_DEFUN([gt_INTL_SUBDIR_CORE],
stpcpy strcasecmp strdup strtoul tsearch argz_count argz_stringify \
argz_next __fsetlocking])
dnl ADDED FOR BASH
AC_CHECK_FUNCS([localeconv])
dnl Use the *_unlocked functions only if they are declared.
dnl (because some of them were defined without being declared in Solaris
dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
+2 -2
View File
@@ -1305,7 +1305,7 @@ disable_priv_mode ()
{
int e;
#if HAVE_DECL_SETRESUID
#if HAVE_SETRESUID
if (setresuid (current_user.uid, current_user.uid, current_user.uid) < 0)
#else
if (setuid (current_user.uid) < 0)
@@ -1318,7 +1318,7 @@ disable_priv_mode ()
exit (e);
#endif
}
#if HAVE_DECL_SETRESGID
#if HAVE_SETRESGID
if (setresgid (current_user.gid, current_user.gid, current_user.gid) < 0)
#else
if (setgid (current_user.gid) < 0)
+90
View File
@@ -0,0 +1,90 @@
# @(#)precedence_test 1.0 91/07/24 Maarten Litmaath
# 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/>.
#
# test of relative precedences for `&&' and `||' operators
echo "\`Say' echos its argument. Its return value is of no interest."
case `echo -n` in
'') Say () { echo -n "$*" ; } ;;
*) Say () { echo "$*\c" ; } ;;
esac
echo "\`Truth' echos its argument and returns a TRUE result."
Truth () {
Say $1;
return 0;
}
echo "\`False' echos its argument and returns a FALSE result."
False () {
Say $1;
return 1;
}
echo ""
cmd1='$open $test1 && $test2 $close || $test3'
cmd2='$test1 || $open $test2 && $test3 $close'
grouping_sh=
grouping_C='( )'
test3='Say 3'
for i in 1 2
do
eval proto=\$cmd$i
for test1 in 'Truth 1' 'False 1'
do
for test2 in 'Truth 2' 'False 2'
do
for precedence in sh C
do
eval set x \$grouping_$precedence
shift
open=${1-' '}
close=${2-' '}
eval cmd=\""$proto"\"
Say "$cmd output="
output=`eval "$cmd"`
Say "$output"
read correct || { echo 'Input fubar. Abort.' >&2; exit 1; }
test "X$output" = "X$correct" || echo " correct=$correct"
echo ''
done
echo ''
done
done
done << EOF
12
12
123
123
13
13
13
13
13
1
13
1
123
123
12
12
EOF
-1
View File
@@ -1,7 +1,6 @@
test1
foo
test2
test3
test4
8
test5
+3 -2
View File
@@ -17,8 +17,9 @@
eval cat <(echo test1)
eval "echo foo;cat" <(echo test2)
unset f
f=<(echo test3); cat "$f"
# this doesn't work, and it never should have
#unset f
#f=<(echo test3); cat "$f"
unset f
eval f=<(echo test4) "; cat \$f"
+1 -1
View File
@@ -1,2 +1,2 @@
${THIS_SH} ./precedence > ${BASH_TSTOUT}
${THIS_SH} ./precedence.tests > ${BASH_TSTOUT}
diff ${BASH_TSTOUT} prec.right && rm -f ${BASH_TSTOUT}