From mboxrd@z Thu Jan 1 00:00:00 1970 From: anothersms@gmail.com (=?utf-8?Q?Nicol=C3=B2?= Balzarotti) Subject: [PATCH] ox-odt.el: (org-odt-template): Get write permissions on styles.xml Date: Fri, 20 Dec 2019 12:10:49 +0100 Message-ID: <878sn75k1y.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:40318) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiGBM-0000sL-JC for emacs-orgmode@gnu.org; Fri, 20 Dec 2019 06:10:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiGBK-0002z1-I6 for emacs-orgmode@gnu.org; Fri, 20 Dec 2019 06:10:56 -0500 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:36230) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iiGBK-0002sd-7Q for emacs-orgmode@gnu.org; Fri, 20 Dec 2019 06:10:54 -0500 Received: by mail-ed1-x52b.google.com with SMTP id j17so7880348edp.3 for ; Fri, 20 Dec 2019 03:10:53 -0800 (PST) Received: from guixSD (host1-200-dynamic.5-87-r.retail.telecomitalia.it. [87.5.200.1]) by smtp.gmail.com with ESMTPSA id h18sm1042325ejf.54.2019.12.20.03.10.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 03:10:50 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: #'. 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=C3=B2 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ox-odt.el-org-odt-template-Get-write-permissions-on-.patch >From a80be4da6880443f2b947ade03092699fa24c846 Mon Sep 17 00:00:00 2001 From: nixo 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 --=-=-=--