From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alex Kosorukoff Newsgroups: gmane.emacs.bugs Subject: bug#17467: 24.3; locate-library returning spurious path Date: Sun, 11 May 2014 13:45:12 -0700 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0149cc30786b1704f925e9f8 X-Trace: ger.gmane.org 1399841183 31678 80.91.229.3 (11 May 2014 20:46:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 11 May 2014 20:46:23 +0000 (UTC) Cc: 17467 <17467@debbugs.gnu.org> To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 11 22:46:16 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WjadT-0007YT-ML for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 May 2014 22:46:15 +0200 Original-Received: from localhost ([::1]:34314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjadT-0008BO-Be for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 May 2014 16:46:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjadL-0008BG-Lx for bug-gnu-emacs@gnu.org; Sun, 11 May 2014 16:46:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjadG-0000BW-Ql for bug-gnu-emacs@gnu.org; Sun, 11 May 2014 16:46:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjadG-0000BS-NR for bug-gnu-emacs@gnu.org; Sun, 11 May 2014 16:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WjadG-00074f-EQ for bug-gnu-emacs@gnu.org; Sun, 11 May 2014 16:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Kosorukoff Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 May 2014 20:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17467 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17467-submit@debbugs.gnu.org id=B17467.139984114327167 (code B ref 17467); Sun, 11 May 2014 20:46:02 +0000 Original-Received: (at 17467) by debbugs.gnu.org; 11 May 2014 20:45:43 +0000 Original-Received: from localhost ([127.0.0.1]:59721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wjacw-000745-7M for submit@debbugs.gnu.org; Sun, 11 May 2014 16:45:43 -0400 Original-Received: from mail-oa0-f42.google.com ([209.85.219.42]:35639) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wjacs-00073n-U8 for 17467@debbugs.gnu.org; Sun, 11 May 2014 16:45:39 -0400 Original-Received: by mail-oa0-f42.google.com with SMTP id j17so7361714oag.1 for <17467@debbugs.gnu.org>; Sun, 11 May 2014 13:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=WVARWsNedNObe9qih4Lo5QNnVqUkmMM4Y+JWDuZf8mM=; b=H0u+G111WXDDXzcEbygmEdRdaGqCyXnV/HYzY88kqXh1wl1m80HRwtMHmnMRckfsUm RSITBLcivlJ/cSVShUtCtNRPVP00KxtkYeIE/0aSuJ/ITXbnoWqm0Vw+a29+QP4kpXz/ sADQdYQxy6Tz24z5vE+qGEn4pOcz9lBNuRmEWRbNXthMu3qHc0ZDzRUapsORuAj2f8zy q/3slK2WJ9IYc1afYsYjuA5sq6UzBIjZbFSelYbGJqc83TfKRKk2ScmLKhKzb2ONqeIi FH3pGY1HIyGFeBJNN6OET4kg5sdElfGuVyZZVTsFD5EsumzV/ioFUQy/ShXgYzH5Yyj+ MDzg== X-Received: by 10.60.39.131 with SMTP id p3mr29313233oek.44.1399841132930; Sun, 11 May 2014 13:45:32 -0700 (PDT) Original-Received: by 10.182.240.131 with HTTP; Sun, 11 May 2014 13:45:12 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: 4wpv_lDMvdUna5y-rGHh8iw4Rxo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:88934 Archived-At: --089e0149cc30786b1704f925e9f8 Content-Type: text/plain; charset=UTF-8 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 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 > --089e0149cc30786b1704f925e9f8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
The issue is that locate-library returns spurio= us 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. I= t can cause user inconvenience or pose a security/privacy issue because a r= andom file named "tramp" or "tramp.gz" placed in some d= irectory of the load-path can be loaded instead of the standard library wit= hout user knowledge. This is why I would prefer to fix it.

= On Sun, May 11, 2014 at 12:50 PM, Stefan Monnier <monnier@iro.umont= real.ca> wrote:
> it should be just (".elc" &= quot;.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&= #39;d
prefer that behavior? =C2=A0Which concrete cases do you specifically care a= bout?

This was the first and simp= lest way to address the issue above.=C2=A0Eli 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 th= at 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. =C2=A0Maybe we can accommodate your specific concrete cases in some other way.

I understand that the b= ug was there for many years and many people=C2=A0implemented 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 f= ixing it. Unit tests can help.
=C2=A0


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan

--089e0149cc30786b1704f925e9f8--