Bug 237675 - error in bash syntax highlighting
Summary: error in bash syntax highlighting
Alias: None
Product: kate
Classification: Applications
Component: syntax (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KWrite Developers
Depends on:
Reported: 2010-05-14 22:51 UTC by Saulo Toledo
Modified: 2012-10-26 12:34 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Saulo Toledo 2010-05-14 22:51:38 UTC
Version:            (using KDE 4.4.3)
OS:                Linux
Installed from:    Debian testing/unstable Packages

Kate told me this is wrong with his colors:

if [ "v:`grep \"New passwords don't match\" /tmp/afdasyf12312`" == 'v:' ];then echo "error"; fi

Kate understood the character "'" of "don't" need be escaped, and all linex afer this line appears in red. But that line is correct! if I escape "'" the script will be wrong. But Kate/Kwrite do not understood this.
Comment 1 Matthew Woehlke 2010-06-08 00:31:25 UTC
Hmm... I guess I don't understand bash's parsing here. I thought that ` would reset the quote level (which is what the HL thinks happens), but it seems not. I'm actually inclined to wonder if this is a bash bug.

For what it's worth, if you don't escape the double-quotes (like so):
if [ "v:`grep "New passwords don't match" /tmp/afdasyf12312`" == 'v:' ]
...it should be parsed the same by bash, and parsed correctly by kate's HL.
Comment 2 Matthew Woehlke 2010-06-08 01:48:17 UTC
Eric Blake pointed out that POSIX specifies that "'s inside ``'s should be (must be, actually) escaped. So a) bash is correct, and b) this does need to be fixed for kate.

Also I guess that makes my work-around of dubious value, depending on what shells that scripts needs to be portable to. (Although Eric notes that the only fully-portable solution is to not use such a construct.)

(See http://permalink.gmane.org/gmane.comp.shells.bash.bugs/14831 and rest of thread.)
Comment 3 Saulo Toledo 2011-09-10 15:40:53 UTC
Sorry for time to back here. Hundreds of bug reports and I lost some of them in my e-mails...

I'm a little confuse for now. Then "s inside `s do not cancel external "s, correct?

And really, your workaround worked for me in bash, but not in sh (where I got "[: 4: v:New passwords don't match: unexpected operator" message.
Comment 4 Christoph Cullmann 2012-10-26 12:34:15 UTC
All highlightings are just heuristics, they can't cover all corner cases and often lack latest language features.

If you provide some patch to fix your issue, we will take care of it, otherwise, it won't be fixed as the xml files are not that "actively" maintained beside by users fixing such issues themself.

See the highlighting docs on kate-editor.org on how to improve our existing files.

As we have >> 200 highlightings around, we can't do this ourself, sorry.
Please provide a patch and reopen the bug then (or dump the patch to kwrite-devel@kde.org).