[Midnight Commander] #4377: "Image Open"/"Image View" does not work with special character in filename

0 views
Skip to first unread message

Ticket System

unread,
Jun 18, 2022, 1:30:19 PM6/18/22
to alex...@roalter.it, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Type: defect
Status: new | Priority: minor
Milestone: Future Releases | Component: mc-core
Version: 4.8.28 | Keywords: image, open,
Blocked By: | view, special characters
Branch state: no branch | Blocking:
| Votes for changeset:
-------------------------------------+-------------------------------------
If I have an image file with either a special character (≥ U+0080) in it,
for example German umlauts, or special punctuation (’, “, », …) in it, or
in the path of it, it won’t be recognized as image, and pressing Enter (to
open) or F3 to view won’t work.

"Image view" (F3) on the file then shows the hex view of the file instead
of the image info usually displayed with images.

It works with video files though, so this seems limited to the image file
detection.

--
Ticket URL: <http://www.midnight-commander.org/ticket/4377>
Midnight Commander <https://midnight-commander.org>
Midnight Development Center

Ticket System

unread,
Jun 18, 2022, 1:34:18 PM6/18/22
to alex...@roalter.it, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future
Component: mc-core | Releases
Resolution: | Version: 4.8.28
Blocked By: | Keywords: image, open,
Branch state: no branch | view, special characters

| Blocking:
| Votes for changeset:
-------------------------------------+-------------------------------------

Comment (by ro-ee):

After reading the text, I would like to add that of course the file name
(or the path) is meant when I wrote 'with a special character in it', not
the content of the files (of course).

so: create an image file with the name "testö.jpg" or put an image file in
a folder named "testö", MC won’t be able to open it with Enter or View the
file info with F3.

It will work with an mp4 file, though (and call your video player of
choice), so "testö.mp4" or a folder named "testö" will work.

--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:1>

Ticket System

unread,
Jun 18, 2022, 2:14:27 PM6/18/22
to alex...@roalter.it, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future
Component: mc-core | Releases
Resolution: | Version: 4.8.28
Blocked By: | Keywords: image, open,
Branch state: no branch | view, special characters
| Blocking:
| Votes for changeset:
-------------------------------------+-------------------------------------

Comment (by andrew_b):

Works for me.

Please temporarily remove ~/.config/mc/mc.ext and try again.

--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:2>

Ticket System

unread,
Jun 18, 2022, 2:37:53 PM6/18/22
to alex...@roalter.it, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future
Component: mc-core | Releases
Resolution: | Version: 4.8.28
Blocked By: | Keywords: image, open,
Branch state: no branch | view, special characters
| Blocking:
| Votes for changeset:
-------------------------------------+-------------------------------------

Comment (by ro-ee):

Removing mc.ext or even completely removing .config/mc: still the same
(also if I use another account on the same computer).

I am not able to find a global mc.ext that might be used instead.

My locale is
LANG="en_US.TF-8"
LC_CTYPE="en_US.UTF-8"

I added debug code to the /usr/libexec/mc/ext.d/image.sh to see if it even
gets called, which is not the case (I have since reverted back these
changes, to make sure this isn’t the source of further issues)


Is there a way to print out the mc.ext which is currently in use? (i.e.
the built-in one)?


One add: this is the same for jpg, gif and png files (I’m only writing
this because in the current mc.ext (which I have since renamed), JPEG is
the only one which adds one additional View command, the PNG, GIF, ...
files directly refer to the Include=image part.

--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:3>

Ticket System

unread,
Jun 19, 2022, 12:51:35 AM6/19/22
to alex...@roalter.it, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future
Component: mc-core | Releases
Resolution: | Version: 4.8.28
Blocked By: | Keywords: image, open,
Branch state: no branch | view, special characters
| Blocking:
| Votes for changeset:
-------------------------------------+-------------------------------------

Comment (by andrew_b):

Replying to [comment:3 ro-ee]:


> I am not able to find a global mc.ext that might be used instead.

`mc -F` shows all directories used by mc.

> My locale is
> LANG="en_US.TF-8"
> LC_CTYPE="en_US.UTF-8"
>
> I added debug code to the /usr/libexec/mc/ext.d/image.sh to see if it
even gets called, which is not the case (I have since reverted back these
changes, to make sure this isn’t the source of further issues)
>
>
> Is there a way to print out the mc.ext which is currently in use? (i.e.
the built-in one)?

Usually, global mc.ext is /etc/mc/mc.ext. There is no any built-in one.

--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:4>

Ticket System

unread,
Jun 24, 2022, 10:53:43 PM6/24/22
to alex...@roalter.it, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future
Component: mc-core | Releases
Resolution: | Version: 4.8.28
Blocked By: | Keywords: image, open,
Branch state: no branch | view, special characters
| Blocking:
| Votes for changeset:
-------------------------------------+-------------------------------------

Comment (by dimich):

"type" key in mc.ext doesn't work properly with non-ascii file names
because {{{file}}} utility replaces non-ascii characters in output to its
octal codes and distorts a name. Midnight Commander then compares this
name to supplied name (in ext.c:regex_check_type()) and calculates
{{{content_shift}}} incorrectly, thus {{{mc_search_new()}}} fails.
It would be good to use {{{--brief}}} option of {{{file}}} if it's
supported on all platforms.
Also {{{--mime}}} option could make output parsing much easier and
deterministic.

--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:5>

Ticket System

unread,
Jun 25, 2022, 3:03:00 AM6/25/22
to alex...@roalter.it, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future
Component: mc-core | Releases
Resolution: | Version: 4.8.28
Blocked By: | Keywords: image, open,
Branch state: no branch | view, special characters
| Blocking:
| Votes for changeset:
-------------------------------------+-------------------------------------

Comment (by andrew_b):

Thank you for the analyzing.

Replying to [comment:5 dimich]:


> "type" key in mc.ext doesn't work properly with non-ascii file names
because {{{file}}} utility replaces non-ascii characters in output to its
octal codes and distorts a name.

Perhaps it depends on `file` version:
{{{
$ file testö.jpg
testö.jpg: JPEG image data, JFIF standard 1.02
$ file -v
file-4.26
magic file from /etc/magic:/usr/share/file/magic
}}}

> It would be good to use {{{--brief}}} option of {{{file}}} if it's
supported on all platforms.

It's a good idea.

> Also {{{--mime}}} option could make output parsing much easier and
deterministic.

Cannot see any the useful info:
{{{
testö.jpg, 1: Warning: offset `����' invalid
testö.jpg, 1: Warning: type `����' invalid
testö.jpg, 2: Warning: offset
`��Mh�b���^���E\XJH6=�\W>_��^�9*6\H������9����\� ��4 Ο' invalid
testö.jpg, 2: Warning: type
`��Mh�b���^���E\XJH6=�\W>_��^�9*6\H������9����\� ��4 [���Ο' invalid
�Hcy�����b 3: Warning: offset `p��X����^���T�hc��Ҹ�0E_��c���eI.�������k
[���5�
�;Ԍ&L���އ �B4mc��7��' invalid
�Hcy�����b 3: Warning: type `p��X����^���T�hc��Ҹ�0E_��c���eI.�������k
�;Ԍ&L���އ �B4mc��7��' invalid
testö.jpg, 4: Warning: offset `��iчY4r[`GH�Oή��"4�U���ƌ�E
}}}
Perhaps it depends on `file` version too.

--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:6>

Ticket System

unread,
Jun 25, 2022, 3:41:45 AM6/25/22
to alex...@roalter.it, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future
Component: mc-core | Releases
Resolution: | Version: 4.8.28
Blocked By: | Keywords: image, open,
Branch state: no branch | view, special characters
| Blocking:
| Votes for changeset:
-------------------------------------+-------------------------------------

Comment (by ro-ee):

I have file version 5.42

{{{
alex@horus:~> file -v
file-5.42
magic file from /etc/magic:/usr/share/misc/magic
seccomp support included
}}}

and get

{{{
alex@horus:~> file testö.jpg
test\303\266.jp: JPEG image data, JFIF standard 1.01, resolution (DPCM),
density 118x118, segment length 16, progressive, precision 8, 1706x1132,
components 3
}}}

notice that even the 'g' is missing in the filename.

Still, what I don’t understand that this does not happen with videos? or
isn’t 'file' not invoked in all cases, and .mp4 files are detected by
other means?

--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:7>

Ticket System

unread,
Jun 25, 2022, 6:41:41 AM6/25/22
to alex...@roalter.it, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future
Component: mc-core | Releases
Resolution: | Version: 4.8.28
Blocked By: | Keywords: image, open,
Branch state: no branch | view, special characters
| Blocking:
| Votes for changeset:
-------------------------------------+-------------------------------------

Comment (by ro-ee):

From a bug report in opensuse forums, where I first reported this,

[https://forums.opensuse.org/showthread.php/571604-(%E2%89%A5-0x80)?p=3137435#post3137435]

it looks like a patch made to 'file' on May 28th is to blame. There is
something wrong with the patch (even in -raw mde, because of the
shortening of the file name), but I think going with the -b option is the
better route to take.

--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:8>

Ticket System

unread,
Jun 25, 2022, 11:43:02 AM6/25/22
to alex...@roalter.it, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future
Component: mc-core | Releases
Resolution: | Version: 4.8.28
Blocked By: | Keywords: image, open,
Branch state: no branch | view, special characters
| Blocking:
| Votes for changeset:
-------------------------------------+-------------------------------------

Comment (by dimich):

Replying to [comment:6 andrew_b]:

> Perhaps it depends on `file` version

Filename conversion was introduced recently by this commit:
https://github.com/file/file/commit/f448f3e5c37de8c285ac14b032b2bdcea82fc08b
and it is already in file-5.42.


> > Also {{{--mime}}} option could make output parsing much easier and
deterministic.
> Cannot see any the useful info

{{{
$ file --brief --mime-type /tmp/testö.jpg
image/jpeg
$
$ file -v
file-5.42
magic file from /usr/share/file/misc/magic
seccomp support included
}}}

Replying to [comment:7 ro-ee]:


> Still, what I don’t understand that this does not happen with videos? or
isn’t 'file' not invoked in all cases, and .mp4 files are detected by
other means?

In default mc.ext videos are detected by filenames with "shell/regex"
keys, not by "type".

--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:9>

Ticket System

unread,
Jun 26, 2022, 1:09:13 PM6/26/22
to alex...@roalter.it, andrew....@gmail.com, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner: andrew_b
Type: defect | Status: accepted

Priority: minor | Milestone: Future
Component: mc-core | Releases
Resolution: | Version: 4.8.28
Blocked By: | Keywords: image, open,
Branch state: no branch | view, special characters
| Blocking:
| Votes for changeset:
-------------------------------------+-------------------------------------
Changes (by andrew_b):

* owner: => andrew_b
* status: new => accepted


--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:10>

Ticket System

unread,
Jun 26, 2022, 1:10:54 PM6/26/22
to alex...@roalter.it, andrew....@gmail.com, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner: andrew_b
Type: defect | Status: accepted
Priority: minor | Milestone: 4.8.29
Component: mc-core | Version: 4.8.28
Resolution: | Keywords: image, open,

Blocked By: | view, special characters
Branch state: on review | Blocking:
| Votes for changeset:
-------------------------------------+-------------------------------------
Changes (by andrew_b):

* branch_state: no branch => on review
* milestone: Future Releases => 4.8.29


Comment:

Branch: 4377_file_b
Initial changset:0bb9c0472033962aea4b682097d953fee73f01c2

--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:11>

Ticket System

unread,
Jul 3, 2022, 8:54:04 AM7/3/22
to alex...@roalter.it, andrew....@gmail.com, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner: andrew_b
Type: defect | Status: testing

Priority: minor | Milestone: 4.8.29
Component: mc-core | Version: 4.8.28
Resolution: fixed | Keywords: image, open,

Blocked By: | view, special characters
Branch state: merged | Blocking:
| Votes for changeset: committed-
| master
-------------------------------------+-------------------------------------
Changes (by andrew_b):

* status: accepted => testing
* votes: andrew_b => committed-master
* resolution: => fixed
* branch_state: approved => merged


Comment:

Merged to master: [ab63cd2a9454a51e8e654778f486caf820d6da06].
{{{
git log --pretty=oneline 6c4520874..ab63cd2a9
}}}

--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:13>

Ticket System

unread,
Jul 3, 2022, 8:54:05 AM7/3/22
to alex...@roalter.it, andrew....@gmail.com, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner: andrew_b
Type: defect | Status: accepted

Priority: minor | Milestone: 4.8.29
Component: mc-core | Version: 4.8.28
Resolution: | Keywords: image, open,

Blocked By: | view, special characters
Branch state: approved | Blocking:
| Votes for changeset: andrew_b
-------------------------------------+-------------------------------------
Changes (by andrew_b):

* votes: => andrew_b
* branch_state: on review => approved


--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:12>

Ticket System

unread,
Jul 3, 2022, 8:54:13 AM7/3/22
to alex...@roalter.it, andrew....@gmail.com, mc-...@googlegroups.com
#4377: "Image Open"/"Image View" does not work with special character in filename
-------------------------------------+-------------------------------------
Reporter: ro-ee | Owner: andrew_b
Type: defect | Status: closed

Priority: minor | Milestone: 4.8.29
Component: mc-core | Version: 4.8.28
Resolution: fixed | Keywords: image, open,

Blocked By: | view, special characters
Branch state: merged | Blocking:
| Votes for changeset: committed-
| master
-------------------------------------+-------------------------------------
Changes (by andrew_b):

* status: testing => closed


--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:14>

Reply all
Reply to author
Forward
0 new messages