diff options
| author | Kerin Millar <kfm@plushkava.net> | 2023-06-17 06:46:45 +0200 |
|---|---|---|
| committer | Sam James <sam@gentoo.org> | 2023-06-23 03:31:32 +0100 |
| commit | dde3a81f420e745fe884b6535796129192f02561 (patch) | |
| tree | b4d0a562bf4dbfba34df917516d241b2beaf6ca9 /app-shells/bash/files | |
| parent | 611d65db810d58f7a54bb5757c04ac8dce6912ba (diff) | |
| download | gentoo-dde3a81f420e745fe884b6535796129192f02561.tar.gz gentoo-dde3a81f420e745fe884b6535796129192f02561.tar.bz2 gentoo-dde3a81f420e745fe884b6535796129192f02561.zip | |
app-shells/bash: backport shell parser reset fix to 5.2
Note that Ramey's claim that only interactive shells are affected is
false, as is demonstrated below.
$ bash -c '[[ ]]; echo fin'; echo $?
0
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Bug: https://savannah.gnu.org/support/?110745
Bug: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00103.html
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-shells/bash/files')
| -rw-r--r-- | app-shells/bash/files/bash-5.2_p15-shell-parser-reset-issue.patch | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/app-shells/bash/files/bash-5.2_p15-shell-parser-reset-issue.patch b/app-shells/bash/files/bash-5.2_p15-shell-parser-reset-issue.patch new file mode 100644 index 000000000000..bef5586d0efc --- /dev/null +++ b/app-shells/bash/files/bash-5.2_p15-shell-parser-reset-issue.patch @@ -0,0 +1,33 @@ +https://savannah.gnu.org/support/?110745 +https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00103.html + +Note that both documents make the claim that only interactive shells are +affected. This is false, as is demonstrated below. + +$ bash -c '[[ ]]; echo fin'; echo $? +0 + +diff --git a/parse.y b/parse.y +index 11b71d4..02b2af1 100644 +--- parse.y ++++ parse.y +@@ -2899,7 +2899,7 @@ yylex () + #if defined (YYERRCODE) && !defined (YYUNDEF) + current_token = YYERRCODE; + #else +- current_token = YYerror; ++ current_token = YYUNDEF; + #endif + + return (current_token); +@@ -4156,7 +4156,9 @@ parse_comsub (qc, open, close, lenp, flags) + shell_eof_token = ps.eof_token; + expand_aliases = ps.expand_aliases; + +- /* yyparse() has already called yyerror() and reset_parser() */ ++ /* yyparse() has already called yyerror() and reset_parser(), so we set ++ PST_NOERROR to avoid a redundant error message. */ ++ parser_state |= PST_NOERROR; + return (&matched_pair_error); + } + else if (r != 0) |
