unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26490: 25.1; package-buffer-info is incorrectly case-insensitive
@ 2017-04-14  0:44 Steve Purcell
  2017-04-14  7:31 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Steve Purcell @ 2017-04-14  0:44 UTC (permalink / raw)
  To: 26490

[-- Attachment #1: Type: text/plain, Size: 503 bytes --]




`package-buffer-info' looks for an "filename.el ends here" comment line,
where "filename.el" matches that provided on the first line of the
file. However, it does not set `case-fold-search' to nil explicitly, and
so will happily allow "FiLeNaMe.EL" in the trailing line.

I rely on this function in package-lint to detect certain issues with
packaging, and noticed this failure there. I can work around it by
unsetting `case-fold-search', but this seems the wrong fix.

A simple patch is attached.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 3769 bytes --]

From bfa9b23e6b4ef030e36fdcf5c15cef15fb01074a Mon Sep 17 00:00:00 2001
From: Steve Purcell <steve@sanityinc.com>
Date: Fri, 14 Apr 2017 12:38:17 +1200
Subject: [PATCH] package.el: make explicit the case sensitivity of
 package-buffer-info

---
 lisp/emacs-lisp/package.el | 63 +++++++++++++++++++++++-----------------------
 1 file changed, 32 insertions(+), 31 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 6728f1b80b1..d6ca14b135c 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -995,37 +995,38 @@ package-buffer-info
 error.  If there is a package, narrow the buffer to the file's
 boundaries."
   (goto-char (point-min))
-  (unless (re-search-forward "^;;; \\([^ ]*\\)\\.el ---[ \t]*\\(.*?\\)[ \t]*\\(-\\*-.*-\\*-[ \t]*\\)?$" nil t)
-    (error "Package lacks a file header"))
-  (let ((file-name (match-string-no-properties 1))
-        (desc      (match-string-no-properties 2))
-        (start     (line-beginning-position)))
-    (unless (search-forward (concat ";;; " file-name ".el ends here"))
-      (error "Package lacks a terminating comment"))
-    ;; Try to include a trailing newline.
-    (forward-line)
-    (narrow-to-region start (point))
-    (require 'lisp-mnt)
-    ;; Use some headers we've invented to drive the process.
-    (let* ((requires-str (lm-header "package-requires"))
-           ;; Prefer Package-Version; if defined, the package author
-           ;; probably wants us to use it.  Otherwise try Version.
-           (pkg-version
-            (or (package-strip-rcs-id (lm-header "package-version"))
-                (package-strip-rcs-id (lm-header "version"))))
-           (homepage (lm-homepage)))
-      (unless pkg-version
-        (error
-            "Package lacks a \"Version\" or \"Package-Version\" header"))
-      (package-desc-from-define
-       file-name pkg-version desc
-       (if requires-str
-           (package--prepare-dependencies
-            (package-read-from-string requires-str)))
-       :kind 'single
-       :url homepage
-       :maintainer (lm-maintainer)
-       :authors (lm-authors)))))
+  (let ((case-fold-search nil))
+    (unless (re-search-forward "^;;; \\([^ ]*\\)\\.el ---[ \t]*\\(.*?\\)[ \t]*\\(-\\*-.*-\\*-[ \t]*\\)?$" nil t)
+      (error "Package lacks a file header"))
+    (let ((file-name (match-string-no-properties 1))
+          (desc      (match-string-no-properties 2))
+          (start     (line-beginning-position)))
+      (unless (search-forward (concat ";;; " file-name ".el ends here"))
+        (error "Package lacks a terminating comment"))
+      ;; Try to include a trailing newline.
+      (forward-line)
+      (narrow-to-region start (point))
+      (require 'lisp-mnt)
+      ;; Use some headers we've invented to drive the process.
+      (let* ((requires-str (lm-header "package-requires"))
+             ;; Prefer Package-Version; if defined, the package author
+             ;; probably wants us to use it.  Otherwise try Version.
+             (pkg-version
+              (or (package-strip-rcs-id (lm-header "package-version"))
+                  (package-strip-rcs-id (lm-header "version"))))
+             (homepage (lm-homepage)))
+        (unless pkg-version
+          (error
+           "Package lacks a \"Version\" or \"Package-Version\" header"))
+        (package-desc-from-define
+         file-name pkg-version desc
+         (if requires-str
+             (package--prepare-dependencies
+              (package-read-from-string requires-str)))
+         :kind 'single
+         :url homepage
+         :maintainer (lm-maintainer)
+         :authors (lm-authors))))))
 
 (defun package--read-pkg-desc (kind)
   "Read a `define-package' form in current buffer.
-- 
2.12.2


[-- Attachment #3: Type: text/plain, Size: 586 bytes --]






In GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911))
 of 2016-09-21 built on builder10-9.porkrind.org
Windowing system distributor 'Apple', version 10.3.1504
Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES

Important settings:
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US
  locale-coding-system: utf-8


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-11-02  0:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-14  0:44 bug#26490: 25.1; package-buffer-info is incorrectly case-insensitive Steve Purcell
2017-04-14  7:31 ` Eli Zaretskii
2017-04-14  9:12   ` Steve Purcell
2017-04-14 20:29 ` Glenn Morris
2017-04-14 23:02   ` Steve Purcell
2019-08-24  5:57 ` Stefan Kangas
2019-08-24  6:35   ` Steve Purcell
2019-09-28 10:55     ` Stefan Kangas
2019-10-01 23:54       ` Basil L. Contovounesios
2019-10-04 12:48         ` Stefan Kangas
2019-10-20 14:16       ` Stefan Kangas
2019-10-21 16:05         ` Stefan Monnier
2019-11-02  0:31           ` Stefan Kangas

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).