bugGNU nano - Bugs: bug #61387, miscoloration can occur when a...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #61387: miscoloration can occur when a quoted string contains the other quote

Submitter:  Benno Schulenberg <bens>
Submitted:  Tue 26 Oct 2021 10:17:21 AM UTC
   
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Tue 26 Oct 2021 11:31:07 AM UTC, comment #1: 

Fixed in git, commit 485eb18d, by folding the regexes for double-quoted and single-quoted strings into one.

Benno Schulenberg <bens>
Group administrator
Tue 26 Oct 2021 10:17:21 AM UTC, original submission:  

To reproduce, run:

printf "\x22that's\x22 and 'this'" >quoted
src/nano quoted -Ypython

See that «"that's" and '» is colored green while «this'» is uncolored.  This is wrong.  Obviously "that's" and 'this' should be colored green and « and » should be uncolored.

(The same issue can be seen with the go, php, sh, tcl, nftables, javascipt, and autoconf syntaxes.)

The problem is that the two string types are colorized by different rules, which are applied one after the other, meaning that the second rule can match things that are inside a string colored by the first rule.

I don't think that in any language quoted strings can overlap.  Therefore rules that color strings should be in a single regex (when possible), so that overlapping colorations are avoided.

(Problem was found after folding a few regexes into another, and then thinking about whether this might cause miscolorations.  But it turns out that the folding is the right thing to do and things were faulty before.)

Benno Schulenberg <bens>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-12-16 bens Open/ClosedOpen Closed
    2021-10-26 bens StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code