bugGNU nano - Bugs: bug #56012, unpredictable order of nanorc...

 
 

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

bug #56012: unpredictable order of nanorc files when using a globbing pattern

Submitter:  Benno Schulenberg <bens>
Submitted:  Wed 27 Mar 2019 07:29:24 PM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Fri 12 Apr 2019 12:35:27 PM UTC, comment #1: 

Fixed in git, commit c3f97bc9.

My fear is that for some users syntax coloring worked until now as they expected, just because of the way the files happened to be ordered in the relevant directory.  Changing to alphabetical is likely to change the reading order and might cause a different syntax to be applied in some cases, leaving the user clueless as to what the heck happened.  :|

Benno Schulenberg <bens>
Group administrator
Wed 27 Mar 2019 07:29:24 PM UTC, original submission:  

I cannot find a reproduction recipe as it seems to depend on some strange ordering method of the filesystem.

I stumbled on this issue by accident: http://lists.gnu.org/archive/html/nano-devel/2019-03/msg00048.html.  Looking at syntax/makefile.nanorc showed that it was highlighted as if it were a Makefile and not a nanorc file.  :|

When nanorc files would be read in alphabetical order, nanorc.nanorc would be read after makefile.nanorc, meaning that the former would take precedence over the latter (in the file matching regexes), which means that any file whose name ends with nanorc will be highlighted as a nanorc file even when its name contains any form of "makefile".

When I do 'ls -1U syntax/' (which lists the files unsorted, in directory order), the syntax files get listed in a seemingly random order.  One might think that this is an artifact of git, and that, when nano gets installed from a tarball, files would installed and stored in alphabetical order.  But... if I now do:
'mkdir folder && for file in syntax/*.nanorc; do cp -v $file folder/; done', the files get copied in alphabetical order, but doing 'ls -1U folder' shows the files in the same (although seemingly random) order.  I don't know what happens there.

Anyway, nano should read the syntax files in a predictable order, so it should drop the GLOB_NOSORT flag when calling glob().

Benno Schulenberg <bens>
Group administrator

 

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

 

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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-16 bens Open/ClosedOpen Closed
    2019-04-12 bens StatusIn Progress Fixed
    2019-04-02 bens Attached File- Added 0001-rcfile-read-the-syntax-files-in-alphabetical-order-w.patch, #46700
        StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code