bugGNU nano - Bugs: bug #42094, Filename regex for man pages is...

 
 

bug #42094: Filename regex for man pages is very broad

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Thu 10 Apr 2014 08:45:17 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Need Info
Privacy: PublicAssigned to: None
Open/Closed: OpenRelease: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Sat 21 Jun 2014 11:14:57 AM UTC, comment #3:

Can't think of any way to avoid this, apart from requiring that the word "man" occurs somewhere in the path:

syntax "man" "man.*\.[1-9]x?$"

But that will prevent all files that are edited in the current directory from being recognized as a man page by this regex. However, when libmagic has not been disabled, it will still work in most cases. So... is the above acceptable?

Benno Schulenberg <bens>
Project Member
Fri 16 May 2014 10:15:30 AM UTC, comment #2:

It works the other way around: the filename regex that is defined last gets matched first. I still use explicit includes, and moving the 'include man.nanorc' to before the 'include changelog.nanorc' makes all ChangeLog.* files be coloured properly.

When people start using 'include /usr/share/nano/*.nanorc', it may be a good idea to rename man.nanorc to 111man.nanorc, and add a comment in the file as to why it is named that way.

Benno Schulenberg <bens>
Project Member
Fri 16 May 2014 09:09:58 AM UTC, comment #1:

What happens is that ChangeLog.1 matches the filename regex for man pages, and thus gets coloured as a man page. It's just that there is nothing in a changelog that matches manpage commands, so there are no telltale signs.

I finally figured it out after changing the filename regex in changelog.nanorc and seeing that ChangeLog.0 got coloured with my default syntax (which lights up tabs) and ChangeLog.1 not.

But why does ChangeLog.1 get matched sooner by "\.[1-9]x?$" than by "Change[Ll]og.*", when the latter is a better match and the file comes sooner in the alphabet?

Benno Schulenberg <bens>
Project Member
Thu 10 Apr 2014 08:45:17 PM UTC, original submission:

When in changelog.nanorc I change the line
to
it does not work as expected: it does not match for example the file Changelog.1 It does match Changelog.a or Changelog.21 or Changelog.a1, but not any changelog that ends with a period plus a single digit. Is this a fault in regular expressions on my system? Or a mistake on nano's part?

Benno Schulenberg <bens>
Project Member

 

(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 (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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 21 Jun 2014 11:14:57 AM UTCbensStatusNone=>Need Info
    Fri 16 May 2014 09:09:58 AM UTCbensSummaryFilename regex in syntax is not properly matched=>Filename regex for man pages is very broad

    Back to the top


    Powered by Savane 3.1-cleanup