From patchwork Sun Dec 15 15:07:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Nicol=C3=B2_Balzarotti?= X-Patchwork-Id: 16526 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id DCA55178E0; Sun, 15 Dec 2019 15:08:12 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 5D0BE178D7 for ; Sun, 15 Dec 2019 15:08:12 +0000 (GMT) Received: from localhost ([::1]:40482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igVVD-0004qB-Tq for patchwork@mira.cbaines.net; Sun, 15 Dec 2019 10:08:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43516) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igVV6-0004q5-0z for guix-patches@gnu.org; Sun, 15 Dec 2019 10:08:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igVV4-0000hq-GH for guix-patches@gnu.org; Sun, 15 Dec 2019 10:08:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59275) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igVV4-0000gq-9r for guix-patches@gnu.org; Sun, 15 Dec 2019 10:08:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1igVV4-0003CK-52 for guix-patches@gnu.org; Sun, 15 Dec 2019 10:08:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38616] =?utf-8?b?W05pY29sw7I=?= Balzarotti] [bug#38616] emacs: fix odt export In-Reply-To: <87a77ueaka.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> Resent-From: anothersms@gmail.com (=?utf-8?q?Nicol=C3=B2?= Balzarotti) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 15 Dec 2019 15:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38616 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: emacs-orgmode@gnu.org Cc: 38616@debbugs.gnu.org Received: via spool by 38616-submit@debbugs.gnu.org id=B38616.157642247212258 (code B ref 38616); Sun, 15 Dec 2019 15:08:02 +0000 Received: (at 38616) by debbugs.gnu.org; 15 Dec 2019 15:07:52 +0000 Received: from localhost ([127.0.0.1]:37015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1igVUu-0003Bd-BJ for submit@debbugs.gnu.org; Sun, 15 Dec 2019 10:07:52 -0500 Received: from mail-wr1-f47.google.com ([209.85.221.47]:33668) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1igVUs-0003B5-6z for 38616@debbugs.gnu.org; Sun, 15 Dec 2019 10:07:50 -0500 Received: by mail-wr1-f47.google.com with SMTP id b6so4179715wrq.0 for <38616@debbugs.gnu.org>; Sun, 15 Dec 2019 07:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:message-id:mime-version; bh=bgFO5maNS1ypCC0C6rQbHgF+1qPt27Q7QHXXlf9sg7Y=; b=K6iVY4IZwQmztgxhE/eTN0A84hSEouEawk0RBWaSaI9hkkvtrRrVmVHj9FBrMCqH2+ 3Ex3sCIwoDeFYgLwJFTwgIawjV3nEuwLPyDhkLUI7z2TfS/+Q0mTtIMdqOiT/LsAvi7u 2OMrV4RYrZlvlDDYk+UKu+gLh3yZvtHB1qqae5mNoJIfGOHtpbQIRgUU565t979r95Vy x+TyyloyA14gtlO5Cau/xXEUbx4UQKrAS9UcQRpPZE+DJlnwbj3fe0PIw+3o/3jEqtl5 4rh32G9N0ExY9okhfDPde77tTnZX4u80CL2ca8wTMivvVZq+X6h6QJYfz32rliYExI7H dOhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:message-id :mime-version; bh=bgFO5maNS1ypCC0C6rQbHgF+1qPt27Q7QHXXlf9sg7Y=; b=cnKvjscljJkZvI0w4EM+fKOEQIpi5IQ5Sav8DSeoehQltLGEno7d+0UImNFo5ma3YI na43e5JSjgqSCGcxkmQKovjBXisvEgHNr5ZLecIW8kAOAdtAonkm9yXtGUApmLusisRt HG7xf9xLq/rh5u7bjNKKf1i3iyS1vPghcPgQVL2CKvD7kIoLwS9c5tM1uKI6nyECsrba 7ls9MeSZ3yWT2XSBX8ldb+BUwiNuh+GUDlIMjTqgk5/KoLD8oz0XzKtjJ3G4XumA6yly hn3gcns6ZlYaH7tDWN4owXd4qzWML1EdNdJYdj9q5vsWjxwnSTrLL5NJF9W5CXOXhNmY 835Q== X-Gm-Message-State: APjAAAUi/u67ZkKT0G4GAziQ1GCPY8VO85wJ7AruaBNF3FHQKaYybXRt z37o2xntT30qkprj/W54w5Agpv4td4Y= X-Google-Smtp-Source: APXvYqxmwfvQ/sLakja+FfV2THGq6I6y1oXncA3NsoTnp/VLlbb4w5g4JkhImivFdACXB6nq4+2msw== X-Received: by 2002:a5d:4045:: with SMTP id w5mr23529367wrp.59.1576422463834; Sun, 15 Dec 2019 07:07:43 -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 w22sm16957264wmk.34.2019.12.15.07.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Dec 2019 07:07:42 -0800 (PST) From: anothersms@gmail.com (=?utf-8?q?Nicol=C3=B2?= Balzarotti) References: <87a77ueaka.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> Date: Sun, 15 Dec 2019 16:07:41 +0100 Message-ID: <87bls9eif6.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hello Org Mode people! This is my first bug-report :) I found a problem on org-odt-export-to-odt function. The export fails with 'OpenDocument export failed: Buffer is read-only: #'. The problem happens on ox-odt, when the file OrgOdtStyles.xml permissions are read-only (this is true especially for Guix and Nix where all the "store" is readonly). The file gets copied to /tmp/ob-*/ directory, and is then modified. However, the file is assumed to be read/write. When the file is not, the export fails. I've sent a one-line patch (simply change permissions to the newly-copied file): > (set-file-modes (concat org-odt-zip-dir "styles.xml") #o600) to guix-patches (here in CC, I'm also forwarding my original patch submission here), but I've been suggested to send the patch upstream. What do you think? I can submit a proper patch if needed (but feel free to patch it yourself) I want to thank everybody for how wonderful Org Mode is :) Nicolò Hello Guix! Neither on NixOS or in guix I've ever been able to export an org file to otd. The error was 'OpenDocument export failed: Buffer is read-only: #'. I've seen some report of this error on the web, like: - https://lists.gnu.org/archive/html/emacs-orgmode/2018-05/msg00545.html - https://github.com/syl20bnr/spacemacs/issues/1482 but also on our IRC: - http://logs.guix.gnu.org/guix/2019-05-07.log - http://logs.guix.gnu.org/guix/2019-07-25.log but I was not able to find a fix for it. Today I checked the source and figured it out. The explanation, as written in the patch, is the following > Files inside the guix store are read only. "styles.xml" is copied from the > store (/share/emacs/26.3/etc/org/OrgOdtStyles.xml), so it's read only too. > ox-odt needs this file, so if it's not writable it will fail. This patch > adjust the permissions. So, this patches fixes the permissions on the file. I've two questions: 1. Is it fine to have a .patch, or should I add a phase where I fix the file? this seemed to be easier 2. If the same error happens for other programs, might it make sense to "fake" rw permissions in the store (by using a virtual fs or something) so that files are copied as rw, but files in the store are still ro? Thanks! Nicolò From c1ad3fff9bda5935651f26e460907a77d1b3d003 Mon Sep 17 00:00:00 2001 From: nixo Date: Sat, 14 Dec 2019 15:17:11 +0100 Subject: [PATCH] * gnu/packages/emascs.scm (emacs)[patches]: Fix odt export. ox-odt copyes the file /share/emacs/26.3/etc/org/OrgOdtStyles.xml under /tmp/odt-*/styles.xml and tries to modify it. Since files in the guix store are read-only, it will fail. This patch fixes the export by adjusting permissions during the export. --- gnu/packages/emacs.scm | 1 + .../patches/emacs-fix-odt-export.patch | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 gnu/packages/patches/emacs-fix-odt-export.patch diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index eba7f88551..8183b69eb3 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -80,6 +80,7 @@ "119ldpk7sgn9jlpyngv5y4z3i7bb8q3xp4p0qqi7i5nq39syd42d")) (patches (search-patches "emacs-exec-path.patch" "emacs-fix-scheme-indent-function.patch" + "emacs-fix-odt-export.patch" "emacs-source-date-epoch.patch")) (modules '((guix build utils))) (snippet diff --git a/gnu/packages/patches/emacs-fix-odt-export.patch b/gnu/packages/patches/emacs-fix-odt-export.patch new file mode 100644 index 0000000000..0c3c44a2e3 --- /dev/null +++ b/gnu/packages/patches/emacs-fix-odt-export.patch @@ -0,0 +1,25 @@ +Files inside the guix store are read only. "styles.xml" is copied from the +store (/share/emacs/26.3/etc/org/OrgOdtStyles.xml), so it's read only too. +ox-odt needs this file, so if it's not writable it will fail. This patch +adjust the permissions. + +--- + lisp/org/ox-odt.el | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el +index f9c4a93cc8..61988ffcc4 100644 +--- a/lisp/org/ox-odt.el ++++ b/lisp/org/ox-odt.el +@@ -1384,6 +1384,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") + ++ ;; guix store files are ro. This file need to be modified, make it rw ++ (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 + (find-file-noselect (concat org-odt-zip-dir "styles.xml") t) +-- +2.24.0 + -- 2.24.0