[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 048f478 3/3: ob-tangle: Make ls-style file mode reg
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 048f478 3/3: ob-tangle: Make ls-style file mode regex stricter |
Date: |
Sat, 20 Nov 2021 10:57:22 -0500 (EST) |
branch: externals/org
commit 048f4787994c2494b50ed7b4539b1158b054bb04
Author: TEC <tec@tecosaur.com>
Commit: TEC <tec@tecosaur.com>
ob-tangle: Make ls-style file mode regex stricter
* lisp/ob-tangle (org-babel-interpret-file-mode): Instead of allowing 9
characters from [rwx-], require [r-][w-][x-] repeated thrice. This no
longer allows invalid ls-style file modes.
---
lisp/ob-tangle.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 7484ffe..3a38745 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -327,8 +327,9 @@ Did you give the decimal value %1$d by mistake?" 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)
+ ;; Match regexp taken from `file-modes-symbolic-to-number'.
(file-modes-symbolic-to-number mode org-babel-tangle-default-mode))
- ((string-match-p "^[rwx-]\\{9\\}$" mode)
+ ((string-match-p "^\\(?:[r-][w-][x-]\\)\\{3\\}$" mode)
(file-modes-symbolic-to-number (concat "u=" (substring mode 0 3)
",g=" (substring mode 3 6)
",a=" (substring mode 6 9))