Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177653462
D61647.1794954470.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
5 KB
Referenced Files
None
Subscribers
None
D61647.1794954470.diff
View Options
Index: editors/emacs/Makefile
===================================================================
--- editors/emacs/Makefile
+++ editors/emacs/Makefile
@@ -1,6 +1,6 @@
PORTNAME= emacs
DISTVERSION= 31.1
-PORTREVISION= 3
+PORTREVISION= 4
PORTEPOCH= 3
CATEGORIES= editors
MASTER_SITES= GNU
Index: editors/emacs/files/patch-lisp_files.el
===================================================================
--- /dev/null
+++ editors/emacs/files/patch-lisp_files.el
@@ -0,0 +1,108 @@
+--- lisp/files.el.orig 2026-07-31 10:15:51 UTC
++++ lisp/files.el
+@@ -3506,44 +3506,42 @@ Also applies to `magic-fallback-mode-alist'.")
+ "Upper limit on `magic-mode-alist' regexp matches.
+ Also applies to `magic-fallback-mode-alist'.")
+
+-(defun set-auto-mode--find-matching-alist-entry (alist name case-insensitive)
++(defun set-auto-mode--from-matching-alist-entry ( alist name case-insensitive
++ keep-mode-if-same dir-local)
+ "Find first matching entry in ALIST for file NAME.
+
+ If CASE-INSENSITIVE, the file system of file NAME is case-insensitive."
+- (let (mode)
+- (while name
+- (let ((newmode
+- (if case-insensitive
+- ;; Filesystem is case-insensitive.
+- (let ((case-fold-search t))
+- (assoc-default name alist 'string-match))
+- ;; Filesystem is case-sensitive.
+- (or
+- ;; First match case-sensitively.
+- (let ((case-fold-search nil))
+- (assoc-default name alist 'string-match))
+- ;; Fallback to case-insensitive match.
+- (and auto-mode-case-fold
+- (let ((case-fold-search t))
+- (assoc-default name alist 'string-match)))))))
+- (when newmode
+- (when mode
+- ;; We had already found a mode but in a (REGEXP MODE t)
+- ;; entry, so we still have to run MODE. Let's do it now.
+- ;; FIXME: It's kind of ugly to run the function here.
+- ;; An alternative could be to return a list of functions and
+- ;; callers.
+- (set-auto-mode-0 mode t))
+- (setq mode newmode))
+- (if (and newmode
+- (not (functionp newmode))
+- (consp newmode)
+- (cadr newmode))
+- ;; It's a (REGEXP MODE t): Keep looking but remember the MODE.
+- (setq mode (car newmode)
+- name (substring name 0 (match-beginning 0)))
+- (setq name nil))))
+- mode))
++ (let (was-set)
++ (while
++ (let* ((newmode
++ (if case-insensitive
++ ;; Filesystem is case-insensitive.
++ (let ((case-fold-search t))
++ (assoc-default name alist 'string-match))
++ ;; Filesystem is case-sensitive.
++ (or
++ ;; First match case-sensitively.
++ (let ((case-fold-search nil))
++ (assoc-default name alist 'string-match))
++ ;; Fallback to case-insensitive match.
++ (and auto-mode-case-fold
++ (let ((case-fold-search t))
++ (assoc-default name alist 'string-match)))))))
++ (when newmode
++ (let* ((mode-t ;; Is it a (REGEXP MODE NON-NIL) entry?
++ (and (not (functionp newmode))
++ (consp newmode) (cadr newmode)))
++ (mode (if (null mode-t) newmode
++ (setq name (substring name 0 (match-beginning 0)))
++ (car newmode))))
++ (when mode
++ (if (and dir-local
++ (not (set-auto-mode--dir-local-valid-p mode)))
++ (message "Ignoring invalid mode `%S'" mode)
++ (set-auto-mode-0 mode keep-mode-if-same)
++ (setq was-set t)))
++ mode-t))))
++ was-set))
+
+ (defun set-auto-mode--apply-alist (alist keep-mode-if-same dir-local)
+ "Helper function for `set-auto-mode'.
+@@ -3555,8 +3553,7 @@ extra checks should be done."
+ DIR-LOCAL non-nil means this call is via directory-locals, and
+ extra checks should be done."
+ (if buffer-file-name
+- (let (mode
+- (name buffer-file-name)
++ (let ((name buffer-file-name)
+ (remote-id (file-remote-p buffer-file-name))
+ (case-insensitive-p (file-name-case-insensitive-p
+ buffer-file-name)))
+@@ -3566,15 +3563,8 @@ extra checks should be done."
+ (when (and (stringp remote-id)
+ (string-match (regexp-quote remote-id) name))
+ (setq name (substring name (match-end 0))))
+- (setq mode (set-auto-mode--find-matching-alist-entry
+- alist name case-insensitive-p))
+- (when (and dir-local mode
+- (not (set-auto-mode--dir-local-valid-p mode)))
+- (message "Ignoring invalid mode `%S'" mode)
+- (setq mode nil))
+- (when mode
+- (set-auto-mode-0 mode keep-mode-if-same)
+- t))))
++ (set-auto-mode--from-matching-alist-entry
++ alist name case-insensitive-p keep-mode-if-same dir-local))))
+
+ (defun set-auto-mode--dir-local-valid-p (mode)
+ "Say whether MODE can be used in a .dir-local.el `auto-mode-alist'."
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 17, 10:27 PM (17 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41809215
Default Alt Text
D61647.1794954470.diff (5 KB)
Attached To
Mode
D61647: editors/emacs: Backport fix for .dir-locals.el arbitrary code execution
Attached
Detach File
Event Timeline