"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
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>
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>
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>
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>
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>
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>
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>
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>
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>
* owner: => andrew_b
* status: new => accepted
--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:10>
* 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>
* 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>
* votes: => andrew_b
* branch_state: on review => approved
--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:12>
* status: testing => closed
--
Ticket URL: <http://www.midnight-commander.org/ticket/4377#comment:14>