Ticket #4534 (closed defect: invalid)

Opened 12 days ago

Last modified 11 days ago

mc.ext.ini conversion - incorrect escaping in the Regex section

Reported by: fedy Owned by:
Priority: minor Milestone:
Component: mc-config-ini Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description (last modified by andrew_b) (diff)

It looks like in mc version 4.8.31 the mc.ext.ini file's Regex= expressions needs double escaping of the special characters (like .)

For example for mp4 videos the (auto generated) default is:

[mp4]
Regex=\\.(mp4|m4v|mpe?g)$

Probably as a result of an automatic conversion of this file from previous format I ended up with a config where the . in Regexes are prepended with just a single \. That result in most setting using Regex just not working. Newly generated mc.ext.ini contains double escaped Regexes like above and works just fine, but all previous user customization are lost.

Not sure if the need for double escaping was intended, but there seems to be a mismatch between the currently required format and the format produced by the conversion.

Change History

comment:1 Changed 12 days ago by fedy

Correction - example again (codeblock):

[mp4]
Regex=\\.(mp4|m4v|mpe?g)$
RegexIgnoreCase=true
Include=video

comment:2 in reply to: ↑ description Changed 12 days ago by andrew_b

  • Status changed from new to closed
  • Resolution set to invalid
  • Milestone Future Releases deleted

Replying to fedy:

It looks like in mc version 4.8.31 the mc.ext.ini file's Regex= expressions needs double escaping of the special characters (like .)

Correct. This is already done in #4502.

Probably as a result of an automatic conversion of this file from previous format

mc doesn't provide any automatic conversion for this file.

comment:3 Changed 12 days ago by andrew_b

  • Description modified (diff)

comment:4 Changed 11 days ago by fedy

Sorry, wrong assumption.

Investigated further:
The Regex syntax change (regarding escaping) must have happened between versions 4.8.30 and 4.8.31 (specifically the ones distributed in Fedora 38 and Fedora 40).

It has probably something to do with the (change in?) glib handling mentioned in the top of the newly generated file in the Regex= syntax section , quoting:

#            An unescaped backslash \ is handled as invalid escape sequences in glib = 2.77.3 and
#            glib >= 2.79 (https://gitlab.gnome.org/GNOME/glib/-/issues/3094), therefore backslash
#            must be escaped.

... still, incompatible change so maybe this report (or possibly some FAQ entry?) might help others looking for reasons while suddenly half of their file associations are not working.

Note: See TracTickets for help on using tickets.