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.
This commit is contained in:
Mattias Engdegård 2023-08-16 14:57:48 +02:00
parent ca68783929
commit 1ad318cf2a
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

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