nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] Alert on unknown file: magic_file(...) failed: line 156


From: Benno Schulenberg
Subject: Re: [Nano-devel] Alert on unknown file: magic_file(...) failed: line 156: regex error 10
Date: Tue, 26 Mar 2019 16:54:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

Hi Michal,

First off: thanks for reporting!

Op 26-03-19 om 07:04 schreef Michal Nowak:
> I work on updating GNU nano to 4.0 on OpenIndiana (illumos kernel). When
> there's no suitable syntax highlighting file, there's an alert in nano like
> 
> $ nano 2019-03-14-07-13-49.050-VBoxSVC-6791.log [
> magic_file(2019-03-14-07-13-49.050-VBoxSVC-6791.log) failed: line 156: regex 
> error 10 for `^[!-?A-~]{1,255}(    [^      ]+){11}', (invalid character range)
> ]
> 
> This is the content of the file:
> 
> Log created: 2019-03-14T07:13:49.501613000Z Executable:
> /opt/VirtualBox/amd64/VBoxSVC Arg[0]: /opt/VirtualBox/amd64/VBoxSVC Arg[1]:
> --auto-shutdown AddRef: illegal refcnt=3221225469 state=2

When I create a file with that content and that name, opening it with
nano (compiled without --disable-libmagic) does not give me any alert.

But this alert is not about something being wrong in nano's regexes
but about the regexes in the magic data file.  My version of GNU file
is older (file-5.32).  Maybe a bug crept into the newer version?  Or
maybe you have additional magic data files parked in the paths that
GNU file searches?

> With file "Makefile" file I see the highlighting as working, no alert:

Yes, because nano recognizes a Makefile through its name, not by using
libmagic.

(Ouch!  I now see that nano recognizes syntax/makefile.nanorc as
a Makefile, not as a nanorc file.  :|  A fairly recent change to
recognize more Makefile names probably broke that.  Thanks for
making me see that.)

> So far, the alert seems not a very useful one to me,

It's not useful to the nano users, so it's fine to disable it.  But it
alerts you that there is some problem in the magic database.

> Is there a better way to deal with files which might not have syntax
> highlighting file?
I think the value of letting libmagic "look" at files that are not
recognized from their name nor from their first line is very small,
so I normally build nano with --disable-libmagic.  This means that
opening plain text files, like logs or READMEs, is much faster: no
time is wasted by trying to recognize something that isn't there.

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]