From: Mattias EngdegÄrd <mattiase@acm.org>
Date: Wed, 16 Aug 2023 12:57:48 +0000 (+0200)
Subject: ob-tangle.el: fix unintended range in regexp
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1ad318cf2ae22d945f8bfcd61981d619467a36da;p=emacs.git

ob-tangle.el: fix unintended range in regexp

* lisp/org/ob-tangle.el (org-babel-interpret-file-mode):
Repair parts of regexp that should only match +, - and =.
* lisp/files.el (file-modes-symbolic-to-number):
Fix the same error in a doc string; this seems to be where
the mistake originated.
---

diff --git a/lisp/files.el b/lisp/files.el
index 03675a34f3a..68c0a10792d 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -8553,7 +8553,7 @@ the leading `-' character."
 (defun file-modes-symbolic-to-number (modes &optional from)
   "Convert symbolic file modes to numeric file modes.
 MODES is the string to convert, it should match
-\"[ugoa]*([+-=][rwxXstugo]*)+,...\".
+\"[ugoa]*([+=-][rwxXstugo]*)+,...\".
 See Info node `(coreutils)File permissions' for more information on this
 notation.
 FROM (or 0 if nil) gives the mode bits on which to base permissions if
diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el
index 0b816a7c13c..a833037ca2b 100644
--- a/lisp/org/ob-tangle.el
+++ b/lisp/org/ob-tangle.el
@@ -357,7 +357,7 @@ Did you give the decimal value %1$d by mistake?" mode)))
     (error "File mode %S not recognized as a valid format." mode))
    ((string-match-p "^o0?[0-7][0-7][0-7]$" mode)
     (string-to-number (replace-regexp-in-string "^o" "" mode) 8))
-   ((string-match-p "^[ugoa]*\\(?:[+-=][rwxXstugo]*\\)+\\(,[ugoa]*\\(?:[+-=][rwxXstugo]*\\)+\\)*$" mode)
+   ((string-match-p "^[ugoa]*\\(?:[+=-][rwxXstugo]*\\)+\\(,[ugoa]*\\(?:[+=-][rwxXstugo]*\\)+\\)*$" mode)
     ;; Match regexp taken from `file-modes-symbolic-to-number'.
     (file-modes-symbolic-to-number mode org-babel-tangle-default-file-mode))
    ((string-match-p "^[r-][w-][xs-][r-][w-][xs-][r-][w-][x-]$" mode)