GNU bug report logs - #72203
31.0.50; browse-url-emacs (url-file-handler) errors when eglot is loaded

Previous Next

Package: emacs;

Reported by: Nick OBrien <nick4f42 <at> proton.me>

Date: Sat, 20 Jul 2024 00:58:02 UTC

Severity: normal

Found in version 31.0.50

To reply to this bug, email your comments to 72203 AT debbugs.gnu.org.

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-gnu-emacs <at> gnu.org:
bug#72203; Package emacs. (Sat, 20 Jul 2024 00:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nick OBrien <nick4f42 <at> proton.me>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 20 Jul 2024 00:58:02 GMT) Full text and rfc822 format available.

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

From: Nick OBrien <nick4f42 <at> proton.me>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 31.0.50;
 browse-url-emacs (url-file-handler) errors when eglot is loaded
Date: Sat, 20 Jul 2024 00:56:38 +0000
Steps to reproduce:

    emacs -Q

    (require 'eglot)
    (setq debug-on-error t)
    (browse-url-emacs "https://www.gnu.org/licenses/gpl-3.0.txt")

There is an error, but after the gpl-3.0.txt buffer is populated.  I got
this backtrace (with long arguments manually replaced with ...):

    Debugger entered--Lisp error: (void-function nil)
      nil(...)
      url-directory-files("https://www.gnu.org/licenses/" nil ... t nil)
      apply(url-directory-files ("https://www.gnu.org/licenses/" nil ... t nil))
      url-file-handler(directory-files "https://www.gnu.org/licenses/" nil ... t nil)
      directory-files("https://www.gnu.org/licenses/" nil ... t)
      #f(compiled-function (d) #<bytecode 0x183c21e239c1e2a3>)("https://www.gnu.org/licenses/")
      locate-dominating-file("https://www.gnu.org/licenses/" #f(compiled-function (d) #<bytecode 0x183c21e239c1e2a3>))
      project-try-vc("https://www.gnu.org/licenses/")
      run-hook-with-args-until-success(project-try-vc "https://www.gnu.org/licenses/")
      project--find-in-directory("https://www.gnu.org/licenses/")
      project-current()
      eglot--current-project()
      eglot-current-server()
      eglot--maybe-activate-editing-mode()
      run-hooks(after-change-major-mode-hook)
      run-mode-hooks(text-mode-hook)
      text-mode()
      set-auto-mode-0(text-mode nil)
      set-auto-mode--apply-alist(... nil nil)
      set-auto-mode()
      normal-mode(t)
      after-find-file(nil t)
      find-file-noselect-1(#<buffer gpl-3.0.txt> "https://www.gnu.org/licenses/gpl-3.0.txt" nil nil "https://www.gnu.org/licenses/gpl-3.0.txt" (nil nil))
      find-file-noselect("https://www.gnu.org/licenses/gpl-3.0.txt" nil nil nil)
      find-file-other-window("https://www.gnu.org/licenses/gpl-3.0.txt")
      browse-url-emacs("https://www.gnu.org/licenses/gpl-3.0.txt")
      (progn (browse-url-emacs "https://www.gnu.org/licenses/gpl-3.0.txt"))
      eval((progn (browse-url-emacs "https://www.gnu.org/licenses/gpl-3.0.txt")) t)
      elisp--eval-last-sexp(nil)
      #f(compiled-function () #<bytecode 0x29ba0505e5b8a>)()
      eval-last-sexp(nil)
      funcall-interactively(eval-last-sexp nil)
      command-execute(eval-last-sexp)

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.18.0, Xaw3d scroll bars)
Repository revision: 99b360bb5aabf324cf038c27ac76ac1513319754
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: NixOS 24.05 (Uakari)

Configured using:
 'configure
 --prefix=/nix/store/1wzjg52vljqzzwgj3i1wvlq8ybz8safl-emacs-git-20240718.0
 --disable-build-details --with-modules --with-x-toolkit=lucid
 --with-cairo --with-xft --with-compress-install
 --with-toolkit-scroll-bars --with-native-compilation
 --without-imagemagick --with-mailutils --without-small-ja-dic
 --with-tree-sitter --with-xinput2 --without-xwidgets --with-dbus
 --with-selinux'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM
LUCID ZLIB

Important settings:
  value of $LC_MONETARY: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr jka-compr misearch multi-isearch emacsbug
help-fns radix-tree cl-extra cl-print mm-archive message sendmail
yank-media dired dired-loaddefs rfc822 mml mml-sec epa derived epg
rfc6068 epg-config gnus-util mailabbrev gmm-utils mailheader mm-decode
mm-bodies mm-encode mail-utils gnutls network-stream url-cache url-dav
parse-time iso8601 xml url-http url-auth mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm puny url-handlers
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf mailcap eglot
external-completion jsonrpc xref flymake thingatpt project compat diff
diff-mode track-changes easy-mmode ert pp ewoc debug backtrace help-mode
find-func filenotify warnings compile text-property-search comint
ansi-osc ansi-color ring pcase url-util url-parse auth-source cl-seq
eieio eieio-core cl-macs icons password-cache json map byte-opt gv
bytecomp byte-compile url-vars imenu time-date subr-x cl-loaddefs cl-lib
rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen 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 nadvice seq simple cl-generic indonesian philippine
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 abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 176537 29166) (symbols 48 11470 0) (strings 32 36163 1998)
 (string-bytes 1 1251305) (vectors 16 22615)
 (vector-slots 8 273895 25920) (floats 8 60 96) (intervals 56 3301 59)
 (buffers 992 17))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72203; Package emacs. (Sat, 20 Jul 2024 07:12:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Nick OBrien <nick4f42 <at> proton.me>, João Távora
 <joaotavora <at> gmail.com>, Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 72203 <at> debbugs.gnu.org
Subject: Re: bug#72203: 31.0.50;
 browse-url-emacs (url-file-handler) errors when eglot is loaded
Date: Sat, 20 Jul 2024 10:11:43 +0300
> Date: Sat, 20 Jul 2024 00:56:38 +0000
> From:  Nick OBrien via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Steps to reproduce:
> 
>     emacs -Q
> 
>     (require 'eglot)
>     (setq debug-on-error t)
>     (browse-url-emacs "https://www.gnu.org/licenses/gpl-3.0.txt")
> 
> There is an error, but after the gpl-3.0.txt buffer is populated.  I got
> this backtrace (with long arguments manually replaced with ...):
> 
>     Debugger entered--Lisp error: (void-function nil)
>       nil(...)
>       url-directory-files("https://www.gnu.org/licenses/" nil ... t nil)
>       apply(url-directory-files ("https://www.gnu.org/licenses/" nil ... t nil))
>       url-file-handler(directory-files "https://www.gnu.org/licenses/" nil ... t nil)
>       directory-files("https://www.gnu.org/licenses/" nil ... t)
>       #f(compiled-function (d) #<bytecode 0x183c21e239c1e2a3>)("https://www.gnu.org/licenses/")
>       locate-dominating-file("https://www.gnu.org/licenses/" #f(compiled-function (d) #<bytecode 0x183c21e239c1e2a3>))
>       project-try-vc("https://www.gnu.org/licenses/")
>       run-hook-with-args-until-success(project-try-vc "https://www.gnu.org/licenses/")
>       project--find-in-directory("https://www.gnu.org/licenses/")
>       project-current()
>       eglot--current-project()
>       eglot-current-server()
>       eglot--maybe-activate-editing-mode()
>       run-hooks(after-change-major-mode-hook)
>       run-mode-hooks(text-mode-hook)
>       text-mode()
>       set-auto-mode-0(text-mode nil)
>       set-auto-mode--apply-alist(... nil nil)
>       set-auto-mode()
>       normal-mode(t)
>       after-find-file(nil t)
>       find-file-noselect-1(#<buffer gpl-3.0.txt> "https://www.gnu.org/licenses/gpl-3.0.txt" nil nil "https://www.gnu.org/licenses/gpl-3.0.txt" (nil nil))
>       find-file-noselect("https://www.gnu.org/licenses/gpl-3.0.txt" nil nil nil)
>       find-file-other-window("https://www.gnu.org/licenses/gpl-3.0.txt")
>       browse-url-emacs("https://www.gnu.org/licenses/gpl-3.0.txt")
>       (progn (browse-url-emacs "https://www.gnu.org/licenses/gpl-3.0.txt"))
>       eval((progn (browse-url-emacs "https://www.gnu.org/licenses/gpl-3.0.txt")) t)
>       elisp--eval-last-sexp(nil)
>       #f(compiled-function () #<bytecode 0x29ba0505e5b8a>)()
>       eval-last-sexp(nil)
>       funcall-interactively(eval-last-sexp nil)
>       command-execute(eval-last-sexp)

Adding João and Dmitry.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72203; Package emacs. (Sun, 21 Jul 2024 00:59:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Nick OBrien <nick4f42 <at> proton.me>, 72203 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>, João Távora
 <joaotavora <at> gmail.com>
Subject: Re: bug#72203: 31.0.50; browse-url-emacs (url-file-handler) errors
 when eglot is loaded
Date: Sun, 21 Jul 2024 03:58:25 +0300
On 20/07/2024 03:56, Nick OBrien via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
>        nil(...)
>        url-directory-files("https://www.gnu.org/licenses/"  nil ... t nil)
>        apply(url-directory-files ("https://www.gnu.org/licenses/"  nil ... t nil))
>        url-file-handler(directory-files"https://www.gnu.org/licenses/"  nil ... t nil)
>        directory-files("https://www.gnu.org/licenses/"  nil ... t)
>        #f(compiled-function (d) #<bytecode 0x183c21e239c1e2a3>)("https://www.gnu.org/licenses/")
>        locate-dominating-file("https://www.gnu.org/licenses/"  #f(compiled-function (d) #<bytecode 0x183c21e239c1e2a3>))

Is it possible that url-file-handler is misbehaving here?

The first lines look sensible, and then at the end we call nil as a 
function.

Of course, we probably don't want to list any files or detect the 
project when default-directory is an HTTPS URL, but how do we 
distinguish this case from others where we're just on a remote host 
(e.g. Tramp, most likely)?

And sure, Eglot triggers the problem by calling project-current 
automatically, but then project-mode-line might do the same.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72203; Package emacs. (Sun, 21 Jul 2024 06:59:02 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 72203 <at> debbugs.gnu.org,
 João Távora <joaotavora <at> gmail.com>,
 Nick OBrien <nick4f42 <at> proton.me>
Subject: Re: bug#72203: 31.0.50; browse-url-emacs (url-file-handler) errors
 when eglot is loaded
Date: Sun, 21 Jul 2024 08:57:24 +0200
On Jul 21 2024, Dmitry Gutov wrote:

> On 20/07/2024 03:56, Nick OBrien via Bug reports for GNU Emacs, the Swiss
> army knife of text editors wrote:
>>        nil(...)
>>        url-directory-files("https://www.gnu.org/licenses/"  nil ... t nil)
>>        apply(url-directory-files ("https://www.gnu.org/licenses/"  nil ... t nil))
>>        url-file-handler(directory-files"https://www.gnu.org/licenses/"  nil ... t nil)
>>        directory-files("https://www.gnu.org/licenses/"  nil ... t)
>>        #f(compiled-function (d) #<bytecode 0x183c21e239c1e2a3>)("https://www.gnu.org/licenses/")
>>        locate-dominating-file("https://www.gnu.org/licenses/"  #f(compiled-function (d) #<bytecode 0x183c21e239c1e2a3>))
>
> Is it possible that url-file-handler is misbehaving here?
>
> The first lines look sensible, and then at the end we call nil as a
> function.

That's because the "https" URL scheme backend does not define the
url-https-directory-files function.  The function created by
url-handlers-create-wrapper does not handle that situation specially, it
just lets the error happen.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




This bug report was last modified 88 days ago.

Previous Next


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