From: Alex Kosorukoff <alex@3form.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 17467 <17467@debbugs.gnu.org>
Subject: bug#17467: 24.3; locate-library returning spurious path
Date: Sun, 11 May 2014 14:00:48 -0700 [thread overview]
Message-ID: <CAHD9_tTB962QcG6tuhVw-92G0qfjsDUfoU7=sjBfC-DcSaUv2w@mail.gmail.com> (raw)
In-Reply-To: <CAHD9_tRx8Gx58xdTkgMkOK-=p0ZurHEVCH90FHhq6yEjHkywng@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5589 bytes --]
Stefan is right that the bug was there for a long time. I would like my
patch be compatible with older versions of emacs that don't have
string-suffix-p, so here is the revised version
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: alex@3form.com-20140511205538-1asyz50g7d3y4lgw
# target_branch: :parent
# testament_sha1: d9ca6f57d0d8486d42ed77a739877a208a34f22e
# timestamp: 2014-05-11 13:55:53 -0700
# base_revision_id: monnier@iro.umontreal.ca-20140511034953-\
# 1mzcrftziwhrw9hl
#
# Begin patch
=== modified file 'lisp/subr.el'
--- lisp/subr.el 2014-04-09 01:48:07 +0000
+++ lisp/subr.el 2014-05-11 20:55:38 +0000
@@ -1857,10 +1857,14 @@
load-path (get-load-suffixes)))
nil nil
t))
- (let ((file (locate-file library
- (or path load-path)
- (append (unless nosuffix (get-load-suffixes))
- load-file-rep-suffixes))))
+ (let ((file
+ (locate-file library
+ (or path load-path)
+ (unless (or nosuffix
+ (string-match "\\.elc?\\.gz\\'" library))
+ (if (string-match "\\.elc?\\'" library)
+ load-file-rep-suffixes
+ (get-load-suffixes))))))
(if interactive-call
(if file
(message "Library is file %s" (abbreviate-file-name file))
# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWfbc99AABHZ/gDIwFUFQ4//3
8wgABL////BgBs96932joSoL3t0q2rG2TpgbVEE2kE9J6jNTyaZNNTagHqAAaaeoOYBNMAmQwABM
EwAAA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TND6RrmmfrsoU7lnoZ3CefiGW4rk+sSgcjiR1pBIiSQSIl8np6nm2uInuxVqAqHwHE
JEX3WHA5m230El7Dobc9lW9l4cvcho8QPqh+IniDxPK2HCHlOtFMzOlPwPMOD0Dwz1a9DjU9BJY5
6Fu/mfa9fCHJF+x+5uqFMjn7XfhnHuG9j3JLFes6IXnEraIXdKYTeJGspva7eg4iYPXVDDsTQIC8
33xlGuvV5sEqFJROfJ8nfWm5hFm3CeftDC7At8jwuQx6fiWIcubjY+8XkVBUCgvxQFK2tK6JPofR
GtSFpRcJMQsVOp9gac33JNjR5jHMwBkAF6FH0LjRk7eT2aVLnZXFKQzqcSa6aDGntmRuUjRktEnl
aYpEbgXl2ntPa+jrU8dyLMNHsYaBmPkjiePIfAzO4h74eQO7ufN0Q7m15CQ20vAho8n6oQYhY6He
PMGoez7BMLgn0dGTqD8w94OT7Xm4P0YATa8hPUJ0DV4iZvRTYT1BBG4G5iL3ofJUtGxmnAcINyKK
RiV4/OVmEEKc04jYhEogyEkyCxDg9zkPa2ZhrCrIe9tUHFqzEqYJR0C0ZBY8EN6tQTihBDreFEMA
I+L8OoATB73QCwNXyE6u8EPlUh9Xg55E3LzE1vD1MMIRaY3OPGzghoJUiPyQxToJATEmpuCquN72
uweLq6XhgqGgSnuatYGAljGDRArjU6IiSlO1ptukSJDJ56MbIvaNyFhNA5vvYbODvIItsG+ODIqJ
Nm/oO5mMna3j7GiYdriN4mpGAiTOSG57XmhYhpBT4CSfgFrwa/WJ6IbkOAPkk2F749yGCFJM2CQR
YDBCaBWJ8xMR8RLx3eg6R4+TvDDZwf/F3JFOFCQ9tz30AA==
On Sun, May 11, 2014 at 1:45 PM, Alex Kosorukoff <alex@3form.com> wrote:
> The issue is that locate-library returns spurious paths like ".*/tramp" or
> ".*xxx/tramp.gz" instead of returning a valid path to the library or nil if
> no matching path is found. This is both unexpected and incorrect given this
> function name and spec. It can cause user inconvenience or pose a
> security/privacy issue because a random file named "tramp" or "tramp.gz"
> placed in some directory of the load-path can be loaded instead of the
> standard library without user knowledge. This is why I would prefer to fix
> it.
>
> On Sun, May 11, 2014 at 12:50 PM, Stefan Monnier <monnier@iro.umontreal.ca
> > wrote:
>
>> > it should be just (".elc" ".elc.gz" ".el" ".el.gz") when nosuffix is
>> nil.
>>
>> Why?
>> Did you find some documentation indicating that this is how it should
>> work?
>> Or is it the behavior you'd prefer, and if so, can you explain why you'd
>> prefer that behavior? Which concrete cases do you specifically care
>> about?
>>
>
> This was the first and simplest way to address the issue above. Eli
> Zaretskii made a valid point that it is not consistent with the way this
> function worked before and not the most convenient for the user. I agree
> with this, so I posted a patch that handles the cases he described, except
> that it addresses the issue above.
>
>>
>> The current behavior has been in use for *many* years and I expect that
>> a fair bit of code relies on it, so we'd need a really good reason to
>> change it. Maybe we can accommodate your specific concrete cases in
>> some other way.
>>
>
> I understand that the bug was there for many years and many
> people implemented workarounds (I did). I don't think this is a valid
> reason to keep it though. We just need to be careful to make sure we don't
> introduce a regression while fixing it. Unit tests can help.
>
>
>>
>>
>> Stefan
>>
>
>
[-- Attachment #2: Type: text/html, Size: 7878 bytes --]
next prev parent reply other threads:[~2014-05-11 21:00 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-11 16:06 bug#17467: 24.3; locate-library returning spurious path Alex Kosorukoff
2014-05-11 17:03 ` Eli Zaretskii
2014-05-11 17:38 ` Alex Kosorukoff
2014-05-11 17:46 ` Eli Zaretskii
2014-05-11 17:53 ` Alex Kosorukoff
2014-05-11 18:10 ` Eli Zaretskii
2014-05-11 18:55 ` Alex Kosorukoff
2014-05-11 22:55 ` Stefan Monnier
2014-05-12 0:41 ` Alex Kosorukoff
2014-05-11 17:37 ` Glenn Morris
2014-05-11 17:43 ` Alex Kosorukoff
2014-05-11 19:50 ` Stefan Monnier
2014-05-11 20:45 ` Alex Kosorukoff
2014-05-11 21:00 ` Alex Kosorukoff [this message]
2014-05-11 21:19 ` Glenn Morris
2014-05-11 22:31 ` Alex Kosorukoff
2014-05-11 21:56 ` Stefan Monnier
2014-05-12 0:20 ` Alex Kosorukoff
2014-05-12 0:32 ` Glenn Morris
2014-05-12 1:35 ` Alex Kosorukoff
2014-05-12 2:02 ` Alex Kosorukoff
2014-05-12 2:18 ` Stefan Monnier
2014-05-12 4:36 ` Alex Kosorukoff
2014-05-12 6:39 ` Stefan Monnier
2014-05-12 17:46 ` Alex Kosorukoff
2020-08-25 10:39 ` Lars Ingebrigtsen
2020-08-25 14:22 ` Stefan Monnier
2020-08-25 14:25 ` Lars Ingebrigtsen
2020-10-13 1:41 ` Lars Ingebrigtsen
2014-05-15 19:39 ` Stefan Monnier
2014-05-15 23:57 ` Alex Kosorukoff
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHD9_tTB962QcG6tuhVw-92G0qfjsDUfoU7=sjBfC-DcSaUv2w@mail.gmail.com' \
--to=alex@3form.com \
--cc=17467@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.