bugGNU nano - Bugs: bug #65782, colon parsing can mangle a path


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

bug #65782: colon parsing can mangle a path

Submitter:  Benno Schulenberg <bens>
Submitted:  Thu 23 May 2024 02:40:05 PM UTC
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Fri 31 May 2024 09:28:58 AM UTC, comment #1: 

Fixed in git, commit add945e7, by no longer seeing a backslash before a colon as special.  When the user wants to prevent a colon followed by digits from being interpreted as a linenumber, they can use + or +1 or similar before the filename, or they can simply never put 'set colonparsing' in their nanorc file, as the colon parsing has been conditionalized on that option and on the absence of + by commit 02dd0b4e.

Benno Schulenberg <bens>
Group administrator
Thu 23 May 2024 02:40:05 PM UTC, original submission:  

To see what I mean, run:

mkdir colonic\\\:folder
src/nano colonic\\\:folder/somefile

See that nano reports: "[ Directory 'colonic:folder' does not exist ]".  The colon-parsing code has elided the backslash before the colon in the folder name.  :/

Of course, having a backslash in the name of a file or directory is absurdly rare, but it is possible, and nano shouldn't trip up the user who has files with such names.  Nor users with file names that end in a colon plus some digits, which are seemingly somewhat common on some systems (even though they are mostly log files and the user is unlikely to want to edit them).

So... for one thing, the colon parsing should be behind an option, so that unsuspecting users will not experience any adverse effects.

Second, nano should parse the given filename in reverse, checking from the tail whether there are digits preceded by a colon (preceded possibly by more digits plus a colon), so as to avoid trying to parse colons that cannot possibly specify a line number or column number.

And third, the eliding of a backslash before a colon should probably be removed entirely, and another mechanism for overriding should be found -- the simple use of +1 before the filename could disable colon parsing, for example.

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
    2024-07-13 bens Open/ClosedOpen Closed
    2024-05-31 bens StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code