From: Chet Ramey Date: Mon, 2 Apr 2018 14:00:50 +0000 (-0400) Subject: commit bash-20180329 snapshot X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=13b0033c461e10205ebc83b5b9c7ab5234bee21e;p=thirdparty%2Fbash.git commit bash-20180329 snapshot --- diff --git a/MANIFEST b/MANIFEST index a92e558c0..235bd9e41 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1164,6 +1164,7 @@ tests/parser.right f tests/parser1.sub f tests/posix2.tests f tests/posix2.right f +tests/posix2syntax.sub f tests/posixexp.tests f tests/posixexp.right f tests/posixexp1.sub f @@ -1188,6 +1189,7 @@ tests/printf3.sub f tests/printf4.sub f tests/procsub.tests f tests/procsub.right f +tests/procsub1.sub f tests/quote.tests f tests/quote.right f tests/quote1.sub f @@ -1215,7 +1217,6 @@ tests/redir8.sub f tests/redir9.sub f tests/redir10.sub f tests/redir11.sub f -tests/redir12.sub f tests/rhs-exp.tests f tests/rhs-exp.right f tests/rhs-exp1.sub f diff --git a/doc/bashref.texi b/doc/bashref.texi index fa39b7518..ddc49b403 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -6712,7 +6712,7 @@ In the absence of any traps, Bash ignores @code{SIGTERM} @item In the absence of any traps, @code{SIGINT} is caught and handled -((@pxref{Signals}). +(@pxref{Signals}). @code{SIGINT} will interrupt some shell builtins. @item diff --git a/tests/parser.right b/tests/parser.right index 43d5a8ed6..cecbb2223 100644 --- a/tests/parser.right +++ b/tests/parser.right @@ -1 +1,16 @@ AAA +bash5: `invalid-name': not a valid identifier +in +in +in +in +bash5: -c: line 0: syntax error near unexpected token `)' +bash5: -c: line 0: `case x in esac) echo done; esac' +in +bash5: -c: line 0: syntax error near unexpected token `do' +bash5: -c: line 0: `case in do do) echo in; esac' +bash5: -c: line 0: syntax error near unexpected token `(' +bash5: -c: line 0: `for()' +in +done +ok 1 diff --git a/tests/parser.tests b/tests/parser.tests index 12ff88c29..6e020a4ba 100644 --- a/tests/parser.tests +++ b/tests/parser.tests @@ -2,3 +2,5 @@ # this has to be in a separate file to get desired EOF behavior ${THIS_SH} ./parser1.sub + +${THIS_SH} ./posix2syntax.sub diff --git a/tests/posix2syntax.sub b/tests/posix2syntax.sub new file mode 100644 index 000000000..e7dda58f7 --- /dev/null +++ b/tests/posix2syntax.sub @@ -0,0 +1,53 @@ +: ${THIS_SH:=./bash} +bashname=bash${BASH_VERSION%%.*} + +# tests for Posix grammar special cases + +# Posix grammar rule 5 +${THIS_SH} -c 'for invalid-name in a b c; do echo error; done' $bashname + +# Posix grammar rule 6: third word in FOR or SELECT +for i; do echo; done; echo in +for i; do echo in; done +for i do echo in; done + +select i; do echo; done; echo in +select i; do echo in; done; echo in +select i do echo in; done; echo in + +# Posix grammar rule 4: when PATTERN == ESAC, return ESAC +${THIS_SH} -c 'case x in esac) echo done; esac' $bashname + +# Posix grammar rule 6: third word in CASE +${THIS_SH} -c 'case in in in) echo in; esac;' $bashname +${THIS_SH} -c 'case in do do) echo in; esac' $bashname + +# Posix grammar rule 8: function NAME +${THIS_SH} -o posix -c 'for() +{ +echo function for; +}' $bashname + +for for in for; do echo in; echo done; done + +${THIS_SH} -c 'for (( i = 0; i < 5; i++ )) do : ; done' $bashname +${THIS_SH} -c 'for (( i = 0; i < 5; i++ )) { : ; }' $bashname + +# bug report: IN turning on unwanted alias expansion +${THIS_SH} -o posix -c ' +alias foo='two words' +foo_word='foo' +case "$foo_word" +in + foo) echo "bad 1";; +esac' $bashname + +${THIS_SH} -o posix -c ' +alias foo='oneword' +foo_word='foo' +case "$foo_word" +in + foo) echo "ok 1";; +esac' $bashname + + diff --git a/tests/procsub.right b/tests/procsub.right index 5167c97e4..0d10aba40 100644 --- a/tests/procsub.right +++ b/tests/procsub.right @@ -26,3 +26,4 @@ extern 0 0 0 +123 diff --git a/tests/procsub.tests b/tests/procsub.tests index 2b60e239d..cbd74b003 100644 --- a/tests/procsub.tests +++ b/tests/procsub.tests @@ -91,3 +91,5 @@ EOF ${THIS_SH} -c "source $FN <(date)" rm -f $FN + +${THIS_SH} ./procsub1.sub diff --git a/tests/procsub1.sub b/tests/procsub1.sub new file mode 100644 index 000000000..0e68f3b23 --- /dev/null +++ b/tests/procsub1.sub @@ -0,0 +1,5 @@ +# make sure we can wait for the last process substitution, since it sets $! +cat <(exit 123) >/dev/null + +wait "$!" +echo $? diff --git a/tests/redir.right b/tests/redir.right index a9ad75323..ab737d494 100644 --- a/tests/redir.right +++ b/tests/redir.right @@ -157,4 +157,3 @@ a+=3 foo foo ./redir11.sub: line 53: $(echo $a): Bad file descriptor -123 diff --git a/tests/redir.tests b/tests/redir.tests index 24e3cd1a5..7b74ac53d 100644 --- a/tests/redir.tests +++ b/tests/redir.tests @@ -191,4 +191,3 @@ ${THIS_SH} ./redir9.sub ${THIS_SH} ./redir10.sub ${THIS_SH} ./redir11.sub -${THIS_SH} ./redir12.sub diff --git a/tests/redir12.sub b/tests/redir12.sub index 0e68f3b23..66376235a 100644 --- a/tests/redir12.sub +++ b/tests/redir12.sub @@ -1,5 +1,5 @@ -# make sure we can wait for the last process substitution, since it sets $! -cat <(exit 123) >/dev/null - -wait "$!" -echo $? +umask 0777 +cat <<' HERE' +look ma, no permissions +HERE +cat <<<"it's a miracle"