bugGNU nano - Bugs: bug #53726, regcomp() sputters when a regex...


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

bug #53726: regcomp() sputters when a regex starts with a character class

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Mon 23 Apr 2018 06:18:22 PM UTC  
Severity:  2 - Minor Status:  None
Assigned to:  None Open/Closed:  Open

Sun 18 Aug 2019 11:37:45 AM UTC, comment #2: 

It was just setting errno -- otherwise most syntaxes would be broken.

Here it sets errno (always 84) also for a simple [A-Z] range.

Benno Schulenberg <bens>
Project Administrator
Sun 18 Aug 2019 12:08:15 AM UTC, comment #1: 

Was regcomp failing or just setting errno?

When using the attached patch with or without gnulib's regcomp (https://savannah.gnu.org/bugs/?56766), those cases are successful but errno is 84. So something inside regcomp generated an error, which could cause a slowdown.

It also happens for "[0-9]" and other sets with 0-9, but not all sets with 0-9.

(file #47360)

Brand Huntsman <brand>
Mon 23 Apr 2018 06:18:22 PM UTC, original submission:  

After sprinkling a bunch of nperror() calls over the startup code of nano, it results that regcomp() returns an errno that corresponds to "Invalid or incomplete multibyte or wide character".

This error can be traced back to the first color command in syntax/default.nanorc:

  color cyan "^[[:space:]]*#.*"

Reducing the regex to just "[[:space:]] still produces the message.  Any other character class (alpha, alnum, blank) also produces the message.  Preceding the character class with some other character (except ^, of course) makes the message go away.

Is this a bug in regcomp() somehow?

Benno Schulenberg <bens>
Project Administrator


Attached Files
file #47360:  regcomp-errno-test.patch added by brand (741B - text/x-diff)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by brand (Updated the item)
  • -email is unavailable- added by bens (Submitted the item)

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

    Only logged-in users can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-08-18 brand Attached File- => Added regcomp-errno-test.patch, #47360

    Back to the top

    Powered by Savane 3.5