From ab8ded9c30b51a6bc0c8145553263da044b565ea Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Mon, 17 Dec 2018 14:53:06 -0500 Subject: [PATCH] commit bash-20181214 snapshot --- CWRU/CWRU.chlog | 17 +++++++++++++++++ examples/loadables/finfo.c | 4 ++-- expr.c | 8 ++++---- lib/glob/smatch.c | 4 ++++ parse.y | 3 ++- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 7361e05d..249ee861 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -4875,3 +4875,20 @@ variables.c - assign_in_env: don't allow namerefs in temporary environment assignments to create variables with invalid names for export. Fixes bug reported by Grisha Levit + + 12/14 + ----- +parse.y + - don't change last_command_exit_value in the 'error yacc_EOF' production + if the parser sets it to something non-zero; just make sure it + indicates an error. Fixes problem with unexpected EOF in eval + reported by Martijn Dekker + + 12/17 + ----- +expr.c + - exp2 -> expmuldiv + +lib/sh/smatch.c + - fnmatch: add extern declaration if FNMATCH_EQUIV_FALLBACK is being + used diff --git a/examples/loadables/finfo.c b/examples/loadables/finfo.c index 00833f68..4273aa59 100644 --- a/examples/loadables/finfo.c +++ b/examples/loadables/finfo.c @@ -336,9 +336,9 @@ int flags; } else if (flags & OPT_DEV) printf("%d\n", st->st_dev); else if (flags & OPT_INO) - printf("%d\n", st->st_ino); + printf("%lu\n", (unsigned long)st->st_ino); else if (flags & OPT_FID) - printf("%d:%ld\n", st->st_dev, st->st_ino); + printf("%d:%lu\n", st->st_dev, (unsigned long)st->st_ino); else if (flags & OPT_NLINK) printf("%d\n", st->st_nlink); else if (flags & OPT_LNKNAM) { diff --git a/expr.c b/expr.c index 4db97f8c..9edc8d9c 100644 --- a/expr.c +++ b/expr.c @@ -214,7 +214,7 @@ static intmax_t exp5 __P((void)); static intmax_t exp4 __P((void)); static intmax_t expshift __P((void)); static intmax_t exp3 __P((void)); -static intmax_t exp2 __P((void)); +static intmax_t expmuldiv __P((void)); static intmax_t exppower __P((void)); static intmax_t exp1 __P((void)); static intmax_t exp0 __P((void)); @@ -858,14 +858,14 @@ exp3 () { register intmax_t val1, val2; - val1 = exp2 (); + val1 = expmuldiv (); while ((curtok == PLUS) || (curtok == MINUS)) { int op = curtok; readtok (); - val2 = exp2 (); + val2 = expmuldiv (); if (op == PLUS) val1 += val2; @@ -877,7 +877,7 @@ exp3 () } static intmax_t -exp2 () +expmuldiv () { register intmax_t val1, val2; #if defined (HAVE_IMAXDIV) diff --git a/lib/glob/smatch.c b/lib/glob/smatch.c index 3826c93e..64fdbbb7 100644 --- a/lib/glob/smatch.c +++ b/lib/glob/smatch.c @@ -289,6 +289,10 @@ is_cclass (c, name) extern char *mbsmbchar __P((const char *)); #if FNMATCH_EQUIV_FALLBACK +/* We don't include in order to avoid namespace collisions; the + internal strmatch still uses the FNM_ constants. */ +extern int fnmatch (const char *, const char *, int); + /* Construct a string w1 = "c1" and a pattern w2 = "[[=c2=]]" and pass them to fnmatch to see if wide characters c1 and c2 collate as members of the same equivalence class. We can't really do this portably any other way */ diff --git a/parse.y b/parse.y index f88f8446..3e100fca 100644 --- a/parse.y +++ b/parse.y @@ -418,7 +418,8 @@ inputunit: simple_list simple_list_terminator /* EOF after an error. Do ignoreeof or not. Really only interesting in non-interactive shells */ global_command = (COMMAND *)NULL; - last_command_exit_value = 1; + if (last_command_exit_value == 0) + last_command_exit_value = EX_BADUSAGE; /* force error return */ handle_eof_input_unit (); if (interactive && parse_and_execute_level == 0) {