From 1ad318cf2ae22d945f8bfcd61981d619467a36da Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mattias=20Engdeg=C3=A5rd?= Date: Wed, 16 Aug 2023 14:57:48 +0200 Subject: [PATCH] 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. --- lisp/files.el | 2 +- lisp/org/ob-tangle.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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) -- 2.39.2