From: Eli Zaretskii <eliz@gnu.org>
To: npostavs@users.sourceforge.net
Cc: 16406@debbugs.gnu.org
Subject: bug#16406: load prefers directories rather than searching load-path
Date: Sat, 03 Sep 2016 22:00:42 +0300 [thread overview]
Message-ID: <83twdwdd0l.fsf@gnu.org> (raw)
In-Reply-To: <87r390aknq.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net)
> From: npostavs@users.sourceforge.net
> Cc: 16406@debbugs.gnu.org, rgm@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@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.
next prev parent reply other threads:[~2016-09-03 19:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-10 5:23 bug#16406: load prefers directories rather than searching load-path Glenn Morris
2014-01-10 14:46 ` Stefan Monnier
2016-08-21 16:35 ` npostavs
2016-09-03 16:43 ` npostavs
2016-09-03 17:32 ` Eli Zaretskii
2016-09-03 18:43 ` npostavs
2016-09-03 19:00 ` Eli Zaretskii [this message]
2016-09-03 19:12 ` npostavs
2016-09-03 19:27 ` Eli Zaretskii
2016-09-07 23:27 ` npostavs
2016-09-04 22:06 ` bug#17848: #17848 add suffix search to -l even when directory part in argument (WAS: Re: bug#16406: load prefers directories...) npostavs
2016-09-05 15:07 ` Eli Zaretskii
2016-09-05 22:59 ` bug#17848: #17848 add suffix search to -l even when directory part in argument npostavs
2016-09-06 15:05 ` Eli Zaretskii
2016-09-08 0:06 ` npostavs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83twdwdd0l.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=16406@debbugs.gnu.org \
--cc=npostavs@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).