GNU bug report logs - #41998
case nil in load-path not handled in function read-library-name

Previous Next

Package: emacs;

Reported by: Tobias Zawada <i_inbox <at> tn-home.de>

Date: Mon, 22 Jun 2020 05:03:02 UTC

Severity: normal

Tags: patch

Fixed in version 28.1

Done: Stefan Kangas <stefan <at> marxist.se>

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 41998 in the body.
You can then email your comments to 41998 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-gnu-emacs <at> gnu.org:
bug#41998; Package emacs. (Mon, 22 Jun 2020 05:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tobias Zawada <i_inbox <at> tn-home.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org.

Your message had a Version: pseudo-header with an invalid package version:

28.0.50, commit 2c4509179110459f42119ce328d72fea65689288

please either use found or fixed to the control server with a correct version, or reply to this report indicating the correct version so the maintainer (or someone else) can correct it for you.

(Mon, 22 Jun 2020 05:03:02 GMT) Full text and rfc822 format available.


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

From: Tobias Zawada <i_inbox <at> tn-home.de>
To: bug-gnu-emacs <at> gnu.org
Subject: case nil in load-path not handled in function read-library-name
Date: Mon, 22 Jun 2020 07:01:55 +0200 (CEST)
Version: 28.0.50, commit 2c4509179110459f42119ce328d72fea65689288

Variable `load-path' admits nil as entry standing for `default-directory'.
This case is not handled in function `read-library-name' of library `lisp/emacs-lisp/find-func.el'.

Diff that fixes this problem:

diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index e35db56550..4498a50f90 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -292,12 +292,13 @@ read-library-name
                          (find-library-suffixes)
                          "\\|"))
          (table (cl-loop for dir in (or find-function-source-path load-path)
-                         when (file-readable-p dir)
+			 for dir-or-default = (or dir default-directory)
+                         when (file-readable-p dir-or-default)
                          append (mapcar
                                  (lambda (file)
                                    (replace-regexp-in-string suffix-regexp
                                                              "" file))
-                                 (directory-files dir nil
+                                 (directory-files dir-or-default nil
                                                   suffix-regexp))))
          (def (if (eq (function-called-at-point) 'require)
                   ;; `function-called-at-point' may return 'require




Added tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 13 Aug 2020 16:35:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41998; Package emacs. (Thu, 13 Aug 2020 17:37:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Tobias Zawada <i_inbox <at> tn-home.de>
Cc: 41998 <at> debbugs.gnu.org
Subject: Re: bug#41998: case nil in load-path not handled in function
 read-library-name
Date: Thu, 13 Aug 2020 10:36:52 -0700
close 41998 28.1
thanks

Tobias Zawada <i_inbox <at> tn-home.de> writes:

> Version: 28.0.50, commit 2c4509179110459f42119ce328d72fea65689288
>
> Variable `load-path' admits nil as entry standing for `default-directory'.
> This case is not handled in function `read-library-name' of library `lisp/emacs-lisp/find-func.el'.

To reproduce:

0. cd ~/some-path-with-elisp-files/
1. emacs -Q
2. Evaluate:

   (progn
     (add-to-list 'load-path nil)
     (with-temp-buffer
       (insert "library")
       (read-library-name)))

And you will get an error.

> Diff that fixes this problem:
>
> diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
> index e35db56550..4498a50f90 100644
> --- a/lisp/emacs-lisp/find-func.el
> +++ b/lisp/emacs-lisp/find-func.el
> @@ -292,12 +292,13 @@ read-library-name
>                           (find-library-suffixes)
>                           "\\|"))
>           (table (cl-loop for dir in (or find-function-source-path load-path)
> -                         when (file-readable-p dir)
> +			 for dir-or-default = (or dir default-directory)
> +                         when (file-readable-p dir-or-default)
>                           append (mapcar
>                                   (lambda (file)
>                                     (replace-regexp-in-string suffix-regexp
>                                                               "" file))
> -                                 (directory-files dir nil
> +                                 (directory-files dir-or-default nil
>                                                    suffix-regexp))))
>           (def (if (eq (function-called-at-point) 'require)
>                    ;; `function-called-at-point' may return 'require

Thanks for the bug fix.  I've added a commit message and ChangeLog entry
and pushed it to master branch in your name.

One small thing: it would be helpful if you could send your next patch
as formatted by `git format-patch' and with a ChangeLog entry as
described in the CONTRIBUTE file in emacs.git.

I'm closing this bug with this message.

Best regards,
Stefan Kangas




bug marked as fixed in version 28.1, send any further explanations to 41998 <at> debbugs.gnu.org and Tobias Zawada <i_inbox <at> tn-home.de> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 13 Aug 2020 17:38: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, 11 Sep 2020 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 225 days ago.

Previous Next


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