GNU bug report logs -
#25778
25.1; [PATCH] Drastically simplify xdg-open check
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25778 in the body.
You can then email your comments to 25778 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25778
; Package
emacs
.
(Fri, 17 Feb 2017 18:18:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Vasilij Schneidermann <v.schneidermann <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 17 Feb 2017 18:18:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
A user on #emacs brought it to my attention that the xdg-open detection
for browse-url is more complex than it should be and fails detecting
their Linux desktop. Looking at the definition of
`browse-url-can-use-xdg-open' reveals that it replicates the desktop
environment check as done by `xdg-open` (which is done to detect the
DE-specific default browser setting, not to prevent people not using a
popular desktop environment from using xdg-open). As enumerating all
possible kinds of Linux desktop is a futile endeavor, I've completely
eliminated this check from it so that the only ones left are whether
we're in a graphical session (by checking $DISPLAY) and whether
`xdg-open` has been found on $PATH.
[0001-Drastically-simplify-check-for-xdg-open.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25778
; Package
emacs
.
(Fri, 17 Feb 2017 18:39:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 25778 <at> debbugs.gnu.org (full text, mbox):
> From: Vasilij Schneidermann <v.schneidermann <at> gmail.com>
> Date: Fri, 17 Feb 2017 19:16:48 +0100
>
> A user on #emacs brought it to my attention that the xdg-open detection
> for browse-url is more complex than it should be and fails detecting
> their Linux desktop. Looking at the definition of
> `browse-url-can-use-xdg-open' reveals that it replicates the desktop
> environment check as done by `xdg-open` (which is done to detect the
> DE-specific default browser setting, not to prevent people not using a
> popular desktop environment from using xdg-open). As enumerating all
> possible kinds of Linux desktop is a futile endeavor, I've completely
> eliminated this check from it so that the only ones left are whether
> we're in a graphical session (by checking $DISPLAY) and whether
> `xdg-open` has been found on $PATH.
First, checking $DISPLAY doesn't yet mean you are in a GUI frame. We
have display-graphic-p for that.
And second, I don't understand what will happen with all the bugs
mentioned in the comments if we remove the code that was supposed to
avoid hitting them. Maybe I'm missing something obvious.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25778
; Package
emacs
.
(Fri, 17 Feb 2017 18:56:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 25778 <at> debbugs.gnu.org (full text, mbox):
> First, checking $DISPLAY doesn't yet mean you are in a GUI frame. We
> have display-graphic-p for that.
The assumption that you need to be in a GUI frame is incorrect. If I
run `emacs -nw` in a graphical terminal emulator, why would that prevent
me from opening a graphical browser? The only way I see to detect
whether a graphical browser can be opened is by checking for X with
$DISPLAY.
> And second, I don't understand what will happen with all the bugs
> mentioned in the comments if we remove the code that was supposed to
> avoid hitting them. Maybe I'm missing something obvious.
OK, I'll go through them all for completeness' sake:
- bug#7166: This one arises from using /bin/sh in combination with
`nohup` for launching xdg-open, resulting in a lack of shell quoting.
As `xdg-open` is launched directly, it's no longer relevant and only
mentioned because of `nohup` (which is no longer used either).
- bug#8917: The old usage of `call-process` has made `nohup` obsolete.
Irrelevant as `nohup` isn't used any longer.
- bug#9779: Extension of the now removed xdg-open DE detection logic,
together with some discussion whether nohup is still necessary. Some
voices in favor of not doing any unnecessary detection.
- The linked emacs-devel thread: Sighting of a possible bug in
gnome-open. As `nohup` is no longer used, there's no way this could
have been worked around with its usage
Summary: All linked bugs are related to `nohup` which is only checked
for, but not actually used. Therefore they can be disregarded.
Do you have any actual objections based on a situation where one would
*not* want to use xdg-open, even though it's installed and the user in a
X11 session?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25778
; Package
emacs
.
(Sat, 18 Feb 2017 03:40:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 25778 <at> debbugs.gnu.org (full text, mbox):
The area seems a mess, but:
1) nohup was removed from browse-url-xdg-open in 1c0f1a199ca, with no
explanation and as part of a change that seems unrelated.
2) In https://debbugs.gnu.org/9779#20, the author of that change said
I note that since 22-Jun-2011 browse-url-xdg-open no longer uses
nohup. This is either a mistake on my part (I didn't read the
comment in browse-url-can-use-xdg-open) or it is indeed
unnecessary and therefore isn't a requirement for xdg-open.
3) In reply, Jan said in https://debbugs.gnu.org/9779#29
See discussion at
http://lists.gnu.org/archive/html/emacs-devel/2009-07/msg00279.html.
nohup is still needed for xdg-open.
And AFAICS that was the last comment about nohup. No-one ever seems to
have followed up Jan's comment.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25778
; Package
emacs
.
(Sat, 18 Feb 2017 03:47:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 25778 <at> debbugs.gnu.org (full text, mbox):
PS Maybe you are just saying that since no-one (?) complained since
then, nohup can't have been needed after all. It would be better to test
it, though. It seems difficult to test all the possibilities for
xdg-open.
Ref https://debbugs.gnu.org/25234
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25778
; Package
emacs
.
(Sat, 18 Feb 2017 07:59:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 25778 <at> debbugs.gnu.org (full text, mbox):
> Date: Fri, 17 Feb 2017 19:55:14 +0100
> From: Vasilij Schneidermann <v.schneidermann <at> gmail.com>
> Cc: 25778 <at> debbugs.gnu.org
>
> > First, checking $DISPLAY doesn't yet mean you are in a GUI frame. We
> > have display-graphic-p for that.
>
> The assumption that you need to be in a GUI frame is incorrect. If I
> run `emacs -nw` in a graphical terminal emulator, why would that prevent
> me from opening a graphical browser? The only way I see to detect
> whether a graphical browser can be opened is by checking for X with
> $DISPLAY.
In that case, maybe we shouldn't test $DISPLAY at all? Why restrict
this to X if xdg-open is already tested for availability?
> Do you have any actual objections based on a situation where one would
> *not* want to use xdg-open, even though it's installed and the user in a
> X11 session?
See Glenn's response about that. I think we should be more careful
with these issues, and at least do some more research of them before
we can be sure they are no longer relevant. If you could follow up on
that, it would be great.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25778
; Package
emacs
.
(Sat, 18 Feb 2017 08:51:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 25778 <at> debbugs.gnu.org (full text, mbox):
> In that case, maybe we shouldn't test $DISPLAY at all? Why restrict
> this to X if xdg-open is already tested for availability?
To quote its man page: "xdg-open is for use inside a desktop session
only.". If you attempt using it outside one (like, on the Linux
console), M-x browse-url fails silently.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25778
; Package
emacs
.
(Sat, 18 Feb 2017 08:56:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 25778 <at> debbugs.gnu.org (full text, mbox):
> PS Maybe you are just saying that since no-one (?) complained since
> then, nohup can't have been needed after all.
Pretty much. Note that `gnome-open` belongs to GNOME 2 which last
release has been in 2010. Only Debian Squeeze is offering it in its
package archives and as that one has been EOL'd, I don't see any reason
to pursue it any further. If `gvfs-open` exhibits the same behavior,
maybe, but I still consider it upstream's fault if they have weird open
behavior, not an area of Emacs to clumsily work around.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25778
; Package
emacs
.
(Sun, 19 Feb 2017 00:32:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 25778 <at> debbugs.gnu.org (full text, mbox):
Vasilij Schneidermann wrote:
> If `gvfs-open` exhibits the same behavior,
It does. https://bugzilla.gnome.org/show_bug.cgi?id=652262
And https://debbugs.gnu.org/25234, as previously mentioned.
> maybe, but I still consider it upstream's fault
As you can see from that above report, they don't show any signs of
fixing it.
> if they have weird open behavior, not an area of Emacs to clumsily
> work around.
The people who implemented support for xdg-open in Emacs disagreed.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25778
; Package
emacs
.
(Sun, 19 Feb 2017 13:07:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 25778 <at> debbugs.gnu.org (full text, mbox):
> As you can see from that above report, they don't show any signs of
> fixing it.
Well, fine. I'm sorry for not noticing a five year old piece of code
that got mistakenly removed without anyone complaining. What I don't
understand is why my patch (removing IMHO unnecessary DE detection) is
related to using nohup to work around a problem with xdg-open and
gnome-open/gvfs-open. If you consider fixing the nohup problem a
prerequisite before this patch can be applied, OK, do that then, I can
wait until that's done and recommence discussion on the other issue.
That aside, I cannot reproduce any weird behavior, be it with or without
nohup and gvfs-open. Both `(call-process "gvfs-open" nil 0 nil
"foo.pdf")` and `(call-process "nohup" nil 0 nil "gvfs-open"
"foo.pdf")` spawn my PDF reader successfully and don't do anything weird
after closing it. Same if I pass "http://ix.de/" as last argument. I
therefore consider the nohup issue a case of cargo-culting and would
like to drop its discussion entirely as it does not help with the
current issue.
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Fri, 10 Mar 2017 03:14:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Vasilij Schneidermann <v.schneidermann <at> gmail.com>
:
bug acknowledged by developer.
(Fri, 10 Mar 2017 03:14:02 GMT)
Full text and
rfc822 format available.
Message #37 received at 25778-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thanks for the bug report. I installed the attached somewhat-more-ambitious
patch that works along the line that you suggested. Although every heuristic in
this area will be wrong sometimes, I think nowadays we're probably better off
simply using xdg-open if it's available and if there's a display.
It turns out that nohup is ineffective on xdg-open, as xdg-open's child does a
'signal (SIGHUP, SIG_DFL)' before it execs (!). This may help to explain why
nobody noticed when Emacs stopped using nohup. Although nohup may have been
needed for ancient GNOME versions, I don't think we need to worry about these
old GNOME versions in future Emacs releases.
I'm closing the bug report as I think the bug is fixed. We can reopen it if I'm
wrong.
[0001-Simplify-checks-for-xdg-open-and-xdg-email.patch (text/x-diff, attachment)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 07 Apr 2017 11:24:05 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 15 Feb 2018 02:15:02 GMT)
Full text and
rfc822 format available.
Merged 18986 25778.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 15 Feb 2018 02:15:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 16 Mar 2018 11:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 96 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.