Hello.

The "Type=" and "Regex=" directives in mc.ext.ini do not work with mc-4.8.33 (e.g., PDF files are not opened by pressing Enter). The "Shell=" directive continues to work, which masks the problem.

1. "Regex=" is broken.

The reason for this behavior is unclear. Some believe that this happened after some glib version was changed, but I wasn't able to find this out for sure.

Fix: build mc with "--with-search-engine=pcre2".

--- Makefile.orig
+++ Makefile
@@ -27,6 +27,7 @@

 CONFIGURE_STYLE=       gnu
 CONFIGURE_ARGS+=       --with-subshell \
+                       --with-search-engine=pcre2 \
                        --enable-vfs-sftp \
                        --enable-vfs-smb \
                        --enable-charset \

Note: maybe "--with-search-engine=pcre2" requires devel/pcre2 to be added to LIB_DEPENDS/WANTLIB but in my system this turned out to be unnecessary.

2. The code with "Type=" is excluded from compilation.

`configure` checks `file -z .` to decide whether to define USE_FILE_CMD. The "file" command in OpenBSD does not support "-z", so the check fails, USE_FILE_CMD remains undefined, and the entire code path implementing the "Type=" directive is excluded at the compile time. The only visible symptom is: "configure: WARNING: The file command doesn't accept the -z option and will not be used".

Fixes:
- in "configure": replace "file -z ." with "file ." (to verify that the
command exists, not that it supports "-z").

--- configure.orig
+++ configure
@@ -19412,7 +19412,8 @@
   printf %s "(cached) " >&6
 else case e in #(
   e)
-        file -z . > /dev/null 2>&1
+#        file -z . > /dev/null 2>&1
+        file . > /dev/null 2>&1
         if test $? = 0; then
             mc_cv_file_z=yes
         else

- in src/filemanager/ext.c: drop "-z" from FILE_CMD so that "file" is
invoked only with supported options.

--- src/filemanager/ext.c.orig
+++ src/filemanager/ext.c
@@ -75,9 +75,9 @@

 #ifdef USE_FILE_CMD
 #ifdef FILE_B
-#define FILE_CMD "file -z " FILE_B FILE_S FILE_L
+#define FILE_CMD "file " FILE_B FILE_S FILE_L
 #else
-#define FILE_CMD "file -z " FILE_S FILE_L
+#define FILE_CMD "file " FILE_S FILE_L
 #endif
 #endif


After applying the above fixes the "Type=" and "Regex=" directives began working as expected.

The "-current" port (mc-4.8.33) was tested on OpenBSD-7.6 (amd64).

Please review and consider applying my changes.


--
Best regards,
Alex

Reply via email to