#672 Wrong shell syntax highliting

v1.23
closed-fixed
nobody
Interface (176)
5
2012-10-25
2011-03-21
Vadim Gusev
No

Example of wrongly highlighted shell code:

#!/bin/bash

for ip in $(seq 2 253); do
current_last_router=$(traceroute $1$ip -w 1 -q 1 | grep -E -e '\([0-9\.]+' -o | sed 's/(//' | tail -n 1)
cur=${router_list[@]}
sub=${router_list[@]/$current_last_router/}
# debug here
echo -e "ip\t$1$ip"
echo -e "router\t$current_last_router"
echo -e "cur\t$cur"
echo -e "sub\t$sub"
echo

if [ "$cur" == "$sub" ]; then
router_list[$ip]=$current_last_router
fi
done

echo Routers List:
echo ${router_list[@]}

Discussion

  • Nick Treleaven

    Nick Treleaven - 2011-03-24

    Confirmed. Smaller testcase:

    result=$(echo '(')
    hi=foo
    #)

    The quoted bracket is matched instead of being ignored.

     
  • Anonymous - 2011-03-26

    Just happened to stumble across this while poking around in the Scintilla src:
    http://scintilla.cvs.sourceforge.net/viewvc/scintilla/scintilla/src/LexBash.cxx?view=log

    "Fix for bug #2830239 Highlight glitch in Shell file with here doc.s"

    "Bug #2635257 Shell HERE (redirect stdin) end not detected in Bash Lexer
    fixed."

    I'm guessing it fixes the issue.

     
  • Enrico Tröger

    Enrico Tröger - 2011-03-27

    The bug still exists in the latest version of Scintilla (tried LexBash.cxx from Mercurial).

    Vadim, please report this to the Scintilla project (http://www.scintilla.org), this is the editing component we use in Geany. Once it is fixed in Scintilla, we can backport the fix in Geany.
    And it'd be cool if you could add a link to the Scintilla bug report here.

    Thank you.

     
  • Nobody/Anonymous

    I confirm the bug using "geany 0.20 (built on Feb 26 2011 with GTK 2.20.1, GLib 2.28.1, GIO)".
    ie. quoted shell variables are highlighted as a quoted text string

     
  • Colomban Wendling

    • milestone: --> v1.23
    • status: open --> closed-fixed
     
  • Colomban Wendling

    Now fixed in Git, thanks for reporting.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks