commit
e816f32708
@ -1,391 +0,0 @@
|
|||||||
From 54470831d055a429a9b13dc15a34552ec615973f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Chet Ramey <chet.ramey@case.edu>
|
|
||||||
Date: Mon, 1 Jul 2019 09:03:53 -0400
|
|
||||||
Subject: [PATCH] commit bash-20190628 snapshot
|
|
||||||
|
|
||||||
---
|
|
||||||
MANIFEST | 2 ++
|
|
||||||
bashline.c | 50 +------------------------------------------
|
|
||||||
builtins/help.def | 2 +-
|
|
||||||
config.h.in | 10 ++++++++-
|
|
||||||
configure | 11 ++++++++++
|
|
||||||
configure.ac | 1 +
|
|
||||||
doc/bash.1 | 3 ++-
|
|
||||||
doc/bashref.texi | 3 ++-
|
|
||||||
lib/glob/glob.c | 5 ++++-
|
|
||||||
pathexp.c | 16 ++++++++++++--
|
|
||||||
shell.c | 8 +++++++
|
|
||||||
tests/glob.tests | 2 ++
|
|
||||||
tests/glob6.sub | 54 +++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
tests/glob7.sub | 11 ++++++++++
|
|
||||||
14 files changed, 122 insertions(+), 56 deletions(-)
|
|
||||||
create mode 100644 tests/glob6.sub
|
|
||||||
create mode 100644 tests/glob7.sub
|
|
||||||
|
|
||||||
diff --git a/MANIFEST b/MANIFEST
|
|
||||||
index 03de221..14d4e1f 100644
|
|
||||||
--- a/MANIFEST
|
|
||||||
+++ b/MANIFEST
|
|
||||||
@@ -1060,6 +1060,8 @@ tests/glob1.sub f
|
|
||||||
tests/glob2.sub f
|
|
||||||
tests/glob3.sub f
|
|
||||||
tests/glob4.sub f
|
|
||||||
+tests/glob6.sub f
|
|
||||||
+tests/glob7.sub f
|
|
||||||
tests/glob.right f
|
|
||||||
tests/globstar.tests f
|
|
||||||
tests/globstar.right f
|
|
||||||
diff --git a/bashline.c b/bashline.c
|
|
||||||
index 824ea9d..f2e1c1d 100644
|
|
||||||
--- a/bashline.c
|
|
||||||
+++ b/bashline.c
|
|
||||||
@@ -3718,55 +3718,7 @@ static int
|
|
||||||
completion_glob_pattern (string)
|
|
||||||
char *string;
|
|
||||||
{
|
|
||||||
- register int c;
|
|
||||||
- char *send;
|
|
||||||
- int open;
|
|
||||||
-
|
|
||||||
- DECLARE_MBSTATE;
|
|
||||||
-
|
|
||||||
- open = 0;
|
|
||||||
- send = string + strlen (string);
|
|
||||||
-
|
|
||||||
- while (c = *string++)
|
|
||||||
- {
|
|
||||||
- switch (c)
|
|
||||||
- {
|
|
||||||
- case '?':
|
|
||||||
- case '*':
|
|
||||||
- return (1);
|
|
||||||
-
|
|
||||||
- case '[':
|
|
||||||
- open++;
|
|
||||||
- continue;
|
|
||||||
-
|
|
||||||
- case ']':
|
|
||||||
- if (open)
|
|
||||||
- return (1);
|
|
||||||
- continue;
|
|
||||||
-
|
|
||||||
- case '+':
|
|
||||||
- case '@':
|
|
||||||
- case '!':
|
|
||||||
- if (*string == '(') /*)*/
|
|
||||||
- return (1);
|
|
||||||
- continue;
|
|
||||||
-
|
|
||||||
- case '\\':
|
|
||||||
- if (*string++ == 0)
|
|
||||||
- return (0);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- /* Advance one fewer byte than an entire multibyte character to
|
|
||||||
- account for the auto-increment in the loop above. */
|
|
||||||
-#ifdef HANDLE_MULTIBYTE
|
|
||||||
- string--;
|
|
||||||
- ADVANCE_CHAR_P (string, send - string);
|
|
||||||
- string++;
|
|
||||||
-#else
|
|
||||||
- ADVANCE_CHAR_P (string, send - string);
|
|
||||||
-#endif
|
|
||||||
- }
|
|
||||||
- return (0);
|
|
||||||
+ return (glob_pattern_p (string) == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *globtext;
|
|
||||||
diff --git a/builtins/help.def b/builtins/help.def
|
|
||||||
index 006c4b5..92f9b38 100644
|
|
||||||
--- a/builtins/help.def
|
|
||||||
+++ b/builtins/help.def
|
|
||||||
@@ -128,7 +128,7 @@ help_builtin (list)
|
|
||||||
|
|
||||||
/* We should consider making `help bash' do something. */
|
|
||||||
|
|
||||||
- if (glob_pattern_p (list->word->word))
|
|
||||||
+ if (glob_pattern_p (list->word->word) == 1)
|
|
||||||
{
|
|
||||||
printf ("%s", ngettext ("Shell commands matching keyword `", "Shell commands matching keywords `", (list->next ? 2 : 1)));
|
|
||||||
print_word_list (list, ", ");
|
|
||||||
diff --git a/config.h.in b/config.h.in
|
|
||||||
index 8b22244..af40689 100644
|
|
||||||
--- a/config.h.in
|
|
||||||
+++ b/config.h.in
|
|
||||||
@@ -1,6 +1,6 @@
|
|
||||||
/* config.h -- Configuration file for bash. */
|
|
||||||
|
|
||||||
-/* Copyright (C) 1987-2009,2011-2012 Free Software Foundation, Inc.
|
|
||||||
+/* Copyright (C) 1987-2009,2011-2012,2013-2019 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of GNU Bash, the Bourne Again SHell.
|
|
||||||
|
|
||||||
@@ -810,6 +810,14 @@
|
|
||||||
#undef HAVE_SETREGID
|
|
||||||
#undef HAVE_DECL_SETREGID
|
|
||||||
|
|
||||||
+/* Define if you have the setregid function. */
|
|
||||||
+#undef HAVE_SETRESGID
|
|
||||||
+#undef HAVE_DECL_SETRESGID
|
|
||||||
+
|
|
||||||
+/* Define if you have the setresuid function. */
|
|
||||||
+#undef HAVE_SETRESUID
|
|
||||||
+#undef HAVE_DECL_SETRESUID
|
|
||||||
+
|
|
||||||
/* Define if you have the setvbuf function. */
|
|
||||||
#undef HAVE_SETVBUF
|
|
||||||
|
|
||||||
diff --git a/configure b/configure
|
|
||||||
index 2f62662..b3321c9 100755
|
|
||||||
--- a/configure
|
|
||||||
+++ b/configure
|
|
||||||
@@ -10281,6 +10281,17 @@ 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
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index 68d2ceb..f62a747 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -810,6 +810,7 @@ AC_CHECK_DECLS([confstr])
|
|
||||||
AC_CHECK_DECLS([printf])
|
|
||||||
AC_CHECK_DECLS([sbrk])
|
|
||||||
AC_CHECK_DECLS([setregid])
|
|
||||||
+AC_CHECK_DECLS[(setresuid, setresgid])
|
|
||||||
AC_CHECK_DECLS([strcpy])
|
|
||||||
AC_CHECK_DECLS([strsignal])
|
|
||||||
|
|
||||||
diff --git a/doc/bash.1 b/doc/bash.1
|
|
||||||
index e6cd08d..9e58a0b 100644
|
|
||||||
--- a/doc/bash.1
|
|
||||||
+++ b/doc/bash.1
|
|
||||||
@@ -4681,7 +4681,8 @@ above).
|
|
||||||
.PD
|
|
||||||
.SH "SIMPLE COMMAND EXPANSION"
|
|
||||||
When a simple command is executed, the shell performs the following
|
|
||||||
-expansions, assignments, and redirections, from left to right.
|
|
||||||
+expansions, assignments, and redirections, from left to right, in
|
|
||||||
+the following order.
|
|
||||||
.IP 1.
|
|
||||||
The words that the parser has marked as variable assignments (those
|
|
||||||
preceding the command name) and redirections are saved for later
|
|
||||||
diff --git a/doc/bashref.texi b/doc/bashref.texi
|
|
||||||
index d33cd57..3065126 100644
|
|
||||||
--- a/doc/bashref.texi
|
|
||||||
+++ b/doc/bashref.texi
|
|
||||||
@@ -2964,7 +2964,8 @@ is not specified. If the file does not exist, it is created.
|
|
||||||
@cindex command expansion
|
|
||||||
|
|
||||||
When a simple command is executed, the shell performs the following
|
|
||||||
-expansions, assignments, and redirections, from left to right.
|
|
||||||
+expansions, assignments, and redirections, from left to right, in
|
|
||||||
+the following order.
|
|
||||||
|
|
||||||
@enumerate
|
|
||||||
@item
|
|
||||||
diff --git a/lib/glob/glob.c b/lib/glob/glob.c
|
|
||||||
index 398253b..2eaa33e 100644
|
|
||||||
--- a/lib/glob/glob.c
|
|
||||||
+++ b/lib/glob/glob.c
|
|
||||||
@@ -607,6 +607,7 @@ glob_vector (pat, dir, flags)
|
|
||||||
register unsigned int i;
|
|
||||||
int mflags; /* Flags passed to strmatch (). */
|
|
||||||
int pflags; /* flags passed to sh_makepath () */
|
|
||||||
+ int hasglob; /* return value from glob_pattern_p */
|
|
||||||
int nalloca;
|
|
||||||
struct globval *firstmalloc, *tmplink;
|
|
||||||
char *convfn;
|
|
||||||
@@ -648,10 +649,12 @@ glob_vector (pat, dir, flags)
|
|
||||||
patlen = (pat && *pat) ? strlen (pat) : 0;
|
|
||||||
|
|
||||||
/* If the filename pattern (PAT) does not contain any globbing characters,
|
|
||||||
+ or contains a pattern with only backslash escapes (hasglob == 2),
|
|
||||||
we can dispense with reading the directory, and just see if there is
|
|
||||||
a filename `DIR/PAT'. If there is, and we can access it, just make the
|
|
||||||
vector to return and bail immediately. */
|
|
||||||
- if (skip == 0 && glob_pattern_p (pat) == 0)
|
|
||||||
+ hasglob = 0;
|
|
||||||
+ if (skip == 0 && (hasglob = glob_pattern_p (pat)) == 0 || hasglob == 2)
|
|
||||||
{
|
|
||||||
int dirlen;
|
|
||||||
struct stat finfo;
|
|
||||||
diff --git a/pathexp.c b/pathexp.c
|
|
||||||
index c1bf2d8..97dfcd6 100644
|
|
||||||
--- a/pathexp.c
|
|
||||||
+++ b/pathexp.c
|
|
||||||
@@ -58,7 +58,10 @@ int extended_glob = EXTGLOB_DEFAULT;
|
|
||||||
/* Control enabling special handling of `**' */
|
|
||||||
int glob_star = 0;
|
|
||||||
|
|
||||||
-/* Return nonzero if STRING has any unquoted special globbing chars in it. */
|
|
||||||
+/* Return nonzero if STRING has any unquoted special globbing chars in it.
|
|
||||||
+ This is supposed to be called when pathname expansion is performed, so
|
|
||||||
+ it implements the rules in Posix 2.13.3, specifically that an unquoted
|
|
||||||
+ slash cannot appear in a bracket expression. */
|
|
||||||
int
|
|
||||||
unquoted_glob_pattern_p (string)
|
|
||||||
register char *string;
|
|
||||||
@@ -85,10 +88,14 @@ unquoted_glob_pattern_p (string)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case ']':
|
|
||||||
- if (open)
|
|
||||||
+ if (open) /* XXX - if --open == 0? */
|
|
||||||
return (1);
|
|
||||||
continue;
|
|
||||||
|
|
||||||
+ case '/':
|
|
||||||
+ if (open)
|
|
||||||
+ open = 0;
|
|
||||||
+
|
|
||||||
case '+':
|
|
||||||
case '@':
|
|
||||||
case '!':
|
|
||||||
@@ -106,6 +113,11 @@ unquoted_glob_pattern_p (string)
|
|
||||||
string++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
+ else if (open && *string == '/')
|
|
||||||
+ {
|
|
||||||
+ string++; /* quoted slashes in bracket expressions are ok */
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
else if (*string == 0)
|
|
||||||
return (0);
|
|
||||||
|
|
||||||
diff --git a/shell.c b/shell.c
|
|
||||||
index a2b2a55..6adabc8 100644
|
|
||||||
--- a/shell.c
|
|
||||||
+++ b/shell.c
|
|
||||||
@@ -1293,7 +1293,11 @@ disable_priv_mode ()
|
|
||||||
{
|
|
||||||
int e;
|
|
||||||
|
|
||||||
+#if HAVE_DECL_SETRESUID
|
|
||||||
+ if (setresuid (current_user.uid, current_user.uid, current_user.uid) < 0)
|
|
||||||
+#else
|
|
||||||
if (setuid (current_user.uid) < 0)
|
|
||||||
+#endif
|
|
||||||
{
|
|
||||||
e = errno;
|
|
||||||
sys_error (_("cannot set uid to %d: effective uid %d"), current_user.uid, current_user.euid);
|
|
||||||
@@ -1302,7 +1306,11 @@ disable_priv_mode ()
|
|
||||||
exit (e);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
+#if HAVE_DECL_SETRESGID
|
|
||||||
+ if (setresgid (current_user.gid, current_user.gid, current_user.gid) < 0)
|
|
||||||
+#else
|
|
||||||
if (setgid (current_user.gid) < 0)
|
|
||||||
+#endif
|
|
||||||
sys_error (_("cannot set gid to %d: effective gid %d"), current_user.gid, current_user.egid);
|
|
||||||
|
|
||||||
current_user.euid = current_user.uid;
|
|
||||||
diff --git a/tests/glob.tests b/tests/glob.tests
|
|
||||||
index 01913bb..fb012f7 100644
|
|
||||||
--- a/tests/glob.tests
|
|
||||||
+++ b/tests/glob.tests
|
|
||||||
@@ -12,6 +12,8 @@ ${THIS_SH} ./glob1.sub
|
|
||||||
${THIS_SH} ./glob2.sub
|
|
||||||
${THIS_SH} ./glob3.sub
|
|
||||||
${THIS_SH} ./glob4.sub
|
|
||||||
+${THIS_SH} ./glob6.sub
|
|
||||||
+${THIS_SH} ./glob7.sub
|
|
||||||
|
|
||||||
MYDIR=$PWD # save where we are
|
|
||||||
|
|
||||||
diff --git a/tests/glob6.sub b/tests/glob6.sub
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..b099811
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/glob6.sub
|
|
||||||
@@ -0,0 +1,54 @@
|
|
||||||
+# tests of the backslash-in-glob-patterns discussion on the austin-group ML
|
|
||||||
+
|
|
||||||
+: ${TMPDIR:=/var/tmp}
|
|
||||||
+
|
|
||||||
+ORIG=$PWD
|
|
||||||
+GLOBDIR=$TMPDIR/bash-glob-$$
|
|
||||||
+mkdir $GLOBDIR && cd $GLOBDIR
|
|
||||||
+
|
|
||||||
+# does the pattern matcher allow backslashes as escape characters and remove
|
|
||||||
+# them as part of matching?
|
|
||||||
+touch abcdefg
|
|
||||||
+pat='ab\cd*'
|
|
||||||
+printf '<%s>\n' $pat
|
|
||||||
+pat='\.'
|
|
||||||
+printf '<%s>\n' $pat
|
|
||||||
+rm abcdefg
|
|
||||||
+
|
|
||||||
+# how about when escaping pattern characters?
|
|
||||||
+touch '*abc.c'
|
|
||||||
+a='\**.c'
|
|
||||||
+printf '%s\n' $a
|
|
||||||
+rm -f '*abc.c'
|
|
||||||
+
|
|
||||||
+# how about when making the distinction between readable and searchable path
|
|
||||||
+# components?
|
|
||||||
+mkdir -m a=x searchable
|
|
||||||
+mkdir -m a=r readable
|
|
||||||
+
|
|
||||||
+p='searchable/\.'
|
|
||||||
+printf "%s\n" $p
|
|
||||||
+
|
|
||||||
+p='searchable/\./.'
|
|
||||||
+printf "%s\n" $p
|
|
||||||
+
|
|
||||||
+p='readable/\.'
|
|
||||||
+printf "%s\n" $p
|
|
||||||
+
|
|
||||||
+p='readable/\./.'
|
|
||||||
+printf "%s\n" $p
|
|
||||||
+
|
|
||||||
+printf "%s\n" 'searchable/\.'
|
|
||||||
+printf "%s\n" 'readable/\.'
|
|
||||||
+
|
|
||||||
+echo */.
|
|
||||||
+
|
|
||||||
+p='*/\.'
|
|
||||||
+echo $p
|
|
||||||
+
|
|
||||||
+echo */'.'
|
|
||||||
+
|
|
||||||
+rmdir searchable readable
|
|
||||||
+
|
|
||||||
+cd $ORIG
|
|
||||||
+rmdir $GLOBDIR
|
|
||||||
diff --git a/tests/glob7.sub b/tests/glob7.sub
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..0212b8e
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/glob7.sub
|
|
||||||
@@ -0,0 +1,11 @@
|
|
||||||
+# according to Posix 2.13.3, a slash in a bracket expression renders that
|
|
||||||
+# bracket expression invalid
|
|
||||||
+shopt -s nullglob
|
|
||||||
+
|
|
||||||
+echo 1: [qwe/qwe]
|
|
||||||
+echo 2: [qwe/
|
|
||||||
+echo 3: [qwe/]
|
|
||||||
+
|
|
||||||
+echo 4: [qwe\/qwe]
|
|
||||||
+echo 5: [qwe\/
|
|
||||||
+echo 6: [qwe\/]
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
||||||
@ -1,8 +1,19 @@
|
|||||||
|
From 34497c50a8497148e3b0232659f58ffaf4931b06 Mon Sep 17 00:00:00 2001
|
||||||
|
From: liujian <liujianliu.liu@huawei.com>
|
||||||
|
Date: Mon, 31 May 2021 21:46:41 +0800
|
||||||
|
Subject: [PATCH] bash-2.05a-interpreter
|
||||||
|
|
||||||
|
---
|
||||||
|
config.h.in | 6 +++
|
||||||
|
configure.ac | 2 +-
|
||||||
|
execute_cmd.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
3 files changed, 151 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/config.h.in b/config.h.in
|
diff --git a/config.h.in b/config.h.in
|
||||||
index 0adc903..366e639 100644
|
index ab316d4..11d1d68 100644
|
||||||
--- a/config.h.in
|
--- a/config.h.in
|
||||||
+++ b/config.h.in
|
+++ b/config.h.in
|
||||||
@@ -758,6 +758,9 @@
|
@@ -775,6 +775,9 @@
|
||||||
/* Define if you have the pselect function. */
|
/* Define if you have the pselect function. */
|
||||||
#undef HAVE_PSELECT
|
#undef HAVE_PSELECT
|
||||||
|
|
||||||
@ -12,7 +23,7 @@ index 0adc903..366e639 100644
|
|||||||
/* Define if you have the putenv function. */
|
/* Define if you have the putenv function. */
|
||||||
#undef HAVE_PUTENV
|
#undef HAVE_PUTENV
|
||||||
|
|
||||||
@@ -956,6 +959,9 @@
|
@@ -981,6 +984,9 @@
|
||||||
/* Define if you have the <dlfcn.h> header file. */
|
/* Define if you have the <dlfcn.h> header file. */
|
||||||
#undef HAVE_DLFCN_H
|
#undef HAVE_DLFCN_H
|
||||||
|
|
||||||
@ -23,20 +34,20 @@ index 0adc903..366e639 100644
|
|||||||
#undef HAVE_GRP_H
|
#undef HAVE_GRP_H
|
||||||
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
diff --git a/configure.ac b/configure.ac
|
||||||
index 2c74f13..4e9c3a4 100644
|
index 2fe3e7d..f1b7f1b 100644
|
||||||
--- a/configure.ac
|
--- a/configure.ac
|
||||||
+++ b/configure.ac
|
+++ b/configure.ac
|
||||||
@@ -782,7 +782,7 @@ dnl checks for system calls
|
@@ -827,7 +827,7 @@ dnl checks for system calls
|
||||||
AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getgroups gethostname \
|
AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getentropy getgroups \
|
||||||
getpagesize getpeername getrlimit getrusage gettimeofday \
|
gethostname getpagesize getpeername getrandom getrlimit \
|
||||||
kill killpg lstat pselect readlink select setdtablesize \
|
getrusage gettimeofday kill killpg lstat pselect readlink \
|
||||||
- setitimer tcgetpgrp uname ulimit waitpid)
|
- select setdtablesize setitimer tcgetpgrp uname ulimit waitpid)
|
||||||
+ setitimer tcgetpgrp uname ulimit waitpid pread)
|
+ select setdtablesize setitimer tcgetpgrp uname ulimit waitpid pread)
|
||||||
AC_REPLACE_FUNCS(rename)
|
AC_REPLACE_FUNCS(rename)
|
||||||
|
|
||||||
dnl checks for c library functions
|
dnl checks for c library functions
|
||||||
diff --git a/execute_cmd.c b/execute_cmd.c
|
diff --git a/execute_cmd.c b/execute_cmd.c
|
||||||
index 4eae19c..0af6f8f 100644
|
index d2a0dd7..374843d 100644
|
||||||
--- a/execute_cmd.c
|
--- a/execute_cmd.c
|
||||||
+++ b/execute_cmd.c
|
+++ b/execute_cmd.c
|
||||||
@@ -41,6 +41,10 @@
|
@@ -41,6 +41,10 @@
|
||||||
@ -50,34 +61,33 @@ index 4eae19c..0af6f8f 100644
|
|||||||
#include "posixtime.h"
|
#include "posixtime.h"
|
||||||
|
|
||||||
#if defined (HAVE_SYS_RESOURCE_H) && !defined (RLIMTYPE)
|
#if defined (HAVE_SYS_RESOURCE_H) && !defined (RLIMTYPE)
|
||||||
@@ -5706,6 +5710,14 @@ shell_execve (command, args, env)
|
@@ -5832,6 +5836,14 @@ shell_execve (command, args, env)
|
||||||
{
|
{
|
||||||
/* The file has the execute bits set, but the kernel refuses to
|
/* The file has the execute bits set, but the kernel refuses to
|
||||||
run it for some reason. See why. */
|
run it for some reason. See why. */
|
||||||
+#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)
|
+#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)
|
||||||
+ int fd = open (command, O_RDONLY);
|
+ int fd = open (command, O_RDONLY);
|
||||||
+
|
+
|
||||||
+ if (fd >= 0)
|
+ if (fd >= 0)
|
||||||
+ sample_len = read (fd, sample, sizeof (sample));
|
+ sample_len = read (fd, sample, sizeof (sample));
|
||||||
+ else
|
+ else
|
||||||
+ sample_len = -1;
|
+ sample_len = -1;
|
||||||
+#endif
|
+#endif
|
||||||
#if defined (HAVE_HASH_BANG_EXEC)
|
#if defined (HAVE_HASH_BANG_EXEC)
|
||||||
READ_SAMPLE_BUF (command, sample, sample_len);
|
READ_SAMPLE_BUF (command, sample, sample_len);
|
||||||
if (sample_len > 0)
|
if (sample_len > 0)
|
||||||
@@ -5715,6 +5727,7 @@ shell_execve (command, args, env)
|
@@ -5841,6 +5853,7 @@ shell_execve (command, args, env)
|
||||||
char *interp;
|
char *interp;
|
||||||
int ilen;
|
int ilen;
|
||||||
|
|
||||||
+ close (fd);
|
+ close (fd);
|
||||||
interp = getinterp (sample, sample_len, (int *)NULL);
|
interp = getinterp (sample, sample_len, (int *)NULL);
|
||||||
ilen = strlen (interp);
|
ilen = strlen (interp);
|
||||||
errno = i;
|
errno = i;
|
||||||
@@ -5730,7 +5743,138 @@ shell_execve (command, args, env)
|
@@ -5856,6 +5869,137 @@ shell_execve (command, args, env)
|
||||||
return (EX_NOEXEC);
|
return (EX_NOEXEC);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
- errno = i;
|
|
||||||
+#if defined (HAVE_ELF_H)
|
+#if defined (HAVE_ELF_H)
|
||||||
+ if (i == ENOENT
|
+ if (i == ENOENT
|
||||||
+ && sample_len > EI_NIDENT
|
+ && sample_len > EI_NIDENT
|
||||||
@ -209,9 +219,9 @@ index 4eae19c..0af6f8f 100644
|
|||||||
+ close (fd);
|
+ close (fd);
|
||||||
+#endif
|
+#endif
|
||||||
+
|
+
|
||||||
+ errno = i;
|
errno = i;
|
||||||
file_error (command);
|
file_error (command);
|
||||||
}
|
}
|
||||||
return (last_command_exit_value);
|
|
||||||
--
|
--
|
||||||
2.17.2
|
2.23.0
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,17 @@
|
|||||||
--- bash-2.05b/aclocal.m4.pgrp_sync 2002-06-25 14:45:43.000000000 +0100
|
From 75bc5402fa5953987bdbc0443993cbcab757db94 Mon Sep 17 00:00:00 2001
|
||||||
+++ bash-2.05b/aclocal.m4 2003-01-15 18:17:35.000000000 +0000
|
From: liujian <liujianliu.liu@huawei.com>
|
||||||
@@ -1255,7 +1255,7 @@
|
Date: Mon, 31 May 2021 21:48:33 +0800
|
||||||
|
Subject: [PATCH] bash-2.05b-pgrp_sync
|
||||||
|
|
||||||
|
---
|
||||||
|
aclocal.m4 | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/aclocal.m4 b/aclocal.m4
|
||||||
|
index 6899e82..d131798 100644
|
||||||
|
--- a/aclocal.m4
|
||||||
|
+++ b/aclocal.m4
|
||||||
|
@@ -1332,7 +1332,7 @@ main()
|
||||||
wait(&status);
|
wait(&status);
|
||||||
exit(ok ? 0 : 5);
|
exit(ok ? 0 : 5);
|
||||||
}
|
}
|
||||||
@ -9,3 +20,6 @@
|
|||||||
[AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
|
[AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
|
||||||
bash_cv_pgrp_pipe=no])
|
bash_cv_pgrp_pipe=no])
|
||||||
])
|
])
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,17 @@
|
|||||||
diff -up bash-4.0/execute_cmd.c.nobits bash-4.0/execute_cmd.c
|
From f05bc8f59b01c605273ab9736585218d9ecc510c Mon Sep 17 00:00:00 2001
|
||||||
--- bash-4.0/execute_cmd.c.nobits 2009-08-11 11:53:38.000000000 +0200
|
From: liujian <liujianliu.liu@huawei.com>
|
||||||
+++ bash-4.0/execute_cmd.c 2009-08-14 16:18:18.000000000 +0200
|
Date: Mon, 31 May 2021 22:32:37 +0800
|
||||||
@@ -4747,6 +4747,7 @@ shell_execve (command, args, env)
|
Subject: [PATCH] bash-4.0-nobits
|
||||||
|
|
||||||
|
---
|
||||||
|
execute_cmd.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||||
|
1 file changed, 107 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/execute_cmd.c b/execute_cmd.c
|
||||||
|
index 374843d..99674df 100644
|
||||||
|
--- a/execute_cmd.c
|
||||||
|
+++ b/execute_cmd.c
|
||||||
|
@@ -5875,6 +5875,7 @@ shell_execve (command, args, env)
|
||||||
&& memcmp (sample, ELFMAG, SELFMAG) == 0)
|
&& memcmp (sample, ELFMAG, SELFMAG) == 0)
|
||||||
{
|
{
|
||||||
off_t offset = -1;
|
off_t offset = -1;
|
||||||
@ -9,7 +19,7 @@ diff -up bash-4.0/execute_cmd.c.nobits bash-4.0/execute_cmd.c
|
|||||||
|
|
||||||
/* It is an ELF file. Now determine whether it is dynamically
|
/* It is an ELF file. Now determine whether it is dynamically
|
||||||
linked and if yes, get the offset of the interpreter
|
linked and if yes, get the offset of the interpreter
|
||||||
@@ -4756,13 +4757,61 @@ shell_execve (command, args, env)
|
@@ -5884,13 +5885,61 @@ shell_execve (command, args, env)
|
||||||
{
|
{
|
||||||
Elf32_Ehdr ehdr;
|
Elf32_Ehdr ehdr;
|
||||||
Elf32_Phdr *phdr;
|
Elf32_Phdr *phdr;
|
||||||
@ -72,7 +82,7 @@ diff -up bash-4.0/execute_cmd.c.nobits bash-4.0/execute_cmd.c
|
|||||||
nphdr = ehdr.e_phnum;
|
nphdr = ehdr.e_phnum;
|
||||||
phdr = (Elf32_Phdr *) malloc (nphdr * ehdr.e_phentsize);
|
phdr = (Elf32_Phdr *) malloc (nphdr * ehdr.e_phentsize);
|
||||||
if (phdr != NULL)
|
if (phdr != NULL)
|
||||||
@@ -4792,13 +4841,60 @@ shell_execve (command, args, env)
|
@@ -5920,13 +5969,60 @@ shell_execve (command, args, env)
|
||||||
{
|
{
|
||||||
Elf64_Ehdr ehdr;
|
Elf64_Ehdr ehdr;
|
||||||
Elf64_Phdr *phdr;
|
Elf64_Phdr *phdr;
|
||||||
@ -134,7 +144,7 @@ diff -up bash-4.0/execute_cmd.c.nobits bash-4.0/execute_cmd.c
|
|||||||
nphdr = ehdr.e_phnum;
|
nphdr = ehdr.e_phnum;
|
||||||
phdr = (Elf64_Phdr *) malloc (nphdr * ehdr.e_phentsize);
|
phdr = (Elf64_Phdr *) malloc (nphdr * ehdr.e_phentsize);
|
||||||
if (phdr != NULL)
|
if (phdr != NULL)
|
||||||
@@ -4858,8 +4954,15 @@ shell_execve (command, args, env)
|
@@ -5986,8 +6082,15 @@ shell_execve (command, args, env)
|
||||||
{
|
{
|
||||||
close (fd);
|
close (fd);
|
||||||
errno = i;
|
errno = i;
|
||||||
@ -152,3 +162,6 @@ diff -up bash-4.0/execute_cmd.c.nobits bash-4.0/execute_cmd.c
|
|||||||
free (interp);
|
free (interp);
|
||||||
return (EX_NOEXEC);
|
return (EX_NOEXEC);
|
||||||
}
|
}
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,17 @@
|
|||||||
|
From 7930678ce9b0913ed355a6294f842d3e473f810d Mon Sep 17 00:00:00 2001
|
||||||
|
From: liujian <liujianliu.liu@huawei.com>
|
||||||
|
Date: Mon, 31 May 2021 22:43:51 +0800
|
||||||
|
Subject: [PATCH] bash-4.2-coverity
|
||||||
|
|
||||||
|
---
|
||||||
|
execute_cmd.c | 27 ++++++++++++++-------------
|
||||||
|
1 file changed, 14 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
diff --git a/execute_cmd.c b/execute_cmd.c
|
diff --git a/execute_cmd.c b/execute_cmd.c
|
||||||
index a988400..412128c 100644
|
index 99674df..657c047 100644
|
||||||
--- a/execute_cmd.c
|
--- a/execute_cmd.c
|
||||||
+++ b/execute_cmd.c
|
+++ b/execute_cmd.c
|
||||||
@@ -5760,7 +5760,7 @@ shell_execve (command, args, env)
|
@@ -5886,7 +5886,7 @@ shell_execve (command, args, env)
|
||||||
Elf32_Ehdr ehdr;
|
Elf32_Ehdr ehdr;
|
||||||
Elf32_Phdr *phdr;
|
Elf32_Phdr *phdr;
|
||||||
Elf32_Shdr *shdr;
|
Elf32_Shdr *shdr;
|
||||||
@ -11,7 +20,7 @@ index a988400..412128c 100644
|
|||||||
|
|
||||||
/* We have to copy the data since the sample buffer
|
/* We have to copy the data since the sample buffer
|
||||||
might not be aligned correctly to be accessed as
|
might not be aligned correctly to be accessed as
|
||||||
@@ -5768,12 +5768,12 @@ shell_execve (command, args, env)
|
@@ -5894,12 +5894,12 @@ shell_execve (command, args, env)
|
||||||
memcpy (&ehdr, sample, sizeof (Elf32_Ehdr));
|
memcpy (&ehdr, sample, sizeof (Elf32_Ehdr));
|
||||||
|
|
||||||
nshdr = ehdr.e_shnum;
|
nshdr = ehdr.e_shnum;
|
||||||
@ -26,7 +35,7 @@ index a988400..412128c 100644
|
|||||||
ehdr.e_shoff);
|
ehdr.e_shoff);
|
||||||
#else
|
#else
|
||||||
if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
|
if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
|
||||||
@@ -5815,11 +5815,11 @@ shell_execve (command, args, env)
|
@@ -5941,11 +5941,11 @@ shell_execve (command, args, env)
|
||||||
}
|
}
|
||||||
|
|
||||||
nphdr = ehdr.e_phnum;
|
nphdr = ehdr.e_phnum;
|
||||||
@ -40,7 +49,7 @@ index a988400..412128c 100644
|
|||||||
ehdr.e_phoff);
|
ehdr.e_phoff);
|
||||||
#else
|
#else
|
||||||
if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
|
if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
|
||||||
@@ -5844,7 +5844,7 @@ shell_execve (command, args, env)
|
@@ -5970,7 +5970,7 @@ shell_execve (command, args, env)
|
||||||
Elf64_Ehdr ehdr;
|
Elf64_Ehdr ehdr;
|
||||||
Elf64_Phdr *phdr;
|
Elf64_Phdr *phdr;
|
||||||
Elf64_Shdr *shdr;
|
Elf64_Shdr *shdr;
|
||||||
@ -49,7 +58,7 @@ index a988400..412128c 100644
|
|||||||
|
|
||||||
/* We have to copy the data since the sample buffer
|
/* We have to copy the data since the sample buffer
|
||||||
might not be aligned correctly to be accessed as
|
might not be aligned correctly to be accessed as
|
||||||
@@ -5852,11 +5852,11 @@ shell_execve (command, args, env)
|
@@ -5978,11 +5978,11 @@ shell_execve (command, args, env)
|
||||||
memcpy (&ehdr, sample, sizeof (Elf64_Ehdr));
|
memcpy (&ehdr, sample, sizeof (Elf64_Ehdr));
|
||||||
|
|
||||||
nshdr = ehdr.e_shnum;
|
nshdr = ehdr.e_shnum;
|
||||||
@ -63,7 +72,7 @@ index a988400..412128c 100644
|
|||||||
ehdr.e_shoff);
|
ehdr.e_shoff);
|
||||||
#else
|
#else
|
||||||
if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
|
if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
|
||||||
@@ -5898,11 +5898,11 @@ shell_execve (command, args, env)
|
@@ -6024,11 +6024,11 @@ shell_execve (command, args, env)
|
||||||
}
|
}
|
||||||
|
|
||||||
nphdr = ehdr.e_phnum;
|
nphdr = ehdr.e_phnum;
|
||||||
@ -77,7 +86,7 @@ index a988400..412128c 100644
|
|||||||
ehdr.e_phoff);
|
ehdr.e_phoff);
|
||||||
#else
|
#else
|
||||||
if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
|
if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
|
||||||
@@ -5924,8 +5924,8 @@ shell_execve (command, args, env)
|
@@ -6050,8 +6050,8 @@ shell_execve (command, args, env)
|
||||||
|
|
||||||
if (offset != -1)
|
if (offset != -1)
|
||||||
{
|
{
|
||||||
@ -88,15 +97,16 @@ index a988400..412128c 100644
|
|||||||
char *interp = NULL;
|
char *interp = NULL;
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -5974,7 +5974,8 @@ shell_execve (command, args, env)
|
@@ -6100,7 +6100,8 @@ shell_execve (command, args, env)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)
|
#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)
|
||||||
- close (fd);
|
- close (fd);
|
||||||
+ if (fd >= 0)
|
+ if (fd >= 0)
|
||||||
+ close (fd);
|
+ close (fd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
errno = i;
|
errno = i;
|
||||||
--
|
--
|
||||||
2.17.2
|
2.23.0
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,25 @@
|
|||||||
diff -up bash-4.3/locale.c.old bash-4.3/locale.c
|
From 4ac4f17be40d74aa997ba7b4691496cdcc8a2e84 Mon Sep 17 00:00:00 2001
|
||||||
--- bash-4.3/locale.c.old 2015-07-15 11:55:00.002857301 +0200
|
From: liujian <liujianliu.liu@huawei.com>
|
||||||
+++ bash-4.3/locale.c 2015-07-15 11:48:36.698086257 +0200
|
Date: Mon, 31 May 2021 22:53:51 +0800
|
||||||
@@ -77,8 +77,6 @@ set_default_locale ()
|
Subject: [PATCH] bash-4.3-memleak-lc_all
|
||||||
|
|
||||||
|
---
|
||||||
|
locale.c | 2 --
|
||||||
|
1 file changed, 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/locale.c b/locale.c
|
||||||
|
index 17ccc58..a6c07a3 100644
|
||||||
|
--- a/locale.c
|
||||||
|
+++ b/locale.c
|
||||||
|
@@ -78,8 +78,6 @@ set_default_locale ()
|
||||||
{
|
{
|
||||||
#if defined (HAVE_SETLOCALE)
|
#if defined (HAVE_SETLOCALE)
|
||||||
default_locale = setlocale (LC_ALL, "");
|
default_locale = setlocale (LC_ALL, "");
|
||||||
- if (default_locale)
|
- if (default_locale)
|
||||||
- default_locale = savestring (default_locale);
|
- default_locale = savestring (default_locale);
|
||||||
|
#else
|
||||||
|
default_locale = savestring ("C");
|
||||||
#endif /* HAVE_SETLOCALE */
|
#endif /* HAVE_SETLOCALE */
|
||||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
--
|
||||||
textdomain (PACKAGE);
|
2.23.0
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,18 @@
|
|||||||
|
From 65aaa91a4785092fe5fb6a8d4596abc5aba0b6f9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: liujian <liujianliu.liu@huawei.com>
|
||||||
|
Date: Mon, 31 May 2021 22:52:29 +0800
|
||||||
|
Subject: [PATCH] bash-4.3-noecho
|
||||||
|
|
||||||
|
---
|
||||||
|
parse.y | 2 ++
|
||||||
|
subst.c | 5 +++++
|
||||||
|
2 files changed, 7 insertions(+)
|
||||||
|
|
||||||
diff --git a/parse.y b/parse.y
|
diff --git a/parse.y b/parse.y
|
||||||
index 07e6e3e..4cd373f 100644
|
index df1231d..2449fa8 100644
|
||||||
--- a/parse.y
|
--- a/parse.y
|
||||||
+++ b/parse.y
|
+++ b/parse.y
|
||||||
@@ -4410,6 +4410,8 @@ xparse_dolparen (base, string, indp, flags)
|
@@ -4482,6 +4482,8 @@ xparse_dolparen (base, string, indp, flags)
|
||||||
save_parser_state (&ps);
|
save_parser_state (&ps);
|
||||||
save_input_line_state (&ls);
|
save_input_line_state (&ls);
|
||||||
orig_eof_token = shell_eof_token;
|
orig_eof_token = shell_eof_token;
|
||||||
@ -12,18 +22,18 @@ index 07e6e3e..4cd373f 100644
|
|||||||
saved_pushed_strings = pushed_string_list; /* separate parsing context */
|
saved_pushed_strings = pushed_string_list; /* separate parsing context */
|
||||||
pushed_string_list = (STRING_SAVER *)NULL;
|
pushed_string_list = (STRING_SAVER *)NULL;
|
||||||
diff --git a/subst.c b/subst.c
|
diff --git a/subst.c b/subst.c
|
||||||
index 9559187..0c2caa6 100644
|
index 9ccbf33..8a9ee5c 100644
|
||||||
--- a/subst.c
|
--- a/subst.c
|
||||||
+++ b/subst.c
|
+++ b/subst.c
|
||||||
@@ -9145,6 +9145,7 @@ param_expand (string, sindex, quoted, expanded_something,
|
@@ -9453,6 +9453,7 @@ param_expand (string, sindex, quoted, expanded_something,
|
||||||
WORD_LIST *list;
|
WORD_LIST *list, *l;
|
||||||
WORD_DESC *tdesc, *ret;
|
WORD_DESC *tdesc, *ret;
|
||||||
int tflag;
|
int tflag, nullarg;
|
||||||
+ int old_echo_input;
|
+ int old_echo_input;
|
||||||
|
|
||||||
/*itrace("param_expand: `%s' pflags = %d", string+*sindex, pflags);*/
|
/*itrace("param_expand: `%s' pflags = %d", string+*sindex, pflags);*/
|
||||||
zindex = *sindex;
|
zindex = *sindex;
|
||||||
@@ -9514,6 +9515,9 @@ arithsub:
|
@@ -9843,6 +9844,9 @@ arithsub:
|
||||||
}
|
}
|
||||||
|
|
||||||
comsub:
|
comsub:
|
||||||
@ -33,7 +43,7 @@ index 9559187..0c2caa6 100644
|
|||||||
if (pflags & PF_NOCOMSUB)
|
if (pflags & PF_NOCOMSUB)
|
||||||
/* we need zindex+1 because string[zindex] == RPAREN */
|
/* we need zindex+1 because string[zindex] == RPAREN */
|
||||||
temp1 = substring (string, *sindex, zindex+1);
|
temp1 = substring (string, *sindex, zindex+1);
|
||||||
@@ -9526,6 +9530,7 @@ comsub:
|
@@ -9855,6 +9859,7 @@ comsub:
|
||||||
}
|
}
|
||||||
FREE (temp);
|
FREE (temp);
|
||||||
temp = temp1;
|
temp = temp1;
|
||||||
@ -42,4 +52,5 @@ index 9559187..0c2caa6 100644
|
|||||||
|
|
||||||
/* Do POSIX.2d9-style arithmetic substitution. This will probably go
|
/* Do POSIX.2d9-style arithmetic substitution. This will probably go
|
||||||
--
|
--
|
||||||
2.17.2
|
2.23.0
|
||||||
|
|
||||||
|
|||||||
@ -1,135 +0,0 @@
|
|||||||
diff --git a/bashline.c b/bashline.c
|
|
||||||
index 2846aab..75e79f1 100644
|
|
||||||
--- a/bashline.c
|
|
||||||
+++ b/bashline.c
|
|
||||||
@@ -231,6 +231,7 @@ static int bash_possible_variable_completions __P((int, int));
|
|
||||||
static int bash_complete_command __P((int, int));
|
|
||||||
static int bash_possible_command_completions __P((int, int));
|
|
||||||
|
|
||||||
+static int completion_glob_pattern __P((char *));
|
|
||||||
static char *glob_complete_word __P((const char *, int));
|
|
||||||
static int bash_glob_completion_internal __P((int));
|
|
||||||
static int bash_glob_complete_word __P((int, int));
|
|
||||||
@@ -1741,7 +1742,7 @@ bash_default_completion (text, start, end, qc, compflags)
|
|
||||||
|
|
||||||
/* This could be a globbing pattern, so try to expand it using pathname
|
|
||||||
expansion. */
|
|
||||||
- if (!matches && glob_pattern_p (text))
|
|
||||||
+ if (!matches && completion_glob_pattern ((char *)text))
|
|
||||||
{
|
|
||||||
matches = rl_completion_matches (text, glob_complete_word);
|
|
||||||
/* A glob expression that matches more than one filename is problematic.
|
|
||||||
@@ -1850,7 +1851,7 @@ command_word_completion_function (hint_text, state)
|
|
||||||
glob_matches = (char **)NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
- globpat = glob_pattern_p (hint_text);
|
|
||||||
+ globpat = completion_glob_pattern ((char *)hint_text);
|
|
||||||
|
|
||||||
/* If this is an absolute program name, do not check it against
|
|
||||||
aliases, reserved words, functions or builtins. We must check
|
|
||||||
@@ -3713,6 +3714,61 @@ bash_complete_command_internal (what_to_do)
|
|
||||||
return bash_specific_completion (what_to_do, command_word_completion_function);
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int
|
|
||||||
+completion_glob_pattern (string)
|
|
||||||
+ char *string;
|
|
||||||
+{
|
|
||||||
+ register int c;
|
|
||||||
+ char *send;
|
|
||||||
+ int open;
|
|
||||||
+
|
|
||||||
+ DECLARE_MBSTATE;
|
|
||||||
+
|
|
||||||
+ open = 0;
|
|
||||||
+ send = string + strlen (string);
|
|
||||||
+
|
|
||||||
+ while (c = *string++)
|
|
||||||
+ {
|
|
||||||
+ switch (c)
|
|
||||||
+ {
|
|
||||||
+ case '?':
|
|
||||||
+ case '*':
|
|
||||||
+ return (1);
|
|
||||||
+
|
|
||||||
+ case '[':
|
|
||||||
+ open++;
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ case ']':
|
|
||||||
+ if (open)
|
|
||||||
+ return (1);
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ case '+':
|
|
||||||
+ case '@':
|
|
||||||
+ case '!':
|
|
||||||
+ if (*string == '(') /*)*/
|
|
||||||
+ return (1);
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ case '\\':
|
|
||||||
+ if (*string == 0)
|
|
||||||
+ return (0);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Advance one fewer byte than an entire multibyte character to
|
|
||||||
+ account for the auto-increment in the loop above. */
|
|
||||||
+#ifdef HANDLE_MULTIBYTE
|
|
||||||
+ string--;
|
|
||||||
+ ADVANCE_CHAR_P (string, send - string);
|
|
||||||
+ string++;
|
|
||||||
+#else
|
|
||||||
+ ADVANCE_CHAR_P (string, send - string);
|
|
||||||
+#endif
|
|
||||||
+ }
|
|
||||||
+ return (0);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static char *globtext;
|
|
||||||
static char *globorig;
|
|
||||||
|
|
||||||
@@ -3877,7 +3933,7 @@ bash_vi_complete (count, key)
|
|
||||||
t = substring (rl_line_buffer, p, rl_point);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (t && glob_pattern_p (t) == 0)
|
|
||||||
+ if (t && completion_glob_pattern (t) == 0)
|
|
||||||
rl_explicit_arg = 1; /* XXX - force glob_complete_word to append `*' */
|
|
||||||
FREE (t);
|
|
||||||
|
|
||||||
diff --git a/lib/glob/glob_loop.c b/lib/glob/glob_loop.c
|
|
||||||
index 5f319cc..7d6ae21 100644
|
|
||||||
--- a/lib/glob/glob_loop.c
|
|
||||||
+++ b/lib/glob/glob_loop.c
|
|
||||||
@@ -54,17 +54,11 @@ INTERNAL_GLOB_PATTERN_P (pattern)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case L('\\'):
|
|
||||||
-#if 0
|
|
||||||
/* Don't let the pattern end in a backslash (GMATCH returns no match
|
|
||||||
if the pattern ends in a backslash anyway), but otherwise return 1,
|
|
||||||
since the matching engine uses backslash as an escape character
|
|
||||||
and it can be removed. */
|
|
||||||
return (*p != L('\0'));
|
|
||||||
-#else
|
|
||||||
- /* The pattern may not end with a backslash. */
|
|
||||||
- if (*p++ == L('\0'))
|
|
||||||
- return 0;
|
|
||||||
-#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 1cd7c96..40db1a3 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 0
|
|
||||||
+#define PATCHLEVEL 1
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
@ -1,101 +0,0 @@
|
|||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 02f1d60..8002af7 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 9
|
|
||||||
+#define PATCHLEVEL 10
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
diff --git a/tests/varenv.right b/tests/varenv.right
|
|
||||||
index 159a877..ca7d4cf 100644
|
|
||||||
--- a/tests/varenv.right
|
|
||||||
+++ b/tests/varenv.right
|
|
||||||
@@ -146,9 +146,9 @@ declare -x foo="abc"
|
|
||||||
inside: declare -x var="value"
|
|
||||||
outside: declare -- var="one"
|
|
||||||
inside: declare -x var="value"
|
|
||||||
-outside: declare -x var="value"
|
|
||||||
-inside: declare -- var="local"
|
|
||||||
-outside: declare -x var="global"
|
|
||||||
+outside: declare -- var="outside"
|
|
||||||
+inside: declare -x var="global"
|
|
||||||
+outside: declare -- var="outside"
|
|
||||||
foo=<unset> environment foo=
|
|
||||||
foo=foo environment foo=foo
|
|
||||||
foo=foo environment foo=foo
|
|
||||||
diff --git a/variables.c b/variables.c
|
|
||||||
index 610629a..af3fd04 100644
|
|
||||||
--- a/variables.c
|
|
||||||
+++ b/variables.c
|
|
||||||
@@ -4460,9 +4460,9 @@ char **tempvar_list;
|
|
||||||
int tvlist_ind;
|
|
||||||
|
|
||||||
/* Take a variable from an assignment statement preceding a posix special
|
|
||||||
- builtin (including `return') and create a global variable from it. This
|
|
||||||
- is called from merge_temporary_env, which is only called when in posix
|
|
||||||
- mode. */
|
|
||||||
+ builtin (including `return') and create a variable from it as if a
|
|
||||||
+ standalone assignment statement had been performed. This is called from
|
|
||||||
+ merge_temporary_env, which is only called when in posix mode. */
|
|
||||||
static void
|
|
||||||
push_posix_temp_var (data)
|
|
||||||
PTR_T data;
|
|
||||||
@@ -4472,16 +4472,27 @@ push_posix_temp_var (data)
|
|
||||||
|
|
||||||
var = (SHELL_VAR *)data;
|
|
||||||
|
|
||||||
- binding_table = global_variables->table;
|
|
||||||
- if (binding_table == 0)
|
|
||||||
- binding_table = global_variables->table = hash_create (VARIABLES_HASH_BUCKETS);
|
|
||||||
+ /* Just like do_assignment_internal(). This makes assignments preceding
|
|
||||||
+ special builtins act like standalone assignment statements when in
|
|
||||||
+ posix mode, satisfying the posix requirement that this affect the
|
|
||||||
+ "current execution environment." */
|
|
||||||
+ v = bind_variable (var->name, value_cell (var), ASS_FORCE|ASS_NOLONGJMP);
|
|
||||||
|
|
||||||
- v = bind_variable_internal (var->name, value_cell (var), binding_table, 0, ASS_FORCE|ASS_NOLONGJMP);
|
|
||||||
+ /* If this modifies an existing local variable, v->context will be non-zero.
|
|
||||||
+ If it comes back with v->context == 0, we bound at the global context.
|
|
||||||
+ Set binding_table appropriately. It doesn't matter whether it's correct
|
|
||||||
+ if the variable is local, only that it's not global_variables->table */
|
|
||||||
+ binding_table = v->context ? shell_variables->table : global_variables->table;
|
|
||||||
|
|
||||||
/* global variables are no longer temporary and don't need propagating. */
|
|
||||||
- var->attributes &= ~(att_tempvar|att_propagate);
|
|
||||||
+ if (binding_table == global_variables->table)
|
|
||||||
+ var->attributes &= ~(att_tempvar|att_propagate);
|
|
||||||
+
|
|
||||||
if (v)
|
|
||||||
- v->attributes |= var->attributes;
|
|
||||||
+ {
|
|
||||||
+ v->attributes |= var->attributes;
|
|
||||||
+ v->attributes &= ~att_tempvar; /* not a temp var now */
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (find_special_var (var->name) >= 0)
|
|
||||||
tempvar_list[tvlist_ind++] = savestring (var->name);
|
|
||||||
@@ -4575,14 +4586,17 @@ dispose_temporary_env (pushf)
|
|
||||||
sh_free_func_t *pushf;
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
+ HASH_TABLE *disposer;
|
|
||||||
|
|
||||||
tempvar_list = strvec_create (HASH_ENTRIES (temporary_env) + 1);
|
|
||||||
tempvar_list[tvlist_ind = 0] = 0;
|
|
||||||
-
|
|
||||||
- hash_flush (temporary_env, pushf);
|
|
||||||
- hash_dispose (temporary_env);
|
|
||||||
+
|
|
||||||
+ disposer = temporary_env;
|
|
||||||
temporary_env = (HASH_TABLE *)NULL;
|
|
||||||
|
|
||||||
+ hash_flush (disposer, pushf);
|
|
||||||
+ hash_dispose (disposer);
|
|
||||||
+
|
|
||||||
tempvar_list[tvlist_ind] = 0;
|
|
||||||
|
|
||||||
array_needs_making = 1;
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 8002af7..772676c 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 10
|
|
||||||
+#define PATCHLEVEL 11
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
diff --git a/subst.c b/subst.c
|
|
||||||
index 9559187..fd6db24 100644
|
|
||||||
--- a/subst.c
|
|
||||||
+++ b/subst.c
|
|
||||||
@@ -3625,7 +3625,9 @@ remove_backslashes (string)
|
|
||||||
this case, we quote the string specially for the globbing code. If
|
|
||||||
SPECIAL is 2, this is an rhs argument for the =~ operator, and should
|
|
||||||
be quoted appropriately for regcomp/regexec. The caller is responsible
|
|
||||||
- for removing the backslashes if the unquoted word is needed later. */
|
|
||||||
+ for removing the backslashes if the unquoted word is needed later. In
|
|
||||||
+ any case, since we don't perform word splitting, we need to do quoted
|
|
||||||
+ null character removal. */
|
|
||||||
char *
|
|
||||||
cond_expand_word (w, special)
|
|
||||||
WORD_DESC *w;
|
|
||||||
@@ -3646,6 +3648,8 @@ cond_expand_word (w, special)
|
|
||||||
{
|
|
||||||
if (special == 0) /* LHS */
|
|
||||||
{
|
|
||||||
+ if (l->word)
|
|
||||||
+ word_list_remove_quoted_nulls (l);
|
|
||||||
dequote_list (l);
|
|
||||||
r = string_list (l);
|
|
||||||
}
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
From b0852fb54efbcee630847fcfdc435133f82043b9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Chet Ramey <chet.ramey@case.edu>
|
|
||||||
Date: Fri, 7 Feb 2020 15:16:28 -0500
|
|
||||||
Subject: [PATCH 1/5] Bash-5.0 patch 12: fix problems moving back beyond start
|
|
||||||
of history
|
|
||||||
|
|
||||||
---
|
|
||||||
lib/readline/misc.c | 5 ++++-
|
|
||||||
patchlevel.h | 2 +-
|
|
||||||
2 files changed, 5 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/lib/readline/misc.c b/lib/readline/misc.c
|
|
||||||
index 64b1457..42005b0 100644
|
|
||||||
--- a/lib/readline/misc.c
|
|
||||||
+++ b/lib/readline/misc.c
|
|
||||||
@@ -576,6 +576,7 @@ int
|
|
||||||
rl_get_previous_history (int count, int key)
|
|
||||||
{
|
|
||||||
HIST_ENTRY *old_temp, *temp;
|
|
||||||
+ int had_saved_line;
|
|
||||||
|
|
||||||
if (count < 0)
|
|
||||||
return (rl_get_next_history (-count, key));
|
|
||||||
@@ -588,6 +589,7 @@ rl_get_previous_history (int count, int key)
|
|
||||||
_rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
|
|
||||||
|
|
||||||
/* If we don't have a line saved, then save this one. */
|
|
||||||
+ had_saved_line = _rl_saved_line_for_history != 0;
|
|
||||||
rl_maybe_save_line ();
|
|
||||||
|
|
||||||
/* If the current line has changed, save the changes. */
|
|
||||||
@@ -611,7 +613,8 @@ rl_get_previous_history (int count, int key)
|
|
||||||
|
|
||||||
if (temp == 0)
|
|
||||||
{
|
|
||||||
- rl_maybe_unsave_line ();
|
|
||||||
+ if (had_saved_line == 0)
|
|
||||||
+ _rl_free_saved_history_line ();
|
|
||||||
rl_ding ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 772676c..93dbe0d 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 11
|
|
||||||
+#define PATCHLEVEL 12
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
From f747f9ff4c8aed2d51fa54db3cb10e8118034753 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Chet Ramey <chet.ramey@case.edu>
|
|
||||||
Date: Fri, 7 Feb 2020 15:17:29 -0500
|
|
||||||
Subject: [PATCH 2/5] Bash-5.0 patch 13: reading history entries with
|
|
||||||
timestamps can result in joined entries
|
|
||||||
|
|
||||||
---
|
|
||||||
lib/readline/histfile.c | 15 ++++++++++++++-
|
|
||||||
patchlevel.h | 2 +-
|
|
||||||
2 files changed, 15 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/lib/readline/histfile.c b/lib/readline/histfile.c
|
|
||||||
index a8a92aa..6c3adc9 100644
|
|
||||||
--- a/lib/readline/histfile.c
|
|
||||||
+++ b/lib/readline/histfile.c
|
|
||||||
@@ -369,9 +369,11 @@ read_history_range (const char *filename, int from, int to)
|
|
||||||
}
|
|
||||||
|
|
||||||
has_timestamps = HIST_TIMESTAMP_START (buffer);
|
|
||||||
- history_multiline_entries += has_timestamps && history_write_timestamps;
|
|
||||||
+ history_multiline_entries += has_timestamps && history_write_timestamps;
|
|
||||||
|
|
||||||
/* Skip lines until we are at FROM. */
|
|
||||||
+ if (has_timestamps)
|
|
||||||
+ last_ts = buffer;
|
|
||||||
for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++)
|
|
||||||
if (*line_end == '\n')
|
|
||||||
{
|
|
||||||
@@ -380,7 +382,18 @@ read_history_range (const char *filename, int from, int to)
|
|
||||||
line. We should check more extensively here... */
|
|
||||||
if (HIST_TIMESTAMP_START(p) == 0)
|
|
||||||
current_line++;
|
|
||||||
+ else
|
|
||||||
+ last_ts = p;
|
|
||||||
line_start = p;
|
|
||||||
+ /* If we are at the last line (current_line == from) but we have
|
|
||||||
+ timestamps (has_timestamps), then line_start points to the
|
|
||||||
+ text of the last command, and we need to skip to its end. */
|
|
||||||
+ if (current_line >= from && has_timestamps)
|
|
||||||
+ {
|
|
||||||
+ for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++)
|
|
||||||
+ ;
|
|
||||||
+ line_start = (*line_end == '\n') ? line_end + 1 : line_end;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If there are lines left to gobble, then gobble them now. */
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 93dbe0d..779671c 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 12
|
|
||||||
+#define PATCHLEVEL 13
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
From 8b6524c482573ea12eb20be756cdb8ca31d945f3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Chet Ramey <chet.ramey@case.edu>
|
|
||||||
Date: Fri, 7 Feb 2020 15:18:41 -0500
|
|
||||||
Subject: [PATCH 3/5] Bash-5.0 patch 14: edit-and-execute-command does not
|
|
||||||
handle empty command lines
|
|
||||||
|
|
||||||
---
|
|
||||||
bashline.c | 7 ++-----
|
|
||||||
patchlevel.h | 2 +-
|
|
||||||
2 files changed, 3 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/bashline.c b/bashline.c
|
|
||||||
index 824ea9d..97adaa0 100644
|
|
||||||
--- a/bashline.c
|
|
||||||
+++ b/bashline.c
|
|
||||||
@@ -961,11 +961,8 @@ edit_and_execute_command (count, c, editing_mode, edit_command)
|
|
||||||
/* This breaks down when using command-oriented history and are not
|
|
||||||
finished with the command, so we should not ignore the last command */
|
|
||||||
using_history ();
|
|
||||||
- if (rl_line_buffer[0])
|
|
||||||
- {
|
|
||||||
- current_command_line_count++; /* for rl_newline above */
|
|
||||||
- bash_add_history (rl_line_buffer);
|
|
||||||
- }
|
|
||||||
+ current_command_line_count++; /* for rl_newline above */
|
|
||||||
+ bash_add_history (rl_line_buffer);
|
|
||||||
current_command_line_count = 0; /* for dummy history entry */
|
|
||||||
bash_add_history ("");
|
|
||||||
history_lines_this_session++;
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 779671c..09a3cc8 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 13
|
|
||||||
+#define PATCHLEVEL 14
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
From ad1b3e68229273b4983b607c5eeb56551536c583 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Chet Ramey <chet.ramey@case.edu>
|
|
||||||
Date: Fri, 7 Feb 2020 15:19:53 -0500
|
|
||||||
Subject: [PATCH 4/5] Bash-5.0 patch 15: aliases and -c commands can cause
|
|
||||||
premature termination
|
|
||||||
|
|
||||||
---
|
|
||||||
builtins/evalstring.c | 6 ++++--
|
|
||||||
patchlevel.h | 2 +-
|
|
||||||
2 files changed, 5 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/builtins/evalstring.c b/builtins/evalstring.c
|
|
||||||
index cadc9bc..2f13a66 100644
|
|
||||||
--- a/builtins/evalstring.c
|
|
||||||
+++ b/builtins/evalstring.c
|
|
||||||
@@ -91,6 +91,7 @@ should_suppress_fork (command)
|
|
||||||
return (startup_state == 2 && parse_and_execute_level == 1 &&
|
|
||||||
running_trap == 0 &&
|
|
||||||
*bash_input.location.string == '\0' &&
|
|
||||||
+ parser_expanding_alias () == 0 &&
|
|
||||||
command->type == cm_simple &&
|
|
||||||
signal_is_trapped (EXIT_TRAP) == 0 &&
|
|
||||||
signal_is_trapped (ERROR_TRAP) == 0 &&
|
|
||||||
@@ -105,6 +106,7 @@ can_optimize_connection (command)
|
|
||||||
COMMAND *command;
|
|
||||||
{
|
|
||||||
return (*bash_input.location.string == '\0' &&
|
|
||||||
+ parser_expanding_alias () == 0 &&
|
|
||||||
(command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
|
|
||||||
command->value.Connection->second->type == cm_simple);
|
|
||||||
}
|
|
||||||
@@ -290,7 +292,7 @@ parse_and_execute (string, from_file, flags)
|
|
||||||
|
|
||||||
with_input_from_string (string, from_file);
|
|
||||||
clear_shell_input_line ();
|
|
||||||
- while (*(bash_input.location.string))
|
|
||||||
+ while (*(bash_input.location.string) || parser_expanding_alias ())
|
|
||||||
{
|
|
||||||
command = (COMMAND *)NULL;
|
|
||||||
|
|
||||||
@@ -545,7 +547,7 @@ parse_string (string, from_file, flags, endp)
|
|
||||||
ostring = string;
|
|
||||||
|
|
||||||
with_input_from_string (string, from_file);
|
|
||||||
- while (*(bash_input.location.string))
|
|
||||||
+ while (*(bash_input.location.string)) /* XXX - parser_expanding_alias () ? */
|
|
||||||
{
|
|
||||||
command = (COMMAND *)NULL;
|
|
||||||
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 09a3cc8..6e9ed3f 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 14
|
|
||||||
+#define PATCHLEVEL 15
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
From 6c6454cb18d7cd30b3b26d5ba6479431e599f3ed Mon Sep 17 00:00:00 2001
|
|
||||||
From: Chet Ramey <chet.ramey@case.edu>
|
|
||||||
Date: Fri, 7 Feb 2020 15:20:38 -0500
|
|
||||||
Subject: [PATCH 5/5] Bash-5.0 patch 16: bash waits too long to reap /dev/fd
|
|
||||||
process substitutions with loops and group commands
|
|
||||||
|
|
||||||
---
|
|
||||||
execute_cmd.c | 16 ++++++++++++++++
|
|
||||||
patchlevel.h | 2 +-
|
|
||||||
2 files changed, 17 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/execute_cmd.c b/execute_cmd.c
|
|
||||||
index f1d74bf..3864986 100644
|
|
||||||
--- a/execute_cmd.c
|
|
||||||
+++ b/execute_cmd.c
|
|
||||||
@@ -1103,6 +1103,22 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
|
||||||
free ((void *)ofifo_list);
|
|
||||||
discard_unwind_frame ("internal_fifos");
|
|
||||||
}
|
|
||||||
+# if defined (HAVE_DEV_FD)
|
|
||||||
+ /* Reap process substitutions at the end of loops */
|
|
||||||
+ switch (command->type)
|
|
||||||
+ {
|
|
||||||
+ case cm_while:
|
|
||||||
+ case cm_until:
|
|
||||||
+ case cm_for:
|
|
||||||
+ case cm_group:
|
|
||||||
+# if defined (ARITH_FOR_COMMAND)
|
|
||||||
+ case cm_arith_for:
|
|
||||||
+# endif
|
|
||||||
+ reap_procsubs ();
|
|
||||||
+ default:
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+# endif /* HAVE_DEV_FD */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Invert the return value if we have to */
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 6e9ed3f..9074f4d 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 15
|
|
||||||
+#define PATCHLEVEL 16
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
@ -1,213 +0,0 @@
|
|||||||
From 9e49d343e3cd7e20dad1b86ebfb764e8027596a7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Chet Ramey <chet.ramey@case.edu>
|
|
||||||
Date: Fri, 24 Apr 2020 11:05:06 -0400
|
|
||||||
Subject: [PATCH] Bash-5.0 patch 17: better fix for reaping process
|
|
||||||
substitution file descriptors
|
|
||||||
|
|
||||||
---
|
|
||||||
execute_cmd.c | 26 ++++++--------------------
|
|
||||||
patchlevel.h | 2 +-
|
|
||||||
subst.c | 35 +++++++++++++++++++++--------------
|
|
||||||
subst.h | 5 ++---
|
|
||||||
4 files changed, 30 insertions(+), 38 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/execute_cmd.c b/execute_cmd.c
|
|
||||||
index 3864986d..4a05758d 100644
|
|
||||||
--- a/execute_cmd.c
|
|
||||||
+++ b/execute_cmd.c
|
|
||||||
@@ -564,7 +564,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
|
||||||
volatile int save_line_number;
|
|
||||||
#if defined (PROCESS_SUBSTITUTION)
|
|
||||||
volatile int ofifo, nfifo, osize, saved_fifo;
|
|
||||||
- volatile char *ofifo_list;
|
|
||||||
+ volatile void *ofifo_list;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (breaking || continuing)
|
|
||||||
@@ -750,12 +750,14 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
|
||||||
reap_procsubs ();
|
|
||||||
# endif
|
|
||||||
|
|
||||||
- if (variable_context != 0) /* XXX - also if sourcelevel != 0? */
|
|
||||||
+ /* XXX - also if sourcelevel != 0? */
|
|
||||||
+ if (variable_context != 0)
|
|
||||||
{
|
|
||||||
ofifo = num_fifos ();
|
|
||||||
ofifo_list = copy_fifo_list ((int *)&osize);
|
|
||||||
begin_unwind_frame ("internal_fifos");
|
|
||||||
- add_unwind_protect (xfree, ofifo_list);
|
|
||||||
+ if (ofifo_list)
|
|
||||||
+ add_unwind_protect (xfree, ofifo_list);
|
|
||||||
saved_fifo = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
@@ -1099,26 +1101,10 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
|
||||||
{
|
|
||||||
nfifo = num_fifos ();
|
|
||||||
if (nfifo > ofifo)
|
|
||||||
- close_new_fifos ((char *)ofifo_list, osize);
|
|
||||||
+ close_new_fifos ((void *)ofifo_list, osize);
|
|
||||||
free ((void *)ofifo_list);
|
|
||||||
discard_unwind_frame ("internal_fifos");
|
|
||||||
}
|
|
||||||
-# if defined (HAVE_DEV_FD)
|
|
||||||
- /* Reap process substitutions at the end of loops */
|
|
||||||
- switch (command->type)
|
|
||||||
- {
|
|
||||||
- case cm_while:
|
|
||||||
- case cm_until:
|
|
||||||
- case cm_for:
|
|
||||||
- case cm_group:
|
|
||||||
-# if defined (ARITH_FOR_COMMAND)
|
|
||||||
- case cm_arith_for:
|
|
||||||
-# endif
|
|
||||||
- reap_procsubs ();
|
|
||||||
- default:
|
|
||||||
- break;
|
|
||||||
- }
|
|
||||||
-# endif /* HAVE_DEV_FD */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Invert the return value if we have to */
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 9074f4dd..98e714da 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 16
|
|
||||||
+#define PATCHLEVEL 17
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
diff --git a/subst.c b/subst.c
|
|
||||||
index fd6db240..8884b487 100644
|
|
||||||
--- a/subst.c
|
|
||||||
+++ b/subst.c
|
|
||||||
@@ -5336,13 +5336,13 @@ clear_fifo_list ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
-char *
|
|
||||||
+void *
|
|
||||||
copy_fifo_list (sizep)
|
|
||||||
int *sizep;
|
|
||||||
{
|
|
||||||
if (sizep)
|
|
||||||
*sizep = 0;
|
|
||||||
- return (char *)NULL;
|
|
||||||
+ return (void *)NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
@@ -5408,8 +5408,13 @@ unlink_fifo_list ()
|
|
||||||
for (i = j = 0; i < nfifo; i++)
|
|
||||||
if (fifo_list[i].file)
|
|
||||||
{
|
|
||||||
- fifo_list[j].file = fifo_list[i].file;
|
|
||||||
- fifo_list[j].proc = fifo_list[i].proc;
|
|
||||||
+ if (i != j)
|
|
||||||
+ {
|
|
||||||
+ fifo_list[j].file = fifo_list[i].file;
|
|
||||||
+ fifo_list[j].proc = fifo_list[i].proc;
|
|
||||||
+ fifo_list[i].file = (char *)NULL;
|
|
||||||
+ fifo_list[i].proc = 0;
|
|
||||||
+ }
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
nfifo = j;
|
|
||||||
@@ -5425,10 +5430,11 @@ unlink_fifo_list ()
|
|
||||||
case it's larger than fifo_list_size (size of fifo_list). */
|
|
||||||
void
|
|
||||||
close_new_fifos (list, lsize)
|
|
||||||
- char *list;
|
|
||||||
+ void *list;
|
|
||||||
int lsize;
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
+ char *plist;
|
|
||||||
|
|
||||||
if (list == 0)
|
|
||||||
{
|
|
||||||
@@ -5436,8 +5442,8 @@ close_new_fifos (list, lsize)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- for (i = 0; i < lsize; i++)
|
|
||||||
- if (list[i] == 0 && i < fifo_list_size && fifo_list[i].proc != -1)
|
|
||||||
+ for (plist = (char *)list, i = 0; i < lsize; i++)
|
|
||||||
+ if (plist[i] == 0 && i < fifo_list_size && fifo_list[i].proc != -1)
|
|
||||||
unlink_fifo (i);
|
|
||||||
|
|
||||||
for (i = lsize; i < fifo_list_size; i++)
|
|
||||||
@@ -5559,22 +5565,22 @@ clear_fifo_list ()
|
|
||||||
nfds = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
-char *
|
|
||||||
+void *
|
|
||||||
copy_fifo_list (sizep)
|
|
||||||
int *sizep;
|
|
||||||
{
|
|
||||||
- char *ret;
|
|
||||||
+ void *ret;
|
|
||||||
|
|
||||||
if (nfds == 0 || totfds == 0)
|
|
||||||
{
|
|
||||||
if (sizep)
|
|
||||||
*sizep = 0;
|
|
||||||
- return (char *)NULL;
|
|
||||||
+ return (void *)NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sizep)
|
|
||||||
*sizep = totfds;
|
|
||||||
- ret = (char *)xmalloc (totfds * sizeof (pid_t));
|
|
||||||
+ ret = xmalloc (totfds * sizeof (pid_t));
|
|
||||||
return (memcpy (ret, dev_fd_list, totfds * sizeof (pid_t)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -5647,10 +5653,11 @@ unlink_fifo_list ()
|
|
||||||
totfds (size of dev_fd_list). */
|
|
||||||
void
|
|
||||||
close_new_fifos (list, lsize)
|
|
||||||
- char *list;
|
|
||||||
+ void *list;
|
|
||||||
int lsize;
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
+ pid_t *plist;
|
|
||||||
|
|
||||||
if (list == 0)
|
|
||||||
{
|
|
||||||
@@ -5658,8 +5665,8 @@ close_new_fifos (list, lsize)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- for (i = 0; i < lsize; i++)
|
|
||||||
- if (list[i] == 0 && i < totfds && dev_fd_list[i])
|
|
||||||
+ for (plist = (pid_t *)list, i = 0; i < lsize; i++)
|
|
||||||
+ if (plist[i] == 0 && i < totfds && dev_fd_list[i])
|
|
||||||
unlink_fifo (i);
|
|
||||||
|
|
||||||
for (i = lsize; i < totfds; i++)
|
|
||||||
diff --git a/subst.h b/subst.h
|
|
||||||
index 34763222..faf831bd 100644
|
|
||||||
--- a/subst.h
|
|
||||||
+++ b/subst.h
|
|
||||||
@@ -273,9 +273,8 @@ extern int num_fifos __P((void));
|
|
||||||
extern void unlink_fifo_list __P((void));
|
|
||||||
extern void unlink_fifo __P((int));
|
|
||||||
|
|
||||||
-extern char *copy_fifo_list __P((int *));
|
|
||||||
-extern void unlink_new_fifos __P((char *, int));
|
|
||||||
-extern void close_new_fifos __P((char *, int));
|
|
||||||
+extern void *copy_fifo_list __P((int *));
|
|
||||||
+extern void close_new_fifos __P((void *, int));
|
|
||||||
|
|
||||||
extern void clear_fifo_list __P((void));
|
|
||||||
|
|
||||||
--
|
|
||||||
2.26.2.windows.1
|
|
||||||
|
|
||||||
@ -1,80 +0,0 @@
|
|||||||
diff --git a/parse.y b/parse.y
|
|
||||||
index 3ff87bc..07e6e3e 100644
|
|
||||||
--- a/parse.y
|
|
||||||
+++ b/parse.y
|
|
||||||
@@ -2557,12 +2557,14 @@ next_alias_char:
|
|
||||||
if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE &&
|
|
||||||
pushed_string_list->flags != PSH_DPAREN &&
|
|
||||||
(parser_state & PST_COMMENT) == 0 &&
|
|
||||||
+ (parser_state & PST_ENDALIAS) == 0 && /* only once */
|
|
||||||
shell_input_line_index > 0 &&
|
|
||||||
- shell_input_line[shell_input_line_index-1] != ' ' &&
|
|
||||||
+ shellblank (shell_input_line[shell_input_line_index-1]) == 0 &&
|
|
||||||
shell_input_line[shell_input_line_index-1] != '\n' &&
|
|
||||||
shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
|
|
||||||
(current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
|
|
||||||
{
|
|
||||||
+ parser_state |= PST_ENDALIAS;
|
|
||||||
return ' '; /* END_ALIAS */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -2571,6 +2573,7 @@ pop_alias:
|
|
||||||
/* This case works for PSH_DPAREN as well */
|
|
||||||
if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
|
|
||||||
{
|
|
||||||
+ parser_state &= ~PST_ENDALIAS;
|
|
||||||
pop_string ();
|
|
||||||
uc = shell_input_line[shell_input_line_index];
|
|
||||||
if (uc)
|
|
||||||
diff --git a/parser.h b/parser.h
|
|
||||||
index 54dd2c8..6d08915 100644
|
|
||||||
--- a/parser.h
|
|
||||||
+++ b/parser.h
|
|
||||||
@@ -47,6 +47,7 @@
|
|
||||||
#define PST_REPARSE 0x040000 /* re-parsing in parse_string_to_word_list */
|
|
||||||
#define PST_REDIRLIST 0x080000 /* parsing a list of redirections preceding a simple command name */
|
|
||||||
#define PST_COMMENT 0x100000 /* parsing a shell comment; used by aliases */
|
|
||||||
+#define PST_ENDALIAS 0x200000 /* just finished expanding and consuming an alias */
|
|
||||||
|
|
||||||
/* Definition of the delimiter stack. Needed by parse.y and bashhist.c. */
|
|
||||||
struct dstack {
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 40db1a3..a988d85 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 1
|
|
||||||
+#define PATCHLEVEL 2
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
diff --git a/y.tab.c b/y.tab.c
|
|
||||||
index 1abe2c5..7efce3c 100644
|
|
||||||
--- a/y.tab.c
|
|
||||||
+++ b/y.tab.c
|
|
||||||
@@ -4873,12 +4873,14 @@ next_alias_char:
|
|
||||||
if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE &&
|
|
||||||
pushed_string_list->flags != PSH_DPAREN &&
|
|
||||||
(parser_state & PST_COMMENT) == 0 &&
|
|
||||||
+ (parser_state & PST_ENDALIAS) == 0 && /* only once */
|
|
||||||
shell_input_line_index > 0 &&
|
|
||||||
- shell_input_line[shell_input_line_index-1] != ' ' &&
|
|
||||||
+ shellblank (shell_input_line[shell_input_line_index-1]) == 0 &&
|
|
||||||
shell_input_line[shell_input_line_index-1] != '\n' &&
|
|
||||||
shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
|
|
||||||
(current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
|
|
||||||
{
|
|
||||||
+ parser_state |= PST_ENDALIAS;
|
|
||||||
return ' '; /* END_ALIAS */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -4887,6 +4889,7 @@ pop_alias:
|
|
||||||
/* This case works for PSH_DPAREN as well */
|
|
||||||
if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
|
|
||||||
{
|
|
||||||
+ parser_state &= ~PST_ENDALIAS;
|
|
||||||
pop_string ();
|
|
||||||
uc = shell_input_line[shell_input_line_index];
|
|
||||||
if (uc)
|
|
||||||
@ -1,185 +0,0 @@
|
|||||||
idiff --git a/bashline.c b/bashline.c
|
|
||||||
index 75e79f1..824ea9d 100644
|
|
||||||
--- a/bashline.c
|
|
||||||
+++ b/bashline.c
|
|
||||||
@@ -3752,7 +3752,7 @@ completion_glob_pattern (string)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case '\\':
|
|
||||||
- if (*string == 0)
|
|
||||||
+ if (*string++ == 0)
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/lib/glob/glob.c b/lib/glob/glob.c
|
|
||||||
index 22d90a5..398253b 100644
|
|
||||||
--- a/lib/glob/glob.c
|
|
||||||
+++ b/lib/glob/glob.c
|
|
||||||
@@ -1061,7 +1061,7 @@ glob_filename (pathname, flags)
|
|
||||||
char *directory_name, *filename, *dname, *fn;
|
|
||||||
unsigned int directory_len;
|
|
||||||
int free_dirname; /* flag */
|
|
||||||
- int dflags;
|
|
||||||
+ int dflags, hasglob;
|
|
||||||
|
|
||||||
result = (char **) malloc (sizeof (char *));
|
|
||||||
result_size = 1;
|
|
||||||
@@ -1110,9 +1110,12 @@ glob_filename (pathname, flags)
|
|
||||||
free_dirname = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ hasglob = 0;
|
|
||||||
/* If directory_name contains globbing characters, then we
|
|
||||||
- have to expand the previous levels. Just recurse. */
|
|
||||||
- if (directory_len > 0 && glob_pattern_p (directory_name))
|
|
||||||
+ have to expand the previous levels. Just recurse.
|
|
||||||
+ If glob_pattern_p returns != [0,1] we have a pattern that has backslash
|
|
||||||
+ quotes but no unquoted glob pattern characters. We dequote it below. */
|
|
||||||
+ if (directory_len > 0 && (hasglob = glob_pattern_p (directory_name)) == 1)
|
|
||||||
{
|
|
||||||
char **directories, *d, *p;
|
|
||||||
register unsigned int i;
|
|
||||||
@@ -1175,7 +1178,7 @@ glob_filename (pathname, flags)
|
|
||||||
if (d[directory_len - 1] == '/')
|
|
||||||
d[directory_len - 1] = '\0';
|
|
||||||
|
|
||||||
- directories = glob_filename (d, dflags);
|
|
||||||
+ directories = glob_filename (d, dflags|GX_RECURSE);
|
|
||||||
|
|
||||||
if (free_dirname)
|
|
||||||
{
|
|
||||||
@@ -1332,6 +1335,20 @@ only_filename:
|
|
||||||
free (directory_name);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
+ /* If we have a directory name with quoted characters, and we are
|
|
||||||
+ being called recursively to glob the directory portion of a pathname,
|
|
||||||
+ we need to dequote the directory name before returning it so the
|
|
||||||
+ caller can read the directory */
|
|
||||||
+ if (directory_len > 0 && hasglob == 2 && (flags & GX_RECURSE) != 0)
|
|
||||||
+ {
|
|
||||||
+ dequote_pathname (directory_name);
|
|
||||||
+ directory_len = strlen (directory_name);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* We could check whether or not the dequoted directory_name is a
|
|
||||||
+ directory and return it here, returning the original directory_name
|
|
||||||
+ if not, but we don't do that yet. I'm not sure it matters. */
|
|
||||||
+
|
|
||||||
/* Handle GX_MARKDIRS here. */
|
|
||||||
result[0] = (char *) malloc (directory_len + 1);
|
|
||||||
if (result[0] == NULL)
|
|
||||||
diff --git a/lib/glob/glob.h b/lib/glob/glob.h
|
|
||||||
index b946233..56ac08b 100644
|
|
||||||
--- a/lib/glob/glob.h
|
|
||||||
+++ b/lib/glob/glob.h
|
|
||||||
@@ -30,6 +30,7 @@
|
|
||||||
#define GX_NULLDIR 0x100 /* internal -- no directory preceding pattern */
|
|
||||||
#define GX_ADDCURDIR 0x200 /* internal -- add passed directory name */
|
|
||||||
#define GX_GLOBSTAR 0x400 /* turn on special handling of ** */
|
|
||||||
+#define GX_RECURSE 0x800 /* internal -- glob_filename called recursively */
|
|
||||||
|
|
||||||
extern int glob_pattern_p __P((const char *));
|
|
||||||
extern char **glob_vector __P((char *, char *, int));
|
|
||||||
diff --git a/lib/glob/glob_loop.c b/lib/glob/glob_loop.c
|
|
||||||
index 7d6ae21..3a4f4f1 100644
|
|
||||||
--- a/lib/glob/glob_loop.c
|
|
||||||
+++ b/lib/glob/glob_loop.c
|
|
||||||
@@ -26,10 +26,10 @@ INTERNAL_GLOB_PATTERN_P (pattern)
|
|
||||||
{
|
|
||||||
register const GCHAR *p;
|
|
||||||
register GCHAR c;
|
|
||||||
- int bopen;
|
|
||||||
+ int bopen, bsquote;
|
|
||||||
|
|
||||||
p = pattern;
|
|
||||||
- bopen = 0;
|
|
||||||
+ bopen = bsquote = 0;
|
|
||||||
|
|
||||||
while ((c = *p++) != L('\0'))
|
|
||||||
switch (c)
|
|
||||||
@@ -55,13 +55,22 @@ INTERNAL_GLOB_PATTERN_P (pattern)
|
|
||||||
|
|
||||||
case L('\\'):
|
|
||||||
/* Don't let the pattern end in a backslash (GMATCH returns no match
|
|
||||||
- if the pattern ends in a backslash anyway), but otherwise return 1,
|
|
||||||
- since the matching engine uses backslash as an escape character
|
|
||||||
- and it can be removed. */
|
|
||||||
- return (*p != L('\0'));
|
|
||||||
+ if the pattern ends in a backslash anyway), but otherwise note that
|
|
||||||
+ we have seen this, since the matching engine uses backslash as an
|
|
||||||
+ escape character and it can be removed. We return 2 later if we
|
|
||||||
+ have seen only backslash-escaped characters, so interested callers
|
|
||||||
+ know they can shortcut and just dequote the pathname. */
|
|
||||||
+ if (*p != L('\0'))
|
|
||||||
+ {
|
|
||||||
+ p++;
|
|
||||||
+ bsquote = 1;
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ else /* (*p == L('\0')) */
|
|
||||||
+ return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- return 0;
|
|
||||||
+ return bsquote ? 2 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef INTERNAL_GLOB_PATTERN_P
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index a988d85..e7e960c 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 2
|
|
||||||
+#define PATCHLEVEL 3
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
diff --git a/pathexp.c b/pathexp.c
|
|
||||||
index b51729a..c1bf2d8 100644
|
|
||||||
--- a/pathexp.c
|
|
||||||
+++ b/pathexp.c
|
|
||||||
@@ -65,11 +65,11 @@ unquoted_glob_pattern_p (string)
|
|
||||||
{
|
|
||||||
register int c;
|
|
||||||
char *send;
|
|
||||||
- int open;
|
|
||||||
+ int open, bsquote;
|
|
||||||
|
|
||||||
DECLARE_MBSTATE;
|
|
||||||
|
|
||||||
- open = 0;
|
|
||||||
+ open = bsquote = 0;
|
|
||||||
send = string + strlen (string);
|
|
||||||
|
|
||||||
while (c = *string++)
|
|
||||||
@@ -100,7 +100,14 @@ unquoted_glob_pattern_p (string)
|
|
||||||
can be removed by the matching engine, so we have to run it through
|
|
||||||
globbing. */
|
|
||||||
case '\\':
|
|
||||||
- return (*string != 0);
|
|
||||||
+ if (*string != '\0' && *string != '/')
|
|
||||||
+ {
|
|
||||||
+ bsquote = 1;
|
|
||||||
+ string++;
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ else if (*string == 0)
|
|
||||||
+ return (0);
|
|
||||||
|
|
||||||
case CTLESC:
|
|
||||||
if (*string++ == '\0')
|
|
||||||
@@ -117,7 +124,8 @@ unquoted_glob_pattern_p (string)
|
|
||||||
ADVANCE_CHAR_P (string, send - string);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
- return (0);
|
|
||||||
+
|
|
||||||
+ return (bsquote ? 2 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return 1 if C is a character that is `special' in a POSIX ERE and needs to
|
|
||||||
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
diff --git a/jobs.c b/jobs.c
|
|
||||||
index ce2bdf2..ae3c54c 100644
|
|
||||||
--- a/jobs.c
|
|
||||||
+++ b/jobs.c
|
|
||||||
@@ -2488,10 +2488,8 @@ wait_for_background_pids ()
|
|
||||||
r = wait_for (last_procsub_child->pid);
|
|
||||||
wait_procsubs ();
|
|
||||||
reap_procsubs ();
|
|
||||||
-#if 1
|
|
||||||
+#if 0
|
|
||||||
/* We don't want to wait indefinitely if we have stopped children. */
|
|
||||||
- /* XXX - should add a loop that goes through the list of process
|
|
||||||
- substitutions and waits for each proc in turn before this code. */
|
|
||||||
if (any_stopped == 0)
|
|
||||||
{
|
|
||||||
/* Check whether or not we have any unreaped children. */
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index e7e960c..c059f0b 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 3
|
|
||||||
+#define PATCHLEVEL 4
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
diff --git a/builtins/evalstring.c b/builtins/evalstring.c
|
|
||||||
index 1496eee..cadc9bc 100644
|
|
||||||
--- a/builtins/evalstring.c
|
|
||||||
+++ b/builtins/evalstring.c
|
|
||||||
@@ -100,12 +100,22 @@ should_suppress_fork (command)
|
|
||||||
((command->flags & CMD_INVERT_RETURN) == 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
+int
|
|
||||||
+can_optimize_connection (command)
|
|
||||||
+ COMMAND *command;
|
|
||||||
+{
|
|
||||||
+ return (*bash_input.location.string == '\0' &&
|
|
||||||
+ (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
|
|
||||||
+ command->value.Connection->second->type == cm_simple);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
optimize_fork (command)
|
|
||||||
COMMAND *command;
|
|
||||||
{
|
|
||||||
if (command->type == cm_connection &&
|
|
||||||
- (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR) &&
|
|
||||||
+ (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
|
|
||||||
+ (command->value.Connection->second->flags & CMD_TRY_OPTIMIZING) &&
|
|
||||||
should_suppress_fork (command->value.Connection->second))
|
|
||||||
{
|
|
||||||
command->value.Connection->second->flags |= CMD_NO_FORK;
|
|
||||||
@@ -412,8 +422,18 @@ parse_and_execute (string, from_file, flags)
|
|
||||||
command->flags |= CMD_NO_FORK;
|
|
||||||
command->value.Simple->flags |= CMD_NO_FORK;
|
|
||||||
}
|
|
||||||
- else if (command->type == cm_connection)
|
|
||||||
- optimize_fork (command);
|
|
||||||
+
|
|
||||||
+ /* Can't optimize forks out here execept for simple commands.
|
|
||||||
+ This knows that the parser sets up commands as left-side heavy
|
|
||||||
+ (&& and || are left-associative) and after the single parse,
|
|
||||||
+ if we are at the end of the command string, the last in a
|
|
||||||
+ series of connection commands is
|
|
||||||
+ command->value.Connection->second. */
|
|
||||||
+ else if (command->type == cm_connection && can_optimize_connection (command))
|
|
||||||
+ {
|
|
||||||
+ command->value.Connection->second->flags |= CMD_TRY_OPTIMIZING;
|
|
||||||
+ command->value.Connection->second->value.Simple->flags |= CMD_TRY_OPTIMIZING;
|
|
||||||
+ }
|
|
||||||
#endif /* ONESHOT */
|
|
||||||
|
|
||||||
/* See if this is a candidate for $( <file ). */
|
|
||||||
diff --git a/command.h b/command.h
|
|
||||||
index 3249516..b9e9b66 100644
|
|
||||||
--- a/command.h
|
|
||||||
+++ b/command.h
|
|
||||||
@@ -186,6 +186,7 @@ typedef struct element {
|
|
||||||
#define CMD_COPROC_SUBSHELL 0x1000
|
|
||||||
#define CMD_LASTPIPE 0x2000
|
|
||||||
#define CMD_STDPATH 0x4000 /* use standard path for command lookup */
|
|
||||||
+#define CMD_TRY_OPTIMIZING 0x8000 /* try to optimize this simple command */
|
|
||||||
|
|
||||||
/* What a command looks like. */
|
|
||||||
typedef struct command {
|
|
||||||
diff --git a/execute_cmd.c b/execute_cmd.c
|
|
||||||
index 8b3c83a..f1d74bf 100644
|
|
||||||
--- a/execute_cmd.c
|
|
||||||
+++ b/execute_cmd.c
|
|
||||||
@@ -2767,6 +2767,8 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close)
|
|
||||||
((command->value.Connection->connector == OR_OR) &&
|
|
||||||
(exec_result != EXECUTION_SUCCESS)))
|
|
||||||
{
|
|
||||||
+ optimize_fork (command);
|
|
||||||
+
|
|
||||||
second = command->value.Connection->second;
|
|
||||||
if (ignore_return && second)
|
|
||||||
second->flags |= CMD_IGNORE_RETURN;
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index c059f0b..1bc098b 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 4
|
|
||||||
+#define PATCHLEVEL 5
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
diff --git a/builtins/shopt.def b/builtins/shopt.def
|
|
||||||
index f6dc6f9..1c48536 100644
|
|
||||||
--- a/builtins/shopt.def
|
|
||||||
+++ b/builtins/shopt.def
|
|
||||||
@@ -122,7 +122,7 @@ extern int assoc_expand_once;
|
|
||||||
extern int array_expand_once;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#if defined (SYSLOG_HISTORY) && defined (SYSLOG_SHOPT)
|
|
||||||
+#if defined (SYSLOG_HISTORY)
|
|
||||||
extern int syslog_history;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 1bc098b..14bff9f 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 5
|
|
||||||
+#define PATCHLEVEL 6
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
idiff --git a/jobs.c b/jobs.c
|
|
||||||
index ae3c54c..6bc31dc 100644
|
|
||||||
--- a/jobs.c
|
|
||||||
+++ b/jobs.c
|
|
||||||
@@ -4837,15 +4837,13 @@ void
|
|
||||||
end_job_control ()
|
|
||||||
{
|
|
||||||
if (job_control)
|
|
||||||
- {
|
|
||||||
- terminate_stopped_jobs ();
|
|
||||||
+ terminate_stopped_jobs ();
|
|
||||||
|
|
||||||
- if (original_pgrp >= 0)
|
|
||||||
- give_terminal_to (original_pgrp, 1);
|
|
||||||
- }
|
|
||||||
+ if (original_pgrp >= 0 && terminal_pgrp != original_pgrp)
|
|
||||||
+ give_terminal_to (original_pgrp, 1);
|
|
||||||
|
|
||||||
- if (original_pgrp >= 0)
|
|
||||||
- setpgid (0, original_pgrp);
|
|
||||||
+ if (original_pgrp >= 0 && setpgid (0, original_pgrp) == 0)
|
|
||||||
+ shell_pgrp = original_pgrp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Restart job control by closing shell tty and reinitializing. This is
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 14bff9f..deb9c5b 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 6
|
|
||||||
+#define PATCHLEVEL 7
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
diff --git a/bashhist.c b/bashhist.c
|
|
||||||
index 7912cce..d2155dc 100644
|
|
||||||
--- a/bashhist.c
|
|
||||||
+++ b/bashhist.c
|
|
||||||
@@ -560,15 +560,18 @@ pre_process_line (line, print_changes, addit)
|
|
||||||
add that line to the history if ADDIT is non-zero. */
|
|
||||||
if (!history_expansion_inhibited && history_expansion && history_expansion_p (line))
|
|
||||||
{
|
|
||||||
+ int old_len;
|
|
||||||
+
|
|
||||||
/* If we are expanding the second or later line of a multi-line
|
|
||||||
command, decrease history_length so references to history expansions
|
|
||||||
in these lines refer to the previous history entry and not the
|
|
||||||
current command. */
|
|
||||||
+ old_len = history_length;
|
|
||||||
if (history_length > 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
|
|
||||||
history_length--;
|
|
||||||
expanded = history_expand (line, &history_value);
|
|
||||||
if (history_length >= 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
|
|
||||||
- history_length++;
|
|
||||||
+ history_length = old_len;
|
|
||||||
|
|
||||||
if (expanded)
|
|
||||||
{
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index deb9c5b..16c8740 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 7
|
|
||||||
+#define PATCHLEVEL 8
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
diff --git a/lib/readline/histfile.c b/lib/readline/histfile.c
|
|
||||||
index dc64bde..a8a92aa 100644
|
|
||||||
--- a/lib/readline/histfile.c
|
|
||||||
+++ b/lib/readline/histfile.c
|
|
||||||
@@ -305,6 +305,7 @@ read_history_range (const char *filename, int from, int to)
|
|
||||||
if (file_size == 0)
|
|
||||||
{
|
|
||||||
free (input);
|
|
||||||
+ close (file);
|
|
||||||
return 0; /* don't waste time if we don't have to */
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/patchlevel.h b/patchlevel.h
|
|
||||||
index 16c8740..02f1d60 100644
|
|
||||||
--- a/patchlevel.h
|
|
||||||
+++ b/patchlevel.h
|
|
||||||
@@ -25,6 +25,6 @@
|
|
||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
||||||
looks for to find the patch level (for the sccs version string). */
|
|
||||||
|
|
||||||
-#define PATCHLEVEL 8
|
|
||||||
+#define PATCHLEVEL 9
|
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
|
||||||
Binary file not shown.
40
bash.spec
40
bash.spec
@ -1,6 +1,6 @@
|
|||||||
Name: bash
|
Name: bash
|
||||||
Version: 5.0
|
Version: 5.1
|
||||||
Release: 17
|
Release: 1
|
||||||
Summary: It is the Bourne Again Shell
|
Summary: It is the Bourne Again Shell
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
URL: https://www.gnu.org/software/bash
|
URL: https://www.gnu.org/software/bash
|
||||||
@ -11,25 +11,6 @@ Source2: dot-bash_profile
|
|||||||
Source3: dot-bash_logout
|
Source3: dot-bash_logout
|
||||||
|
|
||||||
# PATCH-FIX-UPSTREAM
|
# PATCH-FIX-UPSTREAM
|
||||||
Patch1: bash-5.0-patch1.patch
|
|
||||||
Patch2: bash-5.0-patch2.patch
|
|
||||||
Patch3: bash-5.0-patch3.patch
|
|
||||||
Patch4: bash-5.0-patch4.patch
|
|
||||||
Patch5: bash-5.0-patch5.patch
|
|
||||||
Patch6: bash-5.0-patch6.patch
|
|
||||||
Patch7: bash-5.0-patch7.patch
|
|
||||||
Patch8: bash-5.0-patch8.patch
|
|
||||||
Patch9: bash-5.0-patch9.patch
|
|
||||||
Patch10: bash-5.0-patch10.patch
|
|
||||||
Patch11: bash-5.0-patch11.patch
|
|
||||||
Patch12: bash-5.0-patch12.patch
|
|
||||||
Patch13: bash-5.0-patch13.patch
|
|
||||||
Patch14: bash-5.0-patch14.patch
|
|
||||||
Patch15: bash-5.0-patch15.patch
|
|
||||||
Patch16: bash-5.0-patch16.patch
|
|
||||||
Patch17: bash-5.0-patch17.patch
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Patch115: bash-2.05a-interpreter.patch
|
Patch115: bash-2.05a-interpreter.patch
|
||||||
Patch118: bash-2.05b-pgrp_sync.patch
|
Patch118: bash-2.05b-pgrp_sync.patch
|
||||||
@ -39,14 +20,12 @@ Patch129: bash-4.2-coverity.patch
|
|||||||
Patch133: bash-4.3-noecho.patch
|
Patch133: bash-4.3-noecho.patch
|
||||||
# fix bash leaks memory when LC_ALL set-rh1241533,rh1224855
|
# fix bash leaks memory when LC_ALL set-rh1241533,rh1224855
|
||||||
Patch134: bash-4.3-memleak-lc_all.patch
|
Patch134: bash-4.3-memleak-lc_all.patch
|
||||||
# https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=951bdaad7a18cc0dc1036bba86b18b90874d39ff
|
|
||||||
Patch135: CVE-2019-18276.patch
|
|
||||||
# https://github.com/bminor/bash/commit/db26b1cf58aab63c39fd5665590cad3cb75eab72.patch
|
|
||||||
Patch136: commit-bash-20190913-snapshot.patch
|
|
||||||
Patch137:bugfix-Forbidden-non-root-user-to-clear-history.patch
|
Patch137:bugfix-Forbidden-non-root-user-to-clear-history.patch
|
||||||
Patch138:enable-dot-logout-and-source-bashrc-through-ssh.patch
|
Patch138:enable-dot-logout-and-source-bashrc-through-ssh.patch
|
||||||
|
|
||||||
BuildRequires: gcc bison texinfo autoconf ncurses-devel
|
BuildRequires: gcc bison texinfo autoconf ncurses-devel
|
||||||
|
# Required for bash tests
|
||||||
|
BuildRequires: glibc-all-langpacks
|
||||||
|
|
||||||
Requires: filesystem
|
Requires: filesystem
|
||||||
|
|
||||||
@ -83,7 +62,10 @@ Man pages and other related documents for %{name}.
|
|||||||
%build
|
%build
|
||||||
autoconf
|
autoconf
|
||||||
%configure --with-bash-malloc=no --with-afs
|
%configure --with-bash-malloc=no --with-afs
|
||||||
%make_build "CPPFLAGS=-D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='\"/usr/local/bin:/usr/bin\"' `getconf LFS_CFLAGS`"
|
MFLAGS="CPPFLAGS=-D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='\"/usr/local/bin:/usr/bin\"' `getconf LFS_CFLAGS`"
|
||||||
|
make "$MFLAGS" version.h
|
||||||
|
make "$MFLAGS" -C builtins
|
||||||
|
%make_build "$MFLAGS"
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%make_install install-headers
|
%make_install install-headers
|
||||||
@ -131,6 +113,12 @@ make check
|
|||||||
%exclude %{_infodir}/dir
|
%exclude %{_infodir}/dir
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon May 31 2021 liujian<liujianliu.liu@huawei.com> - 5.1-1
|
||||||
|
- Type:enhancement
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:upgrade to 5.1
|
||||||
|
|
||||||
* Thu Mar 30 2021 shenyangyang<shenyangyang4@huawei.com> - 5.0-17
|
* Thu Mar 30 2021 shenyangyang<shenyangyang4@huawei.com> - 5.0-17
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
@ -1,97 +0,0 @@
|
|||||||
From db26b1cf58aab63c39fd5665590cad3cb75eab72 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Chet Ramey <chet.ramey@case.edu>
|
|
||||||
Date: Mon, 16 Sep 2019 15:31:57 -0400
|
|
||||||
Subject: [PATCH] commit bash-20190913 snapshot
|
|
||||||
|
|
||||||
---
|
|
||||||
configure | 24 +++++++++++++-----------
|
|
||||||
configure.ac | 5 ++++-
|
|
||||||
shell.c | 4 ++--
|
|
||||||
3 files changed, 19 insertions(+), 14 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/configure b/configure
|
|
||||||
index b3321c9..0a71708 100755
|
|
||||||
--- a/configure
|
|
||||||
+++ b/configure
|
|
||||||
@@ -10281,17 +10281,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
|
|
||||||
@@ -10315,6 +10304,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
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index f62a747..9a847bc 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -810,10 +810,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])
|
|
||||||
diff --git a/shell.c b/shell.c
|
|
||||||
index 6adabc8..035a13c 100644
|
|
||||||
--- a/shell.c
|
|
||||||
+++ b/shell.c
|
|
||||||
@@ -1293,7 +1293,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)
|
|
||||||
@@ -1306,7 +1306,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)
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
||||||
@ -1,14 +1,14 @@
|
|||||||
From 8d61d57541b0dbf7eb49359f7f0af53ec9724cbe Mon Sep 17 00:00:00 2001
|
From fa0abfba964c7eada368d5783f23b5b6894ad417 Mon Sep 17 00:00:00 2001
|
||||||
From: openEuler Buildteam <buildteam@openeuler.org>
|
From: liujian <liujianliu.liu@huawei.com>
|
||||||
Date: Thu, 9 Jan 2020 19:02:15 +0800
|
Date: Mon, 31 May 2021 22:58:30 +0800
|
||||||
Subject: [PATCH] enable dot logout and source bashrc through ssh
|
Subject: [PATCH] enable-dot-logout-and-source-bashrc-through-ssh
|
||||||
|
|
||||||
---
|
---
|
||||||
config-top.h | 6 +++---
|
config-top.h | 6 +++---
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
diff --git a/config-top.h b/config-top.h
|
diff --git a/config-top.h b/config-top.h
|
||||||
index 56dbd51..3c5555a 100644
|
index 735f75e..4fee122 100644
|
||||||
--- a/config-top.h
|
--- a/config-top.h
|
||||||
+++ b/config-top.h
|
+++ b/config-top.h
|
||||||
@@ -94,17 +94,17 @@
|
@@ -94,17 +94,17 @@
|
||||||
@ -30,8 +30,8 @@ index 56dbd51..3c5555a 100644
|
|||||||
-/* #define SSH_SOURCE_BASHRC */
|
-/* #define SSH_SOURCE_BASHRC */
|
||||||
+#define SSH_SOURCE_BASHRC
|
+#define SSH_SOURCE_BASHRC
|
||||||
|
|
||||||
/* Define if you want the case-capitalizing operators (~[~]) and the
|
/* Define if you want the case-toggling operators (~[~]) and the
|
||||||
`capcase' variable attribute (declare -c). */
|
`capcase' variable attribute (declare -c). */
|
||||||
--
|
--
|
||||||
1.8.3.1
|
2.23.0
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user