GNU bug report logs - #5362
23.1.91; browse-url-of-dired-file vs. files::with::colons

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Tue, 12 Jan 2010 01:09:02 UTC

Severity: minor

Tags: confirmed

Done: Andreas Schwab <schwab <at> linux-m68k.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 5362 in the body.
You can then email your comments to 5362 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5362; Package emacs. (Tue, 12 Jan 2010 01:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 12 Jan 2010 01:09:02 GMT) Full text and rfc822 format available.

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

From: jidanni <at> jidanni.org
To: emacs-pretest-bug <at> gnu.org
Subject: 23.1.91; browse-url-of-dired-file vs. files::with::colons
Date: Tue, 12 Jan 2010 01:54:10 +0800
b runs the command browse-url-of-dired-file
And when used on
/tmp/WWW::Facebook::API.html
it tried to browse
ftp://tmp/WWW/:Facebook::API.html

Say, aren't files always local files?

(I didn't check if my http://jidanni.org/comp/configuration/
impacted it.)
In GNU Emacs 23.1.91.1 (i486-pc-linux-gnu, GTK+ Version 2.18.5)
 of 2010-01-07 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20100106-1)




Severity set to 'minor' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 15 Jan 2010 02:35:02 GMT) Full text and rfc822 format available.

Added tag(s) confirmed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 25 Dec 2015 22:12:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#5362; Package emacs. (Fri, 25 Dec 2015 22:16:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: jidanni <at> jidanni.org
Cc: 5362 <at> debbugs.gnu.org
Subject: Re: bug#5362: 23.1.91;
 browse-url-of-dired-file vs. files::with::colons
Date: Fri, 25 Dec 2015 23:15:08 +0100
jidanni <at> jidanni.org writes:

> b runs the command browse-url-of-dired-file
> And when used on
> /tmp/WWW::Facebook::API.html
> it tried to browse
> ftp://tmp/WWW/:Facebook::API.html
>
> Say, aren't files always local files?

They are, so this is pretty nonsensical.

The culprit here is

(defun browse-url-file-url (file)
  "Return the URL corresponding to FILE.
Use variable `browse-url-filename-alist' to map filenames to URLs."
  (let ((coding (if (equal system-type 'windows-nt)
		    ;; W32 pretends that file names are UTF-8 encoded.
		    'utf-8
		  (and (default-value 'enable-multibyte-characters)
		       (or file-name-coding-system
			   default-file-name-coding-system)))))
    (if coding (setq file (encode-coding-string file coding))))
  (setq file (browse-url-url-encode-chars file "[*\"()',=;?% ]"))
  (dolist (map browse-url-filename-alist)
    (when (and map (string-match (car map) file))
      (setq file (replace-match (cdr map) t nil file))))
  file)

(browse-url-file-url "/tmp/WWW::Facebook::API.html")
=> "ftp://tmp/WWW/:Facebook::API.html"

Which is wrong.

I don't quite understand why it does all this?  Why doesn't it just
prepend "file://" to the file name?  (Ok, it should probably do the
browse-url-url-encode-chars thing, anyway...)

Ideas?

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




Reply sent to Andreas Schwab <schwab <at> linux-m68k.org>:
You have taken responsibility. (Fri, 25 Dec 2015 22:44:01 GMT) Full text and rfc822 format available.

Notification sent to jidanni <at> jidanni.org:
bug acknowledged by developer. (Fri, 25 Dec 2015 22:44:02 GMT) Full text and rfc822 format available.

Message #17 received at 5362-done <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 5362-done <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#5362: 23.1.91;
 browse-url-of-dired-file vs. files::with::colons
Date: Fri, 25 Dec 2015 23:43:33 +0100
Fixed in 25.1

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#5362; Package emacs. (Sat, 26 Dec 2015 08:17:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 5362 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#5362: 23.1.91;
 browse-url-of-dired-file vs. files::with::colons
Date: Sat, 26 Dec 2015 10:17:05 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Fri, 25 Dec 2015 23:15:08 +0100
> Cc: 5362 <at> debbugs.gnu.org
> 
> (browse-url-file-url "/tmp/WWW::Facebook::API.html")
> => "ftp://tmp/WWW/:Facebook::API.html"
> 
> Which is wrong.
> 
> I don't quite understand why it does all this?  Why doesn't it just
> prepend "file://" to the file name?

See the doc string of browse-url-filename-alist: it's for ange-ftp
support.  It aims at transparently supporting file names like
/anonym <at> bs2000.anywhere.com:/:X:/IMPORTANT.TEXT.ON.BS2000.  Now you
tell me how should browse-url distinguish that from the file name the
OP shows in this bug report?

> Ideas?

Since browse-url-of-dired-file knows it is operating on a local file,
it could simply bind browse-url-filename-alist to some value (nil?)
that would disable the offending translations.  Would that work?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#5362; Package emacs. (Sat, 26 Dec 2015 12:43:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 5362 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#5362: 23.1.91;
 browse-url-of-dired-file vs. files::with::colons
Date: Sat, 26 Dec 2015 13:41:55 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> Since browse-url-of-dired-file knows it is operating on a local file,
> it could simply bind browse-url-filename-alist to some value (nil?)
> that would disable the offending translations.  Would that work?

I think so...

However, Andreas changed the regexp to only react to colons in the first
part of the file name, which works, I guess.  But files like

/www::foo.html

(in the root) will still be mishandled, I think...

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#5362; Package emacs. (Sat, 26 Dec 2015 13:28:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 5362 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#5362: 23.1.91;
 browse-url-of-dired-file vs. files::with::colons
Date: Sat, 26 Dec 2015 14:26:57 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> However, Andreas changed the regexp to only react to colons in the first
> part of the file name, which works, I guess.  But files like
>
> /www::foo.html
>
> (in the root) will still be mishandled, I think...

Such local files would be mishandled everywhere in Emacs, because they
use the remote file name syntax. They must be prefixed like
/:www::foo.html , see (info "(elisp) Magic File Names") .

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 24 Jan 2016 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 148 days ago.

Previous Next


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