From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#16406: load prefers directories rather than searching load-path Date: Sat, 03 Sep 2016 14:43:53 -0400 Message-ID: <87r390aknq.fsf@users.sourceforge.net> References: <8737lyulkl.fsf@users.sourceforge.net> <878tv9ndce.fsf@users.sourceforge.net> <831t10evoh.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1472928261 32658 195.159.176.226 (3 Sep 2016 18:44:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 3 Sep 2016 18:44:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 16406@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 03 20:44:17 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgFvM-0007oi-Ux for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Sep 2016 20:44:17 +0200 Original-Received: from localhost ([::1]:47416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgFvK-0007PZ-FM for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Sep 2016 14:44:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgFvE-0007OE-6e for bug-gnu-emacs@gnu.org; Sat, 03 Sep 2016 14:44:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgFv8-0001so-6x for bug-gnu-emacs@gnu.org; Sat, 03 Sep 2016 14:44:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51229) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgFv8-0001sk-3G for bug-gnu-emacs@gnu.org; Sat, 03 Sep 2016 14:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bgFv7-0000cy-Uo for bug-gnu-emacs@gnu.org; Sat, 03 Sep 2016 14:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Sep 2016 18:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16406 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 16406-submit@debbugs.gnu.org id=B16406.14729282222378 (code B ref 16406); Sat, 03 Sep 2016 18:44:01 +0000 Original-Received: (at 16406) by debbugs.gnu.org; 3 Sep 2016 18:43:42 +0000 Original-Received: from localhost ([127.0.0.1]:48941 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgFun-0000cI-PD for submit@debbugs.gnu.org; Sat, 03 Sep 2016 14:43:41 -0400 Original-Received: from mail-it0-f49.google.com ([209.85.214.49]:35997) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgFul-0000c5-Nj for 16406@debbugs.gnu.org; Sat, 03 Sep 2016 14:43:40 -0400 Original-Received: by mail-it0-f49.google.com with SMTP id i184so91326171itf.1 for <16406@debbugs.gnu.org>; Sat, 03 Sep 2016 11:43:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=7NeFj/oWh5ToSYoaRd7+md5L8gHvEzFaz+QHwdyXBJE=; b=CKuh5IAGYwkPYIotR78Fwx/x6IgBqyo0F9PUlSx/J7FI0A73CIvb9qzF9HnB+BCS1F z4ky/RCEEG4H533r04fI+wdWis+g5QXyPkeVO38QE9idXhBoJX2eX5aBxzGadSDwCuiT LDrsvzlgnsm9pCEgoiiZwzryos202KpviBwDGpfDNtpvGbTxnO7t3bWYpKi2ss9vAJuu VEFZWLLbuGx/nH8JS3zJ0u196MzJ1tSTEHqGw2R6DuI2ZKEbVZtkCDLZPa18eQdddodx bbqzykzL/NmzLQ4zm7INIRY0XyjHHCM9QFaoZ1fKnTcdG6606+mKvbbDuUQm5PLfQTYb QYpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=7NeFj/oWh5ToSYoaRd7+md5L8gHvEzFaz+QHwdyXBJE=; b=OdwShpzcnyChf8DtvRpNZ/RoJqpw5VkTREpEFbr+5p8C26NocjpFkTxStRvhwIPQG+ 42E9LIXbDQX1VArFYlX/751vc8HesxUhkuRPMqdHF7JfRUEUfBkkrGIEiXZAEaickB/A l11fg7EtE40YaZPcbx65LKAvQfDQHjMjLwFUiKRBH3hHeG3mEyQ/vdowNl0X3c5jOhQl ApOhxRNrZhMShvtTef3kWAENtW65g749FNN2Ekbf4Z4cUsxEqVDcpMpn1gFO51wC60x+ K1+Pus48DhR+O8wFfbrsZaoD8iXhs8wN0LSIHmdCrnz+ZgnuMAP35+FfBZHWr2yhmhfQ JeiA== X-Gm-Message-State: AE9vXwMu9goxzaZhyRFg1mQRyIH5NGpazPeWT/M09RkgrPoTtaotZFc3FOOQKK8LAPqRcA== X-Received: by 10.36.209.130 with SMTP id w124mr12921597itg.2.1472928214123; Sat, 03 Sep 2016 11:43:34 -0700 (PDT) Original-Received: from zony ([45.2.7.130]) by smtp.googlemail.com with ESMTPSA id i80sm4879261ita.5.2016.09.03.11.43.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 03 Sep 2016 11:43:33 -0700 (PDT) In-Reply-To: <831t10evoh.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 03 Sep 2016 20:32:14 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:122903 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: npostavs@users.sourceforge.net >> Date: Sat, 03 Sep 2016 12:43:29 -0400 >> Cc: 16406@debbugs.gnu.org >> >> > Seems simple enough to fix, here is a patch (this also covers #17848 >> > "add suffix search to -l even when directory part in argument"): >> >> That one broke normal loading. Here's a new patch. > > Instead of doing the search by hand, wouldn't it be better to teach > 'load' to ignore directories? Or do we have a use case where finding > a directory in 'load' would make sense? > > IOW, isn't "'load' prefers directories" the actual problem we should > fix, rather than only fixing the startup problem? > > 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. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=v3-0001-Don-t-load-directories.patch Content-Description: patch >From ba8ddc2e039fe982bdfa46519c003808be9ddff3 Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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))) -- 2.9.3 --=-=-=--