From df53e6282e7113b2601490266315f5018d7f2d6b Mon Sep 17 00:00:00 2001 From: Christopher Lemmer Webber Date: Sun, 11 Oct 2020 12:56:34 -0400 Subject: [PATCH] ox-odt: Fix read-only error with styles.xml. On systems where the source file is read-only, it's possible that the destination styles.xml could end up read-only as well, resulting in an error when modified or deleted by us. * lisp/ox-odt.el (org-odt-template): Explicitly set permissions of styles.xml to read-write for the current user. --- lisp/ox-odt.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index 104319a9d..c2693d883 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -1375,7 +1375,13 @@ original parsed data. INFO is a plist holding export options." ((string= styles-file-type "xml") (copy-file styles-file (concat org-odt-zip-dir "styles.xml") t)) ((member styles-file-type '("odt" "ott")) - (org-odt--zip-extract styles-file "styles.xml" org-odt-zip-dir))))) + (org-odt--zip-extract styles-file "styles.xml" org-odt-zip-dir))) + ;; It's possible that when copying the file from a location that's + ;; read-only that we accidentally end up with a read-only styles.xml + ;; here also (eg on Guix systems)... this prevents that from + ;; blowing up + (set-file-modes (concat org-odt-zip-dir "styles.xml") + #o600))) (t (error "Invalid specification of styles.xml file: %S" (plist-get info :odt-styles-file)))) -- 2.28.0