bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26490: 25.1; package-buffer-info is incorrectly case-insensitive


From: Steve Purcell
Subject: bug#26490: 25.1; package-buffer-info is incorrectly case-insensitive
Date: Fri, 14 Apr 2017 12:44:24 +1200
User-agent: mu4e 0.9.17; emacs 25.1.1



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


>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





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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]