Bug 473471

Summary: Syntax highlighting broke after the `${!}` expansion for Bash scripts
Product: [Frameworks and Libraries] frameworks-syntax-highlighting Reporter: 林博仁(Buo-ren, Lin) <Buo.Ren.Lin>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: walter.von.entferndt
Priority: NOR    
Version: 5.92.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Example script for bug reroduction
Bug reproduction screenshot
Example script for bug reroduction

Description 林博仁(Buo-ren, Lin) 2023-08-17 10:27:10 UTC
Created attachment 161018 [details]
Example script for bug reroduction

SUMMARY

The exclamation mark (!) is a special parameter that will "expands to the process ID of the job most recently placed into the background, whether executed as an asynchronous command or using the bg builtin" according to the Bash manual, however currently when encountering the `"${!}"` (opening double-quote, dollar sign, opening curly braces, exclamation mark, closing curly braces, closing double-quote) character sequence all text are highlight as red until the next occurrence of `"${!}"`.

Expansion without the curly braces pair,(`$!`), however, does not reproduce such problem.

STEPS TO REPRODUCE
1. Download attached reproducing script
2. Open the script with Kate, etc.
3. Profit.

OBSERVED RESULT

Text between two `"${!}"`s is highlighted red.

EXPECTED RESULT

Text between two `"${!}"`s shouldn't be highlighted red.

SOFTWARE/OS VERSIONS
Linux: Ubuntu 22.04LTS
KDE Frameworks Version: 5.92.0 (also reproduced in 5.105.0 snap)
Qt Version: 5.15.3 (also reproduced in 5.105.9 snap)

ADDITIONAL INFORMATION

Also reproduced with the definition file of commit ca42b1ed.
Comment 1 林博仁(Buo-ren, Lin) 2023-08-17 10:30:04 UTC
s/Qt Version: 5.15.3 (also reproduced in 5.105.9 snap)/Qt Version: 5.15.3 (also reproduced in 5.15.9 snap)/g
Comment 2 林博仁(Buo-ren, Lin) 2023-08-17 10:56:25 UTC
Created attachment 161021 [details]
Bug reproduction screenshot
Comment 3 林博仁(Buo-ren, Lin) 2023-08-17 10:58:40 UTC
Created attachment 161022 [details]
Example script for bug reroduction
Comment 4 Bug Janitor Service 2023-08-20 20:52:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/527
Comment 5 Jonathan Poelen 2023-08-21 20:24:26 UTC
Git commit 18ee15c2910f80d70fe89b1f068922d8a4fcbf97 by Jonathan Poelen.
Committed on 20/08/2023 at 22:48.
Pushed by cullmann into branch 'master'.

Bash: fix ${!}

M  +1    -1    autotests/folding/highlight.sh.fold
M  +1    -1    autotests/html/highlight.sh.dark.html
M  +1    -1    autotests/html/highlight.sh.html
M  +1    -1    autotests/input/highlight.sh
M  +1    -1    autotests/reference/highlight.sh.ref
M  +3    -1    data/syntax/bash.xml

https://invent.kde.org/frameworks/syntax-highlighting/-/commit/18ee15c2910f80d70fe89b1f068922d8a4fcbf97