unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
@ 2022-10-12  6:43 Pascal Quesseveur
  2022-10-12  7:26 ` Eli Zaretskii
  2022-10-12 11:09 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 19+ messages in thread
From: Pascal Quesseveur @ 2022-10-12  6:43 UTC (permalink / raw)
  To: 58464


emacs -Q
(browse-url-emacs "file://C:/Windows/win.ini") -> Emacs hangs, nothing
is displayed, C-g
(browse-url-emacs "file:///C:/Windows/win.ini") -> file content is
displayed, Message buffer contains:

File exists, but cannot be read
#<buffer win.ini</Windows>>



In GNU Emacs 28.1 (build 2, x86_64-w64-mingw32)
 of 2022-04-21 built on AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.19044
System Description: Microsoft Windows 10 Pro (v10.0.2009.19044.2006)

Configured using:
 'configure --with-modules --without-dbus --with-native-compilation
 --without-compress-install CFLAGS=-O2'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES
NATIVE_COMP NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS XPM ZLIB

(NATIVE_COMP present but libgccjit not available)

Important settings:
  value of $LANG: FRA
  locale-coding-system: cp1252

Major mode: Summary

Minor modes in effect:
  display-time-mode: t
  shell-dirtrack-mode: t
  icomplete-mode: t
  windmove-mode: t
  auto-image-file-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-wl hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-wl
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-vm hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-vm
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-tex hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-tex
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-snarf hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-snarf
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-site hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-site
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-rmail hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-rmail
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-pkg hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-pkg
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-pgp hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-pgp
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-mua hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-mua
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-mu4e hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-mu4e
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-migrate hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-migrate
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-mhe hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-mhe
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-message hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-message
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-ispell hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-ispell
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-gnus hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-gnus
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-com hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-com
c:/Users/Public/emacs-site/lisp/bbdb-3.2.2.2/bbdb-anniv hides c:/Users/quessev/.emacs.d/elpa/bbdb-3.2.2.2/bbdb-anniv
c:/Users/quessev/.emacs.d/lisp/vcard-qsr/vcard hides c:/Users/quessev/.emacs.d/elpa/vcard-0.2.2/vcard
c:/Users/quessev/.emacs.d/lisp/vcard-qsr/vcard-parse hides c:/Users/quessev/.emacs.d/elpa/vcard-0.2.2/vcard-parse
c:/Users/quessev/.emacs.d/lisp/vcard-qsr/vcard-mode hides c:/Users/quessev/.emacs.d/elpa/vcard-0.2.2/vcard-mode
c:/Users/Public/emacs-site/lisp/utils/wdired hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/wdired
c:/Users/Public/emacs-site/lisp/utils/ls-lisp hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/ls-lisp
c:/Users/Public/emacs-site/lisp/utils/iimage hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/iimage
c:/Users/Public/emacs-site/lisp/utils/calculator hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/calculator
c:/Users/Public/emacs-site/lisp/utils/table hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/textmodes/table
c:/Users/Public/emacs-site/lisp/remember/remember hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/textmodes/remember
c:/Users/Public/emacs-site/lisp/utils/rlogin hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/net/rlogin
c:/Users/Public/emacs-site/lisp/dictionary-1.8.7/dictionary hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/net/dictionary

Features:
(tabify time-stamp shadow warnings emacsbug mm-archive gnus-fun
mailalias mule-util sort smiley gnus-cite mail-extr gnus-async
gnus-bcklg qp gnus-ml emms-info-libtag emms-player-vlc emms-player-mpv
emms-player-mplayer emms-playlist-limit emms-volume
emms-volume-mixerctl emms-volume-pulse emms-volume-amixer emms-i18n
emms-stream-info emms-mode-line-icon emms-playlist-sort
emms-last-played emms-playing-time emms-player-simple emms-streams
emms-show-all emms-tag-editor emms-mark emms-mode-line
emms-info-ogginfo emms-info-mp3info emms-info later-do
emms-playlist-mode emms-source-playlist emms-source-file locate
music-list music-album emms-setup emms emms-compat gnus-topic nndraft
nnmh gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg
gnus-art mm-uu mml2015 mm-view mml-smime smime dig nnml utf-7 gnutls
nnfolder cl-extra help-mode gnus-cache gnus-sum network-stream nsm
nntp gnus-group gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap
nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range
gnus-win time highlight-current-line color-theme smtpmail tumblesocks
tumblesocks-view tumblesocks-compose markdown-mode noutline outline
htmlize tumblesocks-user tumblesocks-api oauth sasl sasl-anonymous
sasl-login sasl-plain hex-util hmac-sha1 shr kinsoku svg dom
plantuml-mode xml dash thingatpt html2help footnote rx muse-odf
muse-xml muse-help muse-bbcode muse-blosxom muse-wiki muse-texinfo
texnfo-upd texinfo texinfo-loaddefs muse-latex muse-html muse-docbook
muse-xml-common cus-edit pp cus-load muse-publish muse-project
muse-protocols muse-regexps muse muse-nested-tags muse-mode u-vm-color
org-import-icalendar icalendar diary-lib diary-loaddefs bbdb-sc
supercite regi bbdb-migrate bbdb-snarf bbdb-message sendmail message
rmc puny dired-explore dired-sort-menu acid dired-arc file-op dired-x
dired dired-loaddefs rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 gmm-utils mailheader bbdb-rmail rmailsum bbdb-gnus
bbdb-mua gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045
ietf-drums mail-utils mm-util mail-prsvr wid-edit bbdb-com pcase crm
mailabbrev find-func bbdb bbdb-site timezone tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat shell pcomplete
parse-time iso8601 time-date format-spec which idb gud easy-mmode
compile text-property-search comint ansi-color ring qproj-opascal jsee
javadoc-lookup ido jserial jswat qproj-java jdok tempo xml-parse
doxymacs qproj-cpp qproj server dos-indent generic generic-x cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs lunar solar cal-dst cal-tex cal-iso cal-menu calendar
cal-loaddefs epa-file epa derived epg rfc6068 epg-config ps-mule ipp
cl printing ps-print ps-print-loaddefs ps-def lpr icomplete windmove
advice image-file image-converter edmacro kmacro info package
browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode
mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer
select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese
eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads
w32notify w32 lcms2 multi-tty make-network-process native-compile
emacs)

Memory information:
((conses 16 654839 79861)
 (symbols 48 33806 10)
 (strings 32 171534 8080)
 (string-bytes 1 5621311)
 (vectors 16 50230)
 (vector-slots 8 875194 57078)
 (floats 8 1118 352)
 (intervals 56 2638 204)
 (buffers 992 34))

-- 
Pascal Quesseveur





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-12  6:43 bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows Pascal Quesseveur
@ 2022-10-12  7:26 ` Eli Zaretskii
  2022-10-12 11:10   ` Lars Ingebrigtsen
       [not found]   ` <828rlll4ef.fsf@gmail.com>
  2022-10-12 11:09 ` Lars Ingebrigtsen
  1 sibling, 2 replies; 19+ messages in thread
From: Eli Zaretskii @ 2022-10-12  7:26 UTC (permalink / raw)
  To: Pascal Quesseveur; +Cc: 58464

> From: Pascal Quesseveur <pquessev@gmail.com>
> Date: Wed, 12 Oct 2022 08:43:15 +0200
> 
> 
> emacs -Q
> (browse-url-emacs "file://C:/Windows/win.ini") -> Emacs hangs, nothing
> is displayed, C-g
> (browse-url-emacs "file:///C:/Windows/win.ini") -> file content is
> displayed, Message buffer contains:
> 
> File exists, but cannot be read
> #<buffer win.ini</Windows>>

With Emacs 29, I get a different message:

  Use M-x make-directory RET RET to create the directory and its parents

That's because the file's name and its default-directory are
incorrect:

  M-: buffer-file-name RET
   => X:/C:/Windows/win.ini
  M-: default-directory RET
   => X:/C:/Windows/

(where X is the driver letter of what happens to be the current drive
when I invoke Emacs).





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-12  6:43 bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows Pascal Quesseveur
  2022-10-12  7:26 ` Eli Zaretskii
@ 2022-10-12 11:09 ` Lars Ingebrigtsen
  2022-10-12 13:13   ` Eli Zaretskii
  1 sibling, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-12 11:09 UTC (permalink / raw)
  To: Pascal Quesseveur; +Cc: 58464

Pascal Quesseveur <pquessev@gmail.com> writes:

> emacs -Q
> (browse-url-emacs "file://C:/Windows/win.ini") -> Emacs hangs, nothing
> is displayed, C-g

That's the wrong syntax, but Emacs shouldn't hang...

> (browse-url-emacs "file:///C:/Windows/win.ini") -> file content is
> displayed, Message buffer contains:
>
> File exists, but cannot be read
> #<buffer win.ini</Windows>>

So it works fine when you use the right syntax for the URL, but the
problem is the misleading message?   (Also noted in bug#42431 and
bug#58302 -- it's not Windows-specific, but a bug in all handling of
`file-name-handler-alist' for non-file "files".)





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-12  7:26 ` Eli Zaretskii
@ 2022-10-12 11:10   ` Lars Ingebrigtsen
  2022-10-12 13:14     ` Eli Zaretskii
       [not found]   ` <828rlll4ef.fsf@gmail.com>
  1 sibling, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-12 11:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Pascal Quesseveur, 58464

Eli Zaretskii <eliz@gnu.org> writes:

>> emacs -Q
>> (browse-url-emacs "file://C:/Windows/win.ini") -> Emacs hangs, nothing
>> is displayed, C-g
>> (browse-url-emacs "file:///C:/Windows/win.ini") -> file content is
>> displayed, Message buffer contains:
>> 
>> File exists, but cannot be read
>> #<buffer win.ini</Windows>>
>
> With Emacs 29, I get a different message:
>
>   Use M-x make-directory RET RET to create the directory and its parents
>
> That's because the file's name and its default-directory are
> incorrect:
>
>   M-: buffer-file-name RET
>    => X:/C:/Windows/win.ini
>   M-: default-directory RET
>    => X:/C:/Windows/
>
> (where X is the driver letter of what happens to be the current drive
> when I invoke Emacs).

Was this with the first or the second URL?





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
       [not found]   ` <828rlll4ef.fsf@gmail.com>
@ 2022-10-12 13:04     ` Eli Zaretskii
  0 siblings, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2022-10-12 13:04 UTC (permalink / raw)
  To: pquessev; +Cc: 58464

[Please use Reply All to keep the bug tracker on the CC list.]

> From: Pascal Quesseveur <pquessev@gmail.com>
> Date: Wed, 12 Oct 2022 12:31:20 +0200
> 
> >"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
> 
>   EZ> With Emacs 29, I get a different message:
> 
>   EZ>   Use M-x make-directory RET RET to create the directory and its
>   EZ>   parents
> 
> But does the first call with 2 slashes work with Emacs 29?

It doesn't hang as with Emacs 28, but it is broken in a slightly
different way: *Messages* says the same, but buffer-file-name is
X:/Windows/win.ini (i.e. the C: drive letter was lost), and
default-directory is accordingly X:/Windows.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-12 11:09 ` Lars Ingebrigtsen
@ 2022-10-12 13:13   ` Eli Zaretskii
  2022-10-12 13:18     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-10-12 13:13 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: pquessev, 58464

> Cc: 58464@debbugs.gnu.org
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Wed, 12 Oct 2022 13:09:41 +0200
> 
> Pascal Quesseveur <pquessev@gmail.com> writes:
> 
> > emacs -Q
> > (browse-url-emacs "file://C:/Windows/win.ini") -> Emacs hangs, nothing
> > is displayed, C-g
> 
> That's the wrong syntax, but Emacs shouldn't hang...

Emacs 29 doesn't hang, at least on my system.

> > (browse-url-emacs "file:///C:/Windows/win.ini") -> file content is
> > displayed, Message buffer contains:
> >
> > File exists, but cannot be read
> > #<buffer win.ini</Windows>>
> 
> So it works fine when you use the right syntax for the URL, but the
> problem is the misleading message?

No, the misleading message is likely just a symptom of the root
cause.  The root cause is that the buffer-file-name is set
incorrectly, and likewise the default-directory.

It could be that the original problem (with displaying images given by
the file:// URL) doesn't work, but that is not yet certain, AFAIU.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-12 11:10   ` Lars Ingebrigtsen
@ 2022-10-12 13:14     ` Eli Zaretskii
  0 siblings, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2022-10-12 13:14 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: pquessev, 58464

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Pascal Quesseveur <pquessev@gmail.com>,  58464@debbugs.gnu.org
> Date: Wed, 12 Oct 2022 13:10:24 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > With Emacs 29, I get a different message:
> >
> >   Use M-x make-directory RET RET to create the directory and its parents
> >
> > That's because the file's name and its default-directory are
> > incorrect:
> >
> >   M-: buffer-file-name RET
> >    => X:/C:/Windows/win.ini
> >   M-: default-directory RET
> >    => X:/C:/Windows/
> >
> > (where X is the driver letter of what happens to be the current drive
> > when I invoke Emacs).
> 
> Was this with the first or the second URL?

The second.  I sent the results with the first one a few minutes ago.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-12 13:13   ` Eli Zaretskii
@ 2022-10-12 13:18     ` Lars Ingebrigtsen
  2022-10-12 14:25       ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-12 13:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: pquessev, 58464

Eli Zaretskii <eliz@gnu.org> writes:

> No, the misleading message is likely just a symptom of the root
> cause.  The root cause is that the buffer-file-name is set
> incorrectly, and likewise the default-directory.

Well...  have a look at bug#bug#42431, it analyses the problem.  (Which
is that any usage if insert-file-contents that doesn't reference an
actual file on the file system will signal an error, and that's a
mistake, I think?)






^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-12 13:18     ` Lars Ingebrigtsen
@ 2022-10-12 14:25       ` Eli Zaretskii
  2022-10-12 14:42         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-10-12 14:25 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: pquessev, 58464

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: pquessev@gmail.com,  58464@debbugs.gnu.org
> Date: Wed, 12 Oct 2022 15:18:10 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > No, the misleading message is likely just a symptom of the root
> > cause.  The root cause is that the buffer-file-name is set
> > incorrectly, and likewise the default-directory.
> 
> Well...  have a look at bug#bug#42431, it analyses the problem.  (Which
> is that any usage if insert-file-contents that doesn't reference an
> actual file on the file system will signal an error, and that's a
> mistake, I think?)

So why isn't what I proposed there TRT?  We _know_ we are visiting a
local file, so why not convert the file:// URL to a local file name
before doing anything with it?





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-12 14:25       ` Eli Zaretskii
@ 2022-10-12 14:42         ` Lars Ingebrigtsen
  2022-10-12 15:55           ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-12 14:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: pquessev, 58464

Eli Zaretskii <eliz@gnu.org> writes:

>> Well...  have a look at bug#bug#42431, it analyses the problem.  (Which
>> is that any usage if insert-file-contents that doesn't reference an
>> actual file on the file system will signal an error, and that's a
>> mistake, I think?)
>
> So why isn't what I proposed there TRT?  We _know_ we are visiting a
> local file, so why not convert the file:// URL to a local file name
> before doing anything with it?

For local files, yes -- but it's a more general problem, and should
(also) be fixed in general.

(But also see bug#58302 -- browse-url-emacs shouldn't be calling these
functions at all.)





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-12 14:42         ` Lars Ingebrigtsen
@ 2022-10-12 15:55           ` Eli Zaretskii
  2022-10-12 15:57             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-10-12 15:55 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: pquessev, 58464

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: pquessev@gmail.com,  58464@debbugs.gnu.org
> Date: Wed, 12 Oct 2022 16:42:49 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Well...  have a look at bug#bug#42431, it analyses the problem.  (Which
> >> is that any usage if insert-file-contents that doesn't reference an
> >> actual file on the file system will signal an error, and that's a
> >> mistake, I think?)
> >
> > So why isn't what I proposed there TRT?  We _know_ we are visiting a
> > local file, so why not convert the file:// URL to a local file name
> > before doing anything with it?
> 
> For local files, yes -- but it's a more general problem, and should
> (also) be fixed in general.

I'm not sure I follow: file:// URLs always point to local files, no?
And if you think about remote files in the sense of Tramp, then that's
transparently handled by the "normal" file I/O primitives.  So what is
the more general problem to solve here?  And why converting file://
URLs to file-name format is not TRT?

> (But also see bug#58302 -- browse-url-emacs shouldn't be calling these
> functions at all.)

How else can Emacs visit files except via insert-file-contents?  Or
what do you mean by "these functions"?





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-12 15:55           ` Eli Zaretskii
@ 2022-10-12 15:57             ` Lars Ingebrigtsen
  2022-10-12 16:07               ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-12 15:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: pquessev, 58464

Eli Zaretskii <eliz@gnu.org> writes:

> I'm not sure I follow: file:// URLs always point to local files, no?

browse-url-emacs takes any URL, not just file:// URL.

(browse-url-emacs "https://gnus.org/") "works fine", except for the same
error messages.

>> (But also see bug#58302 -- browse-url-emacs shouldn't be calling these
>> functions at all.)
>
> How else can Emacs visit files except via insert-file-contents?  Or
> what do you mean by "these functions"?

`url-file-handler'.






^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-12 15:57             ` Lars Ingebrigtsen
@ 2022-10-12 16:07               ` Eli Zaretskii
  2022-10-13  7:54                 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-10-12 16:07 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: pquessev, 58464

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: pquessev@gmail.com,  58464@debbugs.gnu.org
> Date: Wed, 12 Oct 2022 17:57:13 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I'm not sure I follow: file:// URLs always point to local files, no?
> 
> browse-url-emacs takes any URL, not just file:// URL.
> 
> (browse-url-emacs "https://gnus.org/") "works fine", except for the same
> error messages.

But this bug report ius about file:// URLs, not about anything else.

> >> (But also see bug#58302 -- browse-url-emacs shouldn't be calling these
> >> functions at all.)
> >
> > How else can Emacs visit files except via insert-file-contents?  Or
> > what do you mean by "these functions"?
> 
> `url-file-handler'.

Which ends up calling the same functions?





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-12 16:07               ` Eli Zaretskii
@ 2022-10-13  7:54                 ` Lars Ingebrigtsen
  2022-10-13 10:29                   ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-13  7:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: pquessev, 58464

Eli Zaretskii <eliz@gnu.org> writes:

>> browse-url-emacs takes any URL, not just file:// URL.
>> 
>> (browse-url-emacs "https://gnus.org/") "works fine", except for the same
>> error messages.
>
> But this bug report ius about file:// URLs, not about anything else.

I've now fixed the general problem, and I think I've also fixed the
Windows-specific file:-specific problem on the trunk.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-13  7:54                 ` Lars Ingebrigtsen
@ 2022-10-13 10:29                   ` Eli Zaretskii
  2022-10-13 11:30                     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-10-13 10:29 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: pquessev, 58464

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: pquessev@gmail.com,  58464@debbugs.gnu.org
> Date: Thu, 13 Oct 2022 09:54:52 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> browse-url-emacs takes any URL, not just file:// URL.
> >> 
> >> (browse-url-emacs "https://gnus.org/") "works fine", except for the same
> >> error messages.
> >
> > But this bug report ius about file:// URLs, not about anything else.
> 
> I've now fixed the general problem, and I think I've also fixed the
> Windows-specific file:-specific problem on the trunk.

Thanks.  But this part:

  -  if (NILP (handler) && !NILP (visit) && current_buffer->modtime.tv_nsec < 0)
  +  if (save_errno != 0)

might cause us signal an error when VISIT is nil, something that
didn't happen before.

(I also am not sure it is 100% reliable to rely on save_errno being
non-zero whenever we encounter an error, especially in the
file-handlers case.)





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-13 10:29                   ` Eli Zaretskii
@ 2022-10-13 11:30                     ` Lars Ingebrigtsen
  2022-10-13 15:44                       ` Eli Zaretskii
  2022-10-13 16:40                       ` Paul Eggert
  0 siblings, 2 replies; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-13 11:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: pquessev, Paul Eggert, 58464

Eli Zaretskii <eliz@gnu.org> writes:

> Thanks.  But this part:
>
>   -  if (NILP (handler) && !NILP (visit) && current_buffer->modtime.tv_nsec < 0)
>   +  if (save_errno != 0)
>
> might cause us signal an error when VISIT is nil, something that
> didn't happen before.
>
> (I also am not sure it is 100% reliable to rely on save_errno being
> non-zero whenever we encounter an error, especially in the
> file-handlers case.)

That's Paul's change -- added to the CCs.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-13 11:30                     ` Lars Ingebrigtsen
@ 2022-10-13 15:44                       ` Eli Zaretskii
  2022-10-13 16:40                       ` Paul Eggert
  1 sibling, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2022-10-13 15:44 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: pquessev, eggert, 58464

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: pquessev@gmail.com,  58464@debbugs.gnu.org, Paul Eggert
>  <eggert@cs.ucla.edu>
> Date: Thu, 13 Oct 2022 13:30:39 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Thanks.  But this part:
> >
> >   -  if (NILP (handler) && !NILP (visit) && current_buffer->modtime.tv_nsec < 0)
> >   +  if (save_errno != 0)
> >
> > might cause us signal an error when VISIT is nil, something that
> > didn't happen before.
> >
> > (I also am not sure it is 100% reliable to rely on save_errno being
> > non-zero whenever we encounter an error, especially in the
> > file-handlers case.)
> 
> That's Paul's change -- added to the CCs.

Oops, sorry about that.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-13 11:30                     ` Lars Ingebrigtsen
  2022-10-13 15:44                       ` Eli Zaretskii
@ 2022-10-13 16:40                       ` Paul Eggert
  2022-10-13 19:15                         ` Eli Zaretskii
  1 sibling, 1 reply; 19+ messages in thread
From: Paul Eggert @ 2022-10-13 16:40 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Eli Zaretskii; +Cc: pquessev, 58464

[-- Attachment #1: Type: text/plain, Size: 682 bytes --]

On 2022-10-13 04:30, Lars Ingebrigtsen wrote:
> Eli Zaretskii <eliz@gnu.org> writes:
> 
>> Thanks.  But this part:
>>
>>    -  if (NILP (handler) && !NILP (visit) && current_buffer->modtime.tv_nsec < 0)
>>    +  if (save_errno != 0)
>>
>> might cause us signal an error when VISIT is nil, something that
>> didn't happen before.

We should be OK there. If VISIT is nil, SAVE_ERRNO must be zero.

>> (I also am not sure it is 100% reliable to rely on save_errno being
>> non-zero whenever we encounter an error, especially in the
>> file-handlers case.)

Should be OK here too. In the file-handlers case, SAVE_ERRNO is zero.

I installed the attached to help document and check this.

[-- Attachment #2: 0001-Improve-checks-for-recent-File-exists-fixup.patch --]
[-- Type: text/x-patch, Size: 799 bytes --]

From 10f55975d34dd7299f72fdf8d93fd8cbe2e41e25 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 13 Oct 2022 09:33:46 -0700
Subject: [PATCH] Improve checks for recent "File exists" fixup

* src/fileio.c (Finsert_file_contents): Add an assertion (bug#42431).
---
 src/fileio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/fileio.c b/src/fileio.c
index 49553f3c91..b9a57dd580 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5003,6 +5003,7 @@ because (1) it preserves some marker positions (in unchanged portions
   if (save_errno != 0)
     {
       /* Signal an error if visiting a file that could not be opened.  */
+      eassert (!NILP (visit) && NILP (handler));
       report_file_errno ("Opening input file", orig_filename, save_errno);
     }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows
  2022-10-13 16:40                       ` Paul Eggert
@ 2022-10-13 19:15                         ` Eli Zaretskii
  0 siblings, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2022-10-13 19:15 UTC (permalink / raw)
  To: Paul Eggert; +Cc: pquessev, larsi, 58464

> Date: Thu, 13 Oct 2022 09:40:54 -0700
> Cc: pquessev@gmail.com, 58464@debbugs.gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> 
> >>    -  if (NILP (handler) && !NILP (visit) && current_buffer->modtime.tv_nsec < 0)
> >>    +  if (save_errno != 0)
> >>
> >> might cause us signal an error when VISIT is nil, something that
> >> didn't happen before.
> 
> We should be OK there. If VISIT is nil, SAVE_ERRNO must be zero.
> 
> >> (I also am not sure it is 100% reliable to rely on save_errno being
> >> non-zero whenever we encounter an error, especially in the
> >> file-handlers case.)
> 
> Should be OK here too. In the file-handlers case, SAVE_ERRNO is zero.

Famous last words.





^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2022-10-13 19:15 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-12  6:43 bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows Pascal Quesseveur
2022-10-12  7:26 ` Eli Zaretskii
2022-10-12 11:10   ` Lars Ingebrigtsen
2022-10-12 13:14     ` Eli Zaretskii
     [not found]   ` <828rlll4ef.fsf@gmail.com>
2022-10-12 13:04     ` Eli Zaretskii
2022-10-12 11:09 ` Lars Ingebrigtsen
2022-10-12 13:13   ` Eli Zaretskii
2022-10-12 13:18     ` Lars Ingebrigtsen
2022-10-12 14:25       ` Eli Zaretskii
2022-10-12 14:42         ` Lars Ingebrigtsen
2022-10-12 15:55           ` Eli Zaretskii
2022-10-12 15:57             ` Lars Ingebrigtsen
2022-10-12 16:07               ` Eli Zaretskii
2022-10-13  7:54                 ` Lars Ingebrigtsen
2022-10-13 10:29                   ` Eli Zaretskii
2022-10-13 11:30                     ` Lars Ingebrigtsen
2022-10-13 15:44                       ` Eli Zaretskii
2022-10-13 16:40                       ` Paul Eggert
2022-10-13 19:15                         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).