1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Allow double quotes within backtick comsub within double quotes

The following reproducer causes a spurious syntax error:

    foo="`: "("`"

The nested double quotes are not recognised correctly, causing a
syntax error at the '('. Removing the outer double quotes (which
are unnecessary) is a workaround, but it's still a bug as every
other shell accepts this. This bug has been present since the
original Bourne shell.

src/cmd/ksh93/sh/lex.c: sh_lex(): case S_QUOTE:
- If the current character is '"' and we're in a `...` command
  substitution (ingrave is true), then do not switch to the old
  mode but keep using the ST_QUOTE state table.

Thanks to @JohnoKing for the report and to @atheik for the fix.

Co-authored by: Martijn Dekker <martijn@inlv.org>
Resolves: https://github.com/ksh93/ksh/issues/352
This commit is contained in:
atheik 2022-05-20 22:29:20 +01:00 committed by Martijn Dekker
parent c86713455c
commit 40a5c45b48
4 changed files with 25 additions and 3 deletions

6
NEWS
View file

@ -3,6 +3,12 @@ For full details, see the git log at: https://github.com/ksh93/ksh/tree/1.0
Any uppercase BUG_* names are modernish shell bug IDs.
2022-05-20:
- Fixed an ancient bug that caused a spurious syntax error when using double
quotes within a `backtick` command substitution within double quotes.
Thanks to atheik for the analysis and the fix.
2022-03-10:
- Fixed another corner case bug in the 'test'/'[' command.