bugGNU nano - Bugs: bug #51394, comment parsing is incorrect with...

 
 

bug #51394: comment parsing is incorrect with text after un-backslashed double quotes

Submitted by:  David Lawrence Ramsey <dolorous>
Submitted on:  Wed 05 Jul 2017 08:36:29 PM UTC  
 
Severity: 3 - NormalStatus: Fixed
Assigned to: Benno Schulenberg <bens>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 07 Jul 2017 08:32:59 AM UTC, comment #2:

Fixed in git, commit a7901dd1e.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Wed 05 Jul 2017 08:40:30 PM UTC, comment #1:

There's also a second case of incorrect parsing. Quoting Benno Schulenberg in bug #51370 (where I also originally reported this bug):

"(But it's rather absurd that trailing junk after the first two double quotes prevents the parser from noting that the string is empty -- also «comment "" joohoo» will fail to disable commenting. :| ) "

David Lawrence Ramsey <dolorous>
Project Administrator
Wed 05 Jul 2017 08:36:29 PM UTC, original submission:

In recent git (7473105), nano parses comment strings with un-backslashed double quotes incorrectly.

Despite what the documentation in that version says, comment options currently require backslashed double quotes, since such options use rcfile.c:pick_up_name(), which requires such backslashing. However, not backslashing double quotes, and following those quotes with extra text, leads to erroneous commenting behavior without generating rcfile errors. You can reproduce one case of this via the following steps:

1. Create a new syntax file in /usr/share/nano/unquoted.nanorc, containing:

syntax "unquoted"
comment """

2. Build nano from git with --sysconfdir=/etc and --prefix=/usr.

3. Run:

./nano -Y unquoted

nano won't generate any errors when it parses the "unquoted" syntax, although the syntax highlighting of the unquoted.nanorc file will color the third quote of """ bright red.

4. Type several lines' worth of text, turn the mark on and highlight those lines, and then press Meta-3. The file will be marked as modified, but the text won't change. (In this case, the comment string is apparently empty, although erroneously not flagged as such.)

Now, change the comment line in /usr/share/nano/unquoted.nanorc to:

comment "\""

and repeat the above steps. In step 4, the lines will now be commented with a ", as expected.

David Lawrence Ramsey <dolorous>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bens (Updated the item)
  • -unavailable- added by dolorous (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 22 Jul 2017 07:14:27 PM UTCbensOpen/ClosedOpen=>Closed
    Fri 07 Jul 2017 08:32:59 AM UTCbensStatusIn Progress=>Fixed
    Thu 06 Jul 2017 11:21:57 AM UTCbensStatusNone=>In Progress
      Assigned toNone=>bens

    Back to the top


    Powered by Savane 3.1-cleanup1