LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-28-2018, 05:54 PM   #16
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929

Well, both Slackware systems I tested on are full installs without the KDE&KDEI package series. Maybe it's in some of these packages where you get a system wide default mime.types
 
Old 09-28-2018, 06:04 PM   #17
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by montagdude View Post
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.
Correction:
disabling xdg-open completely = disabling xdg-open completely for Midnight Commander (again)

You need to integrate xdg-utils (xdg-open included) properly and I agree with you on this. Apparently it's not and I don't know who can do it (who "they" could be). I don't have the knowledge/patience/interest to put up with freedesktop.org and I don't understand why xdg-open is needed for a text console file manager, why would you need X support for such an application and BTW, since when is konqueror the default web browser in Slackware?
 
Old 09-28-2018, 06:58 PM   #18
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Quote:
Originally Posted by abga View Post
Correction:
disabling xdg-open completely = disabling xdg-open completely for Midnight Commander (again)

You need to integrate xdg-utils (xdg-open included) properly and I agree with you on this. Apparently it's not and I don't know who can do it (who "they" could be). I don't have the knowledge/patience/interest to put up with freedesktop.org and I don't understand why xdg-open is needed for a text console file manager, why would you need X support for such an application and BTW, since when is konqueror the default web browser in Slackware?
A lot of people, myself included, use it commonly within an X session. If you look at the scripts, it's supposed to skip the xdg-open stuff if $DISPLAY is not set, like would be the case in a non-X session (I think). As an aside, I use it at work too, on Red Hat with Gnome, and it works correctly with xdg-open there too. I think maybe there's only a problem if you are running within an X session with xdg-open present but not configured. Maybe there needs to be some better error checking, either in xdg-open or the mc libexec scripts, to detect when xdg-open is not able to find an application to open the file.
 
1 members found this post helpful.
Old 09-28-2018, 11:32 PM   #19
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by montagdude View Post
A lot of people, myself included, use it commonly within an X session. If you look at the scripts, it's supposed to skip the xdg-open stuff if $DISPLAY is not set, like would be the case in a non-X session (I think). As an aside, I use it at work too, on Red Hat with Gnome, and it works correctly with xdg-open there too. I think maybe there's only a problem if you are running within an X session with xdg-open present but not configured. Maybe there needs to be some better error checking, either in xdg-open or the mc libexec scripts, to detect when xdg-open is not able to find an application to open the file.
I don't want to disagree with you about "a lot of people", but when I see that statement I always ask myself how many?
Now, leaving jokes aside, you can check in other distros, as you said you use, what environmental settings are configured for helping xdg-uils. Don't enter X, just use console and check if mc is doing fine there.
I'm not interested in spending (wasting) time on most of freedesktop.org projects because I'm looking for a finality in my approaches/interests and these projects are far from being well designed and documented. Just for a check, I did run a man xdg-open:
Code:
xdg-open is for use inside a desktop session only. It is not recommended to use xdg-open as root.
All my questions are answered now, xdg-open has no place in console mode and especially bundled with mc, which "a lot of people" are using as root.
 
Old 09-28-2018, 11:37 PM   #20
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Quote:
Originally Posted by abga View Post
I don't want to disagree with you about "a lot of people", but when I see that statement I always ask myself how many?
Now, leaving jokes aside, you can check in other distros, as you said you use, what environmental settings are configured for helping xdg-uils. Don't enter X, just use console and check if mc is doing fine there.
I'm not interested in spending (wasting) time on most of freedesktop.org projects because I'm looking for a finality in my approaches/interests and these projects are far from being well designed and documented. Just for a check, I did run a man xdg-open:
Code:
xdg-open is for use inside a desktop session only. It is not recommended to use xdg-open as root.
All my questions are answered now, xdg-open has no place in console mode and especially bundled with mc, which "a lot of people" are using as root.
Not to come across as rude, but this isn't really the place for this discussion. You would have to take it up with the Midnight Commander developers. I don't really care either way.
 
Old 09-28-2018, 11:53 PM   #21
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by montagdude View Post
Not to come across as rude, but this isn't really the place for this discussion. You would have to take it up with the Midnight Commander developers. I don't really care either way.
Nothing to be rude about here. It is the place for the discussion, because it's here I provided a very simple fix and suggested to andrixnet to ask for a change request to ditch that xdg-open from mc, if he feels so, and you opposed. Nothing to discuss with the MC developers either, they did discuss this rather uninspired modification (development driven by boredom - as I call it) in this ticket:
https://midnight-commander.org/ticket/2118
As a Slacker, I believe that Slackware took all these Midnight Commander modifications from upstream and ended up now with a faulty mc. I also believe that there are plenty of graphical file managers under X and mc should be and stay functional in console mode.
 
Old 09-29-2018, 12:16 AM   #22
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Quote:
Originally Posted by abga View Post
Nothing to be rude about here. It is the place for the discussion, because it's here I provided a very simple fix and suggested to andrixnet to ask for a change request to ditch that xdg-open from mc, if he feels so, and you opposed. Nothing to discuss with the MC developers either, they did discuss this rather uninspired modification (development driven by boredom - as I call it) in this ticket:
https://midnight-commander.org/ticket/2118
As a Slacker, I believe that Slackware took all these Midnight Commander modifications from upstream and ended up now with a faulty mc. I also believe that there are plenty of graphical file managers under X and mc should be and stay functional in console mode.
Having looked at this yesterday, my memory was apparently faulty. I thought I had seen that mc was doing some sort of checking to see if the $DISPLAY environment variable was set, and only running xdg-open if it was. If that were the case, it would in theory work correctly for both graphical and console sessions. Looking back into the mc libexec scripts again, I can see that this is not the case. So I'm going to change my mind and agree with you that the implementation is broken for console sessions. Someone can bring it up in the Requests for -current thread, but I still think that it would be better to report it upstream.

A quick test confirms that this change works to skip xdg-open in console sessions without disabling it in graphical sessions:

Code:
--- web.sh      2018-09-29 01:11:09.374591495 -0400
+++ web.sh.new  2018-09-29 01:10:56.198132843 -0400
@@ -46,8 +46,12 @@
     do_view_action "${filetype}"
     ;;
 open)
-    ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
+    if [ -n "$DISPLAY" ]; then
+        ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
+            do_open_action "${filetype}"
+    else
         do_open_action "${filetype}"
+    fi
     ;;
 *)
     ;;
Similar changes would have to be made to all the other scripts in /usr/libexec/mc/ext.d. I think this is a much better general solution than disabling xdg-open altogether.
 
Old 09-29-2018, 03:52 PM   #23
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
I was also considering such a conditional check, but not confident enough that by only verifying if $DISPLAY is not null will suffice to know if I'm in text console or under X, and if xdg-open is only needing X to be launched.

However, again, I can't follow you with your approach in modifying 9 files instead of only adding the conditional check to the already existing "general" mc wrapper. I tested the following modifications and mc is now happy on both console, not using xdg-open, and X, using xdg-open. While modifying the wrappers I mistakenly disabled xdg-open under X and noticed that konqueror (yes, I installed KDE )was still launched from within /usr/libexec/mc/ext.d/web.sh, which led me to ask myself what's the purpose of xdg-open at all ?

Anyways, here are the tested patches for the mc wrappers found in /usr/share/mc/bin :
Code:
--- mc-wrapper.sh       2018-09-29 21:48:04.143033435 +0300
+++ mc-wrapper.sh.new   2018-09-29 21:59:51.392024247 +0300
@@ -1,6 +1,11 @@
 MC_USER=`id | sed 's/[^(]*(//;s/).*//'`
 MC_PWD_FILE="${TMPDIR-/tmp}/mc-$MC_USER/mc.pwd.$$"
-/usr/bin/mc -P "$MC_PWD_FILE" "$@"
+
+if [ -n "$DISPLAY" ]; then
+ /usr/bin/mc -P "$MC_PWD_FILE" "$@"
+else
+ MC_XDG_OPEN=false /usr/bin/mc -P "$MC_PWD_FILE" "$@"
+fi
 
 if test -r "$MC_PWD_FILE"; then
        MC_PWD="`cat "$MC_PWD_FILE"`"
@@ -12,3 +17,4 @@
 
 rm -f "$MC_PWD_FILE"
 unset MC_PWD_FILE
+unset MC_XDG_OPEN
- some of you more knowledgeable in csh might optimize this code, it works but the ifs are nested:
Code:
--- mc-wrapper.csh      2018-09-29 22:08:04.143033435 +0300
+++ mc-wrapper.csh.new  2018-09-29 22:34:52.639063427 +0300
@@ -6,7 +6,17 @@
        setenv MC_PWD_FILE /tmp/mc-$MC_USER/mc.pwd.$$
 endif
 
-/usr/bin/mc -P "$MC_PWD_FILE" $*
+if (! $?DISPLAY) then
+  setenv MC_XDG_OPEN false
+  /usr/bin/mc -P "$MC_PWD_FILE" $*
+else
+ if ("$DISPLAY" == "")  then
+  setenv MC_XDG_OPEN false
+  /usr/bin/mc -P "$MC_PWD_FILE" $*
+ else
+  /usr/bin/mc -P "$MC_PWD_FILE" $*
+ endif
+endif
 
 if (-r "$MC_PWD_FILE") then
        setenv MC_PWD "`cat '$MC_PWD_FILE'`"
@@ -18,3 +28,4 @@
 
 rm -f "$MC_PWD_FILE"
 unsetenv MC_PWD_FILE
+unsetenv MC_XDG_OPEN

Last edited by abga; 09-29-2018 at 04:27 PM. Reason: err - csh script : +unset MC_XDG_OPEN = +unsetenv MC_XDG_OPEN
 
Old 09-29-2018, 07:38 PM   #24
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Quote:
Originally Posted by abga View Post
However, again, I can't follow you with your approach in modifying 9 files instead of only adding the conditional check to the already existing "general" mc wrapper.
Because it is the scripts that are broken, and therefore it is the scripts that need to be fixed. Changing the wrapper is perfectly fine as a workaround, but it is not a fix. Not everyone uses the wrapper anyway; if you just install Midnight Commander and type 'mc,' the wrapper is not invoked. You have to manually set up an alias to use it.

My responses are in the context of reporting this upstream, and what approach I would recommend to fix the issue. Making the same modification to 9 files is trivially easy.

Last edited by montagdude; 09-29-2018 at 07:40 PM.
 
1 members found this post helpful.
Old 09-29-2018, 08:36 PM   #25
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by montagdude View Post
Not everyone uses the wrapper anyway; if you just install Midnight Commander and type 'mc,' the wrapper is not invoked. You have to manually set up an alias to use it.
Sorry, I only care about Slackware and the wrapper together with the alias (/etc/profile.d/mc.(c)sh) are part of the mc package that everyone on Slackware uses. Check for yourself:
https://mirror.de.leaseweb.net/slack...6-x86_64-2.txz

Quote:
Originally Posted by montagdude View Post
My responses are in the context of reporting this upstream, and what approach I would recommend to fix the issue. Making the same modification to 9 files is trivially easy.
Well then, open a ticket with the devs @ Midnight Commander, what can I say, good luck with that!
For inspiration, maybe you missed these links, you get here a fellow Slacker wondering what hit him:
http://midnight-commander-user-discu...td7574708.html
And here you can maybe (necro)revive this old ticket:
https://midnight-commander.org/ticket/2118

If you need my support, please ask them first if they still want to keep mc as a console file manager, if positive, send them my appreciations and ask them on my behalf to shove xdg-open up their arses. Nothing personal, just technical.

Last edited by abga; 09-29-2018 at 08:38 PM. Reason: typo
 
Old 10-01-2018, 01:25 AM   #26
andrixnet
Member
 
Registered: Oct 2012
Location: Romania
Distribution: Slackware
Posts: 167

Original Poster
Rep: Reputation: Disabled
Thank you @abga for your insight and uspport.

What are the steps to integrate this upstream?
And by that I mean at least in Slackware as distro?
 
Old 10-01-2018, 01:21 PM   #27
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by andrixnet View Post
Thank you @abga for your insight and uspport.

What are the steps to integrate this upstream?
And by that I mean at least in Slackware as distro?
AFAIK, there are no official steps to report a bug, but only to raise/resolve/discuss it here in the forum.
In one of my previous posts I advised you to post a change request in the request-for-current thread, at least for -current:
https://www.linuxquestions.org/quest...-a-4175620463/
With the latest developments, point it to my post #23, where I presented the patches for the mc-wrappers. I tested those patches, and mc is happy now in both Slackware 14.2 stable & current, checking before launching xdg-open, if it's executed in a text console & under X, individually and in parallel. The only issue I encountered was patching the csh script, as I'm not savvy with csh and didn't know how to handle the situation in which $DISPLAY is not defined at all, thus the nested if statements, but it's working fine.
This problem also affects the Slackware stable release and I hope Patrick has seen this thread, it was in the top of the threads list for some days due to my exchange with montagdude, and maybe considering to patch the stable too.
Even if montagdude is pursuing a bug report/resolution with the Midnight Commander devs to patch all their handlers in /usr/libexec/mc/ext.d/, not sure if it'll ever materialize, I believe Slackware should handle this issue on its own.

Last edited by abga; 10-02-2018 at 02:31 PM. Reason: chs=csh +h
 
Old 10-01-2018, 02:27 PM   #28
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Quote:
Originally Posted by abga View Post
Even if montagdude is pursuing a bug report/resolution with the Midnight Commander devs to patch all their handlers in /usr/libexec/mc/ext.d/, not sure if it'll ever materialize, I believe Slackware should handle this issue on its own.
I should, but it's not high on my list of things to do. I will try to get to it sometime, but report away on the Requests for -current thread.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen goes black on opening Dash on Ubuntu 17.04 vedk Linux - Laptop and Netbook 2 09-14-2017 09:01 PM
Acer A0A 110 has a black screen during boot up along with a black cursor sw3etpinay Linux - Newbie 23 12-29-2010 11:05 AM
Ubuntu 10.04 Lucid Lynx goes to black screen when opening Myspace DWXVI Linux - Newbie 5 05-16-2010 09:38 AM
Application tab gone. Where is Trash? Opening .HTML files Margaret Lowder Linux - Software 4 08-25-2008 03:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration