[SOLVED] mc not opening html files ? (black screen)
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am not sure when this started to happen, but in recent monhts, and after some updates, at least more recent then Jul 11th.
It happens on Slack-14.2 with all updates to date.
Whenever I am in a console (via SSH, not X) and running mc, I press ENTER (open action) on a .html file, I get a black screen.
I press Ctrl-C, I get back to mc.
Previous, and expected behaviour, is, upon pressing ENTER, the file to be shown by links program.
I have tested and confirmed the problem on both distros, with all updates to date.
I have tested and seen the correct behaviour on a 14.1 system with updates to date.
I don't have a 14.2 installation with older (or no) updates available at this time.
All tested systems are full slackware installations.
Actually there looks to be something broken in:
/usr/libexec/mc/ext.d/web.sh
script which handles the open/view of html files, by using either konqueror or lynx, which is called by mc from its extension conf file:
/etc/mc/mc.ext
I tried to debug web.sh but failed so far to see lynx launched.
xdg-open looks to be the issue and the solution might come from freedesktop.org. I wish I could help further, but my patience and interest ends with "freedesktop.org", sorry. https://www.freedesktop.org/wiki/Software/xdg-utils/
To avoid modifying /usr/libexec/mc/ext.d/web.sh, you can also just modify ~/.config/mc/mc.ext as so:
Code:
# html
regex/i/\.html?$
#Open=/usr/libexec/mc/ext.d/web.sh open html
Open=links %f
View=%view{ascii} /usr/libexec/mc/ext.d/web.sh view html
But yes, by default it will try to use xdg-open to open the file. I tried using xdg-mime to change the default for text/html, but it can be tricky to get it to work. The environment variable $BROWSER seems to override the default, and that worked for me to get it to open html files with Chromium instead of Konqueror, but that approach didn't work when I set BROWSER=links.
Last edited by montagdude; 09-27-2018 at 08:49 PM.
These /usr/share/mc/bin/mc-wrapper.sh & /usr/share/mc/bin/mc-wrapper.csh fixes should maybe make their way upstream. If you're happy with the results, maybe write a post in the Requests for -current (14.2-->15.0) thread about this.
These /usr/share/mc/bin/mc-wrapper.sh & /usr/share/mc/bin/mc-wrapper.csh fixes should maybe make their way upstream. If you're happy with the results, maybe write a post in the Requests for -current (14.2-->15.0) thread about this.
What about the people who want to use xdg-open? I don't get why upstream would accept a patch that disables the default behavior they purposely implemented.
Last edited by montagdude; 09-28-2018 at 02:07 PM.
What about the people who want to use xdg-open? I don't get why upstream would accept a patch that disables the default behavior they purposely implemented.
This is only about Midnight Commander (mc). Does xdg-open in the mc handler work? Isn't it why this thread was started in the first place? Out of the links I presented above, I learned that you either provide xdg-open with a mime.types or disable its usage.
This is only about Midnight Commander (mc). Does xdg-open in the mc handler work? Isn't it why this thread was started in the first place? Out of the links I presented above, I learned that you either provide xdg-open with a mime.types or disable its usage.
Yeah, it works. I mean it successfully runs xdg-open on the file and opens it with the same application that would be used if you manually ran xdg-open file yourself from the command line. Getting xdg-open to use the application you really want is a different story, but that's not mc's concern.
I'm sorry, I cannot follow you, xdg-open doesn't work here with mc in both Slackware 14.2 and -current.
If I press Enter on a html file I get a blank screen, as originally reported by andrixnet, and this is what mc is doing:
In post #4 I was still investigating why I get a blank screen when I press Enter on a html file and considered that links might be faulty, looked after getting the html file opened in lynx instead. Only in post #5 I found out that xdg-open is the bugger.
If I modify the mc wrapper /usr/share/mc/bin/mc-wrapper.sh as described in post #8, then by pressing Enter on a html file I get it opened in links. Note that xdg-open si not launched anymore:
Code:
\_ /usr/bin/mc -P /tmp/mc-root/mc.pwd.3192
\_ bash -rcfile .bashrc
\_ /bin/sh /tmp/mc-root/mcextS6KZPZ
\_ /bin/sh /usr/libexec/mc/ext.d/web.sh open html
\_ /bin/sh /usr/libexec/mc/ext.d/web.sh open html
\_ links /test/test.html
For resolving the reported problem you could only modify the handler /usr/libexec/mc/ext.d/web.sh, as described in post #5, but it looks like all the handlers are making use of xdg-open and this might cause issues with other document types too. Modifying the general /usr/share/mc/bin/mc-wrapper.sh is therefore a better solution.
As described here in these links, xdg-open hangs because it cannot get a mime.types file, thus xdg-open is not properly integrated, and you either provide one (have no clue how to do that without interfering with other apps ... and also no patience with freedesktop.org stuff (stated before)) or you disable the xdg-open usage for Midnight Commander for good: http://midnight-commander-user-discu...td7574708.html https://midnight-commander.org/ticket/2118
Nevertheless, I personally don't really care about this issue with mc because in my limited use of it I only press Enter when browsing/changing folders, using F3/F4 when viewing/editing files. Pressing Enter on files can be dangerous, especially on laggy remote connections, where you could mistakenly execute something / script.
Last edited by abga; 09-28-2018 at 05:40 PM.
Reason: typo
Well, I don't know then. It works for me, possibly because I already have the necessary mime.types file on my system. I don't think that disabling xdg-open completely is the right fix. Maybe fora user who doesn't want to bother with it, but not for upstream. If they did want to do away with xdg-open, the right way to do it would be to remove it from the libexec scripts.
Last edited by montagdude; 09-28-2018 at 05:52 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.