From mboxrd@z Thu Jan 1 00:00:00 1970 From: anothersms@gmail.com (=?utf-8?Q?Nicol=C3=B2?= Balzarotti) Subject: =?UTF-8?B?W05pY29sw7IgQmFsemFyb3R0aV0gW2J1ZyMzODYxNl0gZW1hY3M6?= =?UTF-8?B?IGZpeCBvZHQgZXhwb3J0?= Date: Sun, 15 Dec 2019 16:07:41 +0100 Message-ID: <87bls9eif6.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> References: <87a77ueaka.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]:42759) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igVUp-0004pf-Hy for emacs-orgmode@gnu.org; Sun, 15 Dec 2019 10:07:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igVUn-0007rj-Pb for emacs-orgmode@gnu.org; Sun, 15 Dec 2019 10:07:47 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:44660) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igVUn-0007lt-CV for emacs-orgmode@gnu.org; Sun, 15 Dec 2019 10:07:45 -0500 Received: by mail-wr1-x436.google.com with SMTP id q10so4112359wrm.11 for ; Sun, 15 Dec 2019 07:07:45 -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 Cc: 38616@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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=C3=B2 --=-=-= Content-Type: message/rfc822 Content-Disposition: inline Return-Path: Delivered-To: nicolo@nixo.xyz Received: from mail.nixo.xyz by nixo.xyz with LMTP id NmYMBkV09V3udgAAcNA2gQ (envelope-from ) for ; Sun, 15 Dec 2019 00:46:13 +0100 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=guix-patches-bounces+nicolo=nixo.xyz@gnu.org; receiver= Authentication-Results: mail.nixo.xyz; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ub2WNYZQ Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mail.nixo.xyz (Postfix) with ESMTPS id B213C6EEBAE for ; Sun, 15 Dec 2019 00:46:12 +0100 (CET) Received: from localhost ([::1]:34728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igH6w-0003At-Vl for nicolo@nixo.xyz; Sat, 14 Dec 2019 18:46:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45739) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igH6s-0003AJ-5F for guix-patches@gnu.org; Sat, 14 Dec 2019 18:46:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igH6q-0006ob-4S for guix-patches@gnu.org; Sat, 14 Dec 2019 18:46:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:58149) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igH6o-0006nl-Rv for guix-patches@gnu.org; Sat, 14 Dec 2019 18:46:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1igH6n-0007uI-Pw for guix-patches@gnu.org; Sat, 14 Dec 2019 18:46:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38616] emacs: fix odt export Resent-From: anothersms@gmail.com (=?utf-8?Q?Nicol=C3=B2?= Balzarotti) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 14 Dec 2019 23:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 38616 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 38616@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.157636712330340 (code B ref -1); Sat, 14 Dec 2019 23:46:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 Dec 2019 23:45:23 +0000 Received: from localhost ([127.0.0.1]:35889 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1igH6A-0007tH-Tq for submit@debbugs.gnu.org; Sat, 14 Dec 2019 18:45:23 -0500 Received: from lists.gnu.org ([209.51.188.17]:56032) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1igH68-0007t9-HD for submit@debbugs.gnu.org; Sat, 14 Dec 2019 18:45:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39657) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igH66-00031f-8Z for guix-patches@gnu.org; Sat, 14 Dec 2019 18:45:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igH64-0005aP-6n for guix-patches@gnu.org; Sat, 14 Dec 2019 18:45:18 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:35885) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igH62-0005YF-DW for guix-patches@gnu.org; Sat, 14 Dec 2019 18:45:15 -0500 Received: by mail-wr1-x42e.google.com with SMTP id z3so2872707wru.3 for ; Sat, 14 Dec 2019 15:45:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=TJq7Q7ZbA53y1YE6p4dVv6MVmqdFo/sarCKAYx/nvUY=; b=ub2WNYZQU4anOCLdoWok6tLgeE1XCxMguOkiDBqK6xSZ9dt+fHyLYDjMACDOzIGKK8 s5Jv11zqVKZgSkWg5E3mC4/LHVaMCCQMyPgkSUnCmQt/Tux8Wpk8ywB+KO9n9S3j8aQW rY3vN37p25u3j4F+yHZoEUAZSv0ufjHHvyYrsrgAqDHmXotn/PAZ98r5KlhoUXoxhW1r b7q4WQzS1JOzkBM4lYjLOUr8AnSgHZyoyHU7eY2xz9+BrCS0M6ayis2G0QKT1wst/Ipf 04lJUO675wHk5QsdpSyR9VAJRozYjAIRIuAhTLYgElR0cgYiKlMgSEPLYzsBY9K25sUK DhXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=TJq7Q7ZbA53y1YE6p4dVv6MVmqdFo/sarCKAYx/nvUY=; b=aWuZL8qLESXj/fFazCnzYApXHZ3y/Hxmai56D8NBQdkRrGRDrHiDE+EoQ+fwN40gFt Vr/AJsb5bSlYIpVEpfNQR99B5bBa+g0ODeCCdmRIPCLNUm54754rLgiH/eiM1r3ao/B+ Wya+bEdN790i7MKsVQValbXENwf7GiAy/jT5aRbxDyvZacYrdISwh0xX9bzffA5L5a0D CRpCoFFYQa/sHsN9SKgyBupJSHA0nVwVxDkBRhXMpsQHz8M1/R3OCm5DQXAKkTBiWgXQ ba5TNTywwgNOhwDKqsMDcmcm9EX5tgk0Mvtsk5mWPyvFI2Ys/78eCGYNbP4l1YqaUv7B +HeA== X-Gm-Message-State: APjAAAUhm0c/CHK1G+MrWwR5cIFlXeR7mq16VcCW32eY9AfaFpPtaFY0 Uty5Rdskg4qpnlY2ARMxEQBnCRm9Szo= X-Google-Smtp-Source: APXvYqylgDzat1aTWfPURpq1TAxyAB//gIe/bX5C8SMvFKgKKhj+cD5nIJNlUlZK9G+CG0LntBX3hw== X-Received: by 2002:adf:e40f:: with SMTP id g15mr22481803wrm.223.1576367112010; Sat, 14 Dec 2019 15:45:12 -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 b17sm15749388wrp.49.2019.12.14.15.45.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Dec 2019 15:45:11 -0800 (PST) From: anothersms@gmail.com (=?utf-8?Q?Nicol=C3=B2?= Balzarotti) Date: Sun, 15 Dec 2019 00:45:09 +0100 Message-ID: <87a77ueaka.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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+nicolo=nixo.xyz@gnu.org Sender: "Guix-patches" X-Rspamd-Queue-Id: B213C6EEBAE X-Spamd-Result: default: False [-0.31 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FORGED_SENDER_MAILLIST(0.00)[]; R_SPF_DNSFAIL(0.00)[(SPF): spf DNS fail]; FREEMAIL_FROM(0.00)[gmail.com]; HAS_ATTACHMENT(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; TO_DN_NONE(0.00)[]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_TWELVE(0.00)[13]; FROM_NO_DN(0.00)[]; MAILLIST(-0.20)[mailman]; FORGED_SENDER(0.00)[anothersms@gmail.com,guix-patches-bounces@gnu.org]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; FORGED_RECIPIENTS(0.00)[38616@debbugs.gnu.org,nicolo@nixo.xyz]; TAGGED_FROM(0.00)[nicolo=nixo.xyz]; FROM_NEQ_ENVFROM(0.00)[anothersms@gmail.com,guix-patches-bounces@gnu.org] X-Rspamd-Server: nixo.xyz X-TUID: fs6h6jl6o9Js MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="====-=-=" --====-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=C3=B2 --====-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-gnu-packages-emascs.scm-emacs-patches-Fix-odt-export.patch >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 --====-=-=-- --=-=-=--