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.
|