GNU bug report logs - #16406
load prefers directories rather than searching load-path

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Fri, 10 Jan 2014 05:25:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 24.3

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: npostavs <at> users.sourceforge.net
Cc: rgm <at> gnu.org, 16406 <at> debbugs.gnu.org
Subject: bug#16406: load prefers directories rather than searching load-path
Date: Sat, 03 Sep 2016 22:00:42 +0300
> From: npostavs <at> users.sourceforge.net
> Cc: 16406 <at> debbugs.gnu.org,  rgm <at> gnu.org
> Date: Sat, 03 Sep 2016 14:43:53 -0400
> 
> > I do agree that the file-exists-p test in command-line-1 should be
> > replaced with a test that doesn't let directories through.  But I
> > don't understand why using locate-file here is a good idea.
> 
> Hmm, I seem to have confused things by trying to combine the fix for
> 16406 and 17848.  Just replacing the file-exists-p test, as in the patch
> below, is enough to fix this bug.  Let's look at 17848 separately.
> 
> >From ba8ddc2e039fe982bdfa46519c003808be9ddff3 Mon Sep 17 00:00:00 2001
> From: Noam Postavsky <npostavs <at> gmail.com>
> Date: Sun, 21 Aug 2016 10:51:38 -0400
> Subject: [PATCH v3] Don't --load directories
> 
> * lisp/startup.el (command-line-1): Only pass expanded FILENAME argument
> of --load when it refers to a normal file, since `load' doesn't handle
> directories (Bug #16406).
> ---
>  lisp/startup.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lisp/startup.el b/lisp/startup.el
> index fcdc376..45beefb 100644
> --- a/lisp/startup.el
> +++ b/lisp/startup.el
> @@ -2393,7 +2393,7 @@ command-line-1
>                              ;; Take file from default dir if it exists there;
>                              ;; otherwise let `load' search for it.
>                              (file-ex (expand-file-name file)))
> -                       (when (file-exists-p file-ex)
> +                       (when (and file-ex (file-regular-p file-ex))
>                           (setq file file-ex))
>                         (load file nil t)))

OK.  But isn't the "and file-ex" test unnecessary?  It wasn't required
for file-exists-p, so why is it for file-regular-p?

Thanks.




This bug report was last modified 8 years and 173 days ago.

Previous Next


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