GNU bug report logs - #4951
23.1.50; browse-url-default-windows-browser bug + patch

Previous Next

Package: emacs;

Reported by: Lennart Borgman <lennart.borgman <at> gmail.com>

Date: Wed, 18 Nov 2009 01:50:04 UTC

Severity: normal

Tags: moreinfo

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4951 in the body.
You can then email your comments to 4951 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4951; Package emacs. (Wed, 18 Nov 2009 01:50:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lennart Borgman <lennart.borgman <at> gmail.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 18 Nov 2009 01:50:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.1.50; browse-url-default-windows-browser bug + patch
Date: Wed, 18 Nov 2009 02:46:31 +0100
[Message part 1 (text/plain, inline)]
browse-url-default-windows-browser does not work any longer. I am unsure
when it stopped working, but on at least Windows XP the attached patch
seems necessary. Could we please apply this as soon as possible so it
will get tested?



In GNU Emacs 23.1.50.1 (i386-mingw-nt5.1.2600)
 of 2009-10-15
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags
-Ic:/g/include -fno-crossjumping'
[browse-url.patch (text/x-diff, attachment)]

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4951; Package emacs. (Wed, 18 Nov 2009 03:40:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 18 Nov 2009 03:40:05 GMT) Full text and rfc822 format available.

Message #10 received at 4951 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 4951 <at> debbugs.gnu.org
Subject: Re: bug#4951: 23.1.50; browse-url-default-windows-browser bug + patch
Date: Tue, 17 Nov 2009 22:35:13 -0500
> browse-url-default-windows-browser does not work any longer.  I am
> unsure when it stopped working, but on at least Windows XP the
> attached patch seems necessary.  Could we please apply this as soon as
> possible so it will get tested?

Could you explain why it's necessary?  I mean I understand you say that
the current doesn't work, but I'd like to understand why it doesn't work.


        Stefan



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4951; Package emacs. (Wed, 18 Nov 2009 03:50:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lennart Borgman <lennart.borgman <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 18 Nov 2009 03:50:05 GMT) Full text and rfc822 format available.

Message #15 received at 4951 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 4951 <at> debbugs.gnu.org
Subject: Re: bug#4951: 23.1.50; browse-url-default-windows-browser bug + patch
Date: Wed, 18 Nov 2009 04:41:23 +0100
On Wed, Nov 18, 2009 at 4:35 AM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>> browse-url-default-windows-browser does not work any longer.  I am
>> unsure when it stopped working, but on at least Windows XP the
>> attached patch seems necessary.  Could we please apply this as soon as
>> possible so it will get tested?
>
> Could you explain why it's necessary?  I mean I understand you say that
> the current doesn't work, but I'd like to understand why it doesn't work.

No, I do not understand why it is necessary ... ;-)

There are two changes:

1) file: => file:///

This was discussed some time ago (a yr or two?) and it looks like this
is a more correct syntax for the file URL.

2) Changing the verb to w32-shell-execute (ShellExecute) from "open"
to nil is for some reason I do not know necessary. The answer to why
hides deep within the w32 registry and maybe some knowledgeable
persons at MS... It might be a mismatch of some kind, I don't know. I
believe the verbs are not that well thought out and used all the time.
Probably the registry entry has taken over from the program code
(which give users and other programs better possibilities).



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4951; Package emacs. (Wed, 18 Nov 2009 06:00:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jason Rumney <jasonr <at> f2s.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 18 Nov 2009 06:00:04 GMT) Full text and rfc822 format available.

Message #20 received at 4951 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Jason Rumney <jasonr <at> f2s.com>
To: Lennart Borgman <lennart.borgman <at> gmail.com>,
        4951 <at> debbugs.gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#4951: 23.1.50; browse-url-default-windows-browser bug + patch
Date: Wed, 18 Nov 2009 13:54:21 +0800
Lennart Borgman wrote:
> On Wed, Nov 18, 2009 at 4:35 AM, Stefan Monnier
> <monnier <at> iro.umontreal.ca> wrote:
>   
>>> browse-url-default-windows-browser does not work any longer.  I am
>>> unsure when it stopped working, but on at least Windows XP the
>>> attached patch seems necessary.  Could we please apply this as soon as
>>> possible so it will get tested?
>>>       
>> Could you explain why it's necessary?  I mean I understand you say that
>> the current doesn't work, but I'd like to understand why it doesn't work.
>>     
>
> No, I do not understand why it is necessary ... ;-)
>
> There are two changes:
>
> 1) file: => file:///
>
> This was discussed some time ago (a yr or two?) and it looks like this
> is a more correct syntax for the file URL.
>   

Is it actually needed, or is this purely an aesthetic thing? The RFCs 
are not clear whether either is more correct, as the file: scheme is not 
explicitly defined, and not all URL schemes require a server to be 
specified before the file path. As far as I can tell, either option is 
accepted by Windows itself, but if the association passes the URL intact 
rather than after converting to a file argument by Windows, then there 
may be applications that accept one but not the other.

IIRC the main reason for using file: rather than file:/// was that if 
the same code is used on all platforms, then the former works, while the 
latter does not (too many / when combined with posix paths).  But as 
this is now in a (windows-nt msdos cygwin) conditional, that is not 
really important, and we should use what works.


> 2) Changing the verb to w32-shell-execute (ShellExecute) from "open"
> to nil is for some reason I do not know necessary. The answer to why
> hides deep within the w32 registry and maybe some knowledgeable
> persons at MS... It might be a mismatch of some kind, I don't know. I
> believe the verbs are not that well thought out and used all the time.
> Probably the registry entry has taken over from the program code
> (which give users and other programs better possibilities).
>   

It is likely a misconfiguration on your system. "open" is the standard 
verb for opening files, and should avoid the security problems 
associated with using nil for executable file types where the system's 
default action is something other than "open".





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4951; Package emacs. (Wed, 18 Nov 2009 13:10:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lennart Borgman <lennart.borgman <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 18 Nov 2009 13:10:06 GMT) Full text and rfc822 format available.

Message #25 received at 4951 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Jason Rumney <jasonr <at> f2s.com>
Cc: 4951 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#4951: 23.1.50; browse-url-default-windows-browser bug + patch
Date: Wed, 18 Nov 2009 14:00:13 +0100
On Wed, Nov 18, 2009 at 6:54 AM, Jason Rumney <jasonr <at> f2s.com> wrote:
> Lennart Borgman wrote:
>>
>> On Wed, Nov 18, 2009 at 4:35 AM, Stefan Monnier
>> <monnier <at> iro.umontreal.ca> wrote:
>>
>>>>
>>>> browse-url-default-windows-browser does not work any longer.  I am
>>>> unsure when it stopped working, but on at least Windows XP the
>>>> attached patch seems necessary.  Could we please apply this as soon as
>>>> possible so it will get tested?
>>>>
>>>
>>> Could you explain why it's necessary?  I mean I understand you say that
>>> the current doesn't work, but I'd like to understand why it doesn't work.
>>>
>>
>> No, I do not understand why it is necessary ... ;-)
>>
>> There are two changes:
>>
>> 1) file: => file:///
>>
>> This was discussed some time ago (a yr or two?) and it looks like this
>> is a more correct syntax for the file URL.
>>
>
> Is it actually needed, or is this purely an aesthetic thing? The RFCs are
> not clear whether either is more correct, as the file: scheme is not
> explicitly defined, and not all URL schemes require a server to be specified
> before the file path. As far as I can tell, either option is accepted by
> Windows itself, but if the association passes the URL intact rather than
> after converting to a file argument by Windows, then there may be
> applications that accept one but not the other.
>
> IIRC the main reason for using file: rather than file:/// was that if the
> same code is used on all platforms, then the former works, while the latter
> does not (too many / when combined with posix paths).  But as this is now in
> a (windows-nt msdos cygwin) conditional, that is not really important, and
> we should use what works.


This is perhaps not needed, but it seems more consistent and I
therefore thinks that there is a better chance that this works. (I
have been using this very long, but I can't remember any more why I
switched.)


>> 2) Changing the verb to w32-shell-execute (ShellExecute) from "open"
>> to nil is for some reason I do not know necessary. The answer to why
>> hides deep within the w32 registry and maybe some knowledgeable
>> persons at MS... It might be a mismatch of some kind, I don't know. I
>> believe the verbs are not that well thought out and used all the time.
>> Probably the registry entry has taken over from the program code
>> (which give users and other programs better possibilities).
>>
>
> It is likely a misconfiguration on your system. "open" is the standard verb
> for opening files, and should avoid the security problems associated with
> using nil for executable file types where the system's default action is
> something other than "open".


You might be right. I thought that file:/// was special and would
always be opened in a web browser, but that is maybe not at all true.

I do not know how Windows handles this. Are there any special w32
registry entries for file: that you are aware of?

Just looking at Explorer under Tools - Folder Options and then File
Types it looks like the file:/// URL is not handled special since
there is no entry there for this URL type, but that is not correct. It
is handled specially. Here are some tests I have made:

  (w32-shell-execute "open" "c:/some/file.html") ;; OK
  (w32-shell-execute nil "file:c:/some/file.html") ;; OK
  (w32-shell-execute nil "file:///c:/some/file.html") ;; OK
  (w32-shell-execute "open" "file:///c:/some/file.html") ;; Doesn't work
  (w32-shell-execute "open" "file:c:/some/file.html") ;; Doesn't work



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4951; Package emacs. (Thu, 19 Nov 2009 04:45:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lennart Borgman <lennart.borgman <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 19 Nov 2009 04:45:07 GMT) Full text and rfc822 format available.

Message #30 received at 4951 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Jason Rumney <jasonr <at> f2s.com>
Cc: 4951 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#4951: 23.1.50; browse-url-default-windows-browser bug + patch
Date: Thu, 19 Nov 2009 05:37:05 +0100
On Wed, Nov 18, 2009 at 2:00 PM, Lennart Borgman
<lennart.borgman <at> gmail.com> wrote:
> On Wed, Nov 18, 2009 at 6:54 AM, Jason Rumney <jasonr <at> f2s.com> wrote:
>> Lennart Borgman wrote:
>>>
>>> On Wed, Nov 18, 2009 at 4:35 AM, Stefan Monnier
>>> <monnier <at> iro.umontreal.ca> wrote:
>>>
>>>>>
>>>>> browse-url-default-windows-browser does not work any longer.  I am
>>>>> unsure when it stopped working, but on at least Windows XP the
>>>>> attached patch seems necessary.  Could we please apply this as soon as
>>>>> possible so it will get tested?
>>>>>
>>>>
>>>> Could you explain why it's necessary?  I mean I understand you say that
>>>> the current doesn't work, but I'd like to understand why it doesn't work.
>>>>
>>>
>>> No, I do not understand why it is necessary ... ;-)
>>>
>>> There are two changes:
>>>
>>> 1) file: => file:///
>>>
>>> This was discussed some time ago (a yr or two?) and it looks like this
>>> is a more correct syntax for the file URL.
>>>
>>
>> Is it actually needed, or is this purely an aesthetic thing? The RFCs are
>> not clear whether either is more correct, as the file: scheme is not
>> explicitly defined, and not all URL schemes require a server to be specified
>> before the file path. As far as I can tell, either option is accepted by
>> Windows itself, but if the association passes the URL intact rather than
>> after converting to a file argument by Windows, then there may be
>> applications that accept one but not the other.
>>
>> IIRC the main reason for using file: rather than file:/// was that if the
>> same code is used on all platforms, then the former works, while the latter
>> does not (too many / when combined with posix paths).  But as this is now in
>> a (windows-nt msdos cygwin) conditional, that is not really important, and
>> we should use what works.
>
>
> This is perhaps not needed, but it seems more consistent and I
> therefore thinks that there is a better chance that this works. (I
> have been using this very long, but I can't remember any more why I
> switched.)
>
>
>>> 2) Changing the verb to w32-shell-execute (ShellExecute) from "open"
>>> to nil is for some reason I do not know necessary. The answer to why
>>> hides deep within the w32 registry and maybe some knowledgeable
>>> persons at MS... It might be a mismatch of some kind, I don't know. I
>>> believe the verbs are not that well thought out and used all the time.
>>> Probably the registry entry has taken over from the program code
>>> (which give users and other programs better possibilities).
>>>
>>
>> It is likely a misconfiguration on your system. "open" is the standard verb
>> for opening files, and should avoid the security problems associated with
>> using nil for executable file types where the system's default action is
>> something other than "open".
>
>
> You might be right. I thought that file:/// was special and would
> always be opened in a web browser, but that is maybe not at all true.
>
> I do not know how Windows handles this. Are there any special w32
> registry entries for file: that you are aware of?
>
> Just looking at Explorer under Tools - Folder Options and then File
> Types it looks like the file:/// URL is not handled special since
> there is no entry there for this URL type, but that is not correct. It
> is handled specially. Here are some tests I have made:
>
>  (w32-shell-execute "open" "c:/some/file.html") ;; OK
>  (w32-shell-execute nil "file:c:/some/file.html") ;; OK
>  (w32-shell-execute nil "file:///c:/some/file.html") ;; OK
>  (w32-shell-execute "open" "file:///c:/some/file.html") ;; Doesn't work
>  (w32-shell-execute "open" "file:c:/some/file.html") ;; Doesn't work

Jason (or someone else), I have this in the registry

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\file]
    "URL Protocol"=""
    @="URL:File Protocol"
    "Source Filter"="{E436EBB6-524F-11CE-9F53-0020AF0BA770}"

    [HKEY_CLASSES_ROOT\file\CLSID]
    @="{00000303-0000-0000-C000-000000000046}"

I believe this is what ShellExecute uses for a file:/// type url. This
does not work for me when "open" is specified to w32-shell-execute,
see above. What do you have in the registry here? There must be
something I am missing since "open" works for you but not for me.



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4951; Package emacs. (Mon, 23 Nov 2009 01:40:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lennart Borgman <lennart.borgman <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 23 Nov 2009 01:40:05 GMT) Full text and rfc822 format available.

Message #35 received at 4951 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Jason Rumney <jasonr <at> f2s.com>
Cc: 4951 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#4951: 23.1.50; browse-url-default-windows-browser bug + patch
Date: Mon, 23 Nov 2009 02:34:29 +0100
I have tried to find the cause of the problem. Some people on
help-emacs-windows <at> gnu.org mailing list helped me, but I could not
find anything specific.

However I wrote this function and will include it in my patched
version of Emacs+EmacsW32 for those who needs it. (I am not the only
one having this trouble.)


;; (customize-option-other-window 'browse-url-browser-function)
(defun browse-url-no-open-windows-browser (url &optional new-window)
  "Same as `browse-url-default-windows-browser' nearly.
You may want to customize `browse-url-browser-function' to this
function if files do not open in your web browser. It is known
that some pc:s have this problem, reason is so far unknown.

The cure seem to be to call `w32-shell-execute' with a nil
argument here instead of \"open\" which the default function
function `browse-url-default-windows-browser' does.

This should be safe unless your computer is strangely configured,
since you are normaly opening .html files with this function."
  (interactive (browse-url-interactive-arg "URL: "))
  (if (eq system-type 'ms-dos)
      (if dos-windows-version
	  (shell-command (concat "start " (shell-quote-argument url)))
	(error "Browsing URLs is not supported on this system"))
    (w32-shell-execute nil url)))



Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4951; Package emacs. (Sat, 02 Jan 2010 20:32:02 GMT) Full text and rfc822 format available.

Message #38 received at 4951 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 4951 <at> debbugs.gnu.org
Subject: Re: bug#4951: 23.1.50; browse-url-default-windows-browser bug + patch
Date: Sat, 02 Jan 2010 15:31:18 -0500
> There are two changes:
>
> 1) file: => file:///
>
> This was discussed some time ago (a yr or two?) and it looks like this
> is a more correct syntax for the file URL.

This was included in the 2009-11-23 change by Ken Brown.

> 2) Changing the verb to w32-shell-execute (ShellExecute) from "open"
> to nil is for some reason I do not know necessary. The answer to why
> hides deep within the w32 registry and maybe some knowledgeable
> persons at MS... It might be a mismatch of some kind, I don't know.

Is this still necessary?




Added tag(s) patch. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 12 Jan 2010 23:20:03 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4951; Package emacs. (Sun, 11 Sep 2011 05:27:02 GMT) Full text and rfc822 format available.

Message #43 received at 4951 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 4951 <at> debbugs.gnu.org, Lennart Borgman <lennart.borgman <at> gmail.com>
Subject: Re: bug#4951: 23.1.50; browse-url-default-windows-browser bug + patch
Date: Sun, 11 Sep 2011 07:18:48 +0200
Chong Yidong <cyd <at> stupidchicken.com> writes:

>> 2) Changing the verb to w32-shell-execute (ShellExecute) from "open"
>> to nil is for some reason I do not know necessary. The answer to why
>> hides deep within the w32 registry and maybe some knowledgeable
>> persons at MS... It might be a mismatch of some kind, I don't know.
>
> Is this still necessary?

More information was requested a year and a half ago, and was not
followed up on, so I'm closing this bug.  Please reopen if it turns out
that this is still necessary.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




bug closed, send any further explanations to 4951 <at> debbugs.gnu.org and Lennart Borgman <lennart.borgman <at> gmail.com> Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 11 Sep 2011 05:27: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. (Sun, 09 Oct 2011 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 313 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.