From: anothersms@gmail.com (Nicolò Balzarotti)
To: emacs-orgmode@gnu.org
Subject: [PATCH] ox-odt.el: (org-odt-template): Get write permissions on styles.xml
Date: Fri, 20 Dec 2019 12:10:49 +0100 [thread overview]
Message-ID: <878sn75k1y.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> (raw)
[-- Attachment #1: Type: text/plain, Size: 616 bytes --]
Hello Org!
I attached a patch that is required to get ox-odt to work on
guix/nix/other distributions where package files are placed in a
read-only directory. After the file styles.xml is copied to /tmp, now
we set read-write permissions to it before trying to write it. Before
this patch, we got the error:
'OpenDocument export failed: Buffer is read-only: #<killed buffer>'.
It's my first patch and is just 1 line long, so following instructions
on https://orgmode.org/worg/org-contribute.html#commit-messages I added
the TINYCHANGE cookie. Tests (make test) are passing.
Thanks!
Nicolò
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-odt.el-org-odt-template-Get-write-permissions-on-.patch --]
[-- Type: text/x-patch, Size: 1229 bytes --]
From a80be4da6880443f2b947ade03092699fa24c846 Mon Sep 17 00:00:00 2001
From: nixo <nicolo@nixo.xyz>
Date: Fri, 20 Dec 2019 11:45:11 +0100
Subject: [PATCH] ox-odt.el: (org-odt-template): Get write permissions on
styles.xml
To: emacs-orgmode@gnu.org
(org-odt-template): The file `styles.xml' might be copied from a
location where it is read-only. Since we need to modify it (and its
copied under /tmp, so we can modify it), we need to ensure we have
write persmissions on it. Set mode to 600.
This is especially needed for projects like guix, where all system
files are stored in a read-only location.
TINYCHANGE
---
lisp/ox-odt.el | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index f9c4a93cc..b8e228246 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -1383,6 +1383,8 @@ original parsed data. INFO is a plist holding export options."
;; create a manifest entry for styles.xml
(org-odt-create-manifest-file-entry "text/xml" "styles.xml")
+ ;; ensure we have write permissions to this file
+ (set-file-modes (concat org-odt-zip-dir "styles.xml") #o600)
;; FIXME: Who is opening an empty styles.xml before this point?
(with-current-buffer
--
2.24.0
next reply other threads:[~2019-12-20 11:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-20 11:10 Nicolò Balzarotti [this message]
2019-12-22 9:24 ` [PATCH] ox-odt.el: (org-odt-template): Get write permissions on styles.xml Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878sn75k1y.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me \
--to=anothersms@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).