Org-mode mailing list
 help / color / mirror / Atom feed
* Bug: ODT exporter permission issue on functional distros (eg, Guix) [9.1.9 (release_9.1.9-65-g5e4542 @ /home/cwebber/.guix-profile/share/emacs/26.3/lisp/org/)]
@ 2020-10-11 17:15 Christopher Lemmer Webber
  2020-10-13  4:18 ` Kyle Meyer
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Lemmer Webber @ 2020-10-11 17:15 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 707 bytes --]

Emacs  : GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /home/cwebber/.guix-profile/share/emacs/26.3/lisp/org/)

Not sure if this will work on Windows because it uses posix'y
permissions.... but anyway I found that the ODT exporter did not work on
Guix because the styles.xml got copied over as read-only.  This fixes it
for me.

I've already done copyright assignment for the "AM/PM support on the
agenda timegrid" patch I sent in 2010; I assume this has not expired
over the last decade.  If you check the use-by date and my copyright
assignment has somehow gone moldy let me know and I'll be happy to
update it.

 - Chris


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-odt-Fix-read-only-error-with-styles.xml.patch --]
[-- Type: text/x-patch, Size: 1541 bytes --]

From df53e6282e7113b2601490266315f5018d7f2d6b Mon Sep 17 00:00:00 2001
From: Christopher Lemmer Webber <cwebber@dustycloud.org>
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug: ODT exporter permission issue on functional distros (eg, Guix) [9.1.9 (release_9.1.9-65-g5e4542 @ /home/cwebber/.guix-profile/share/emacs/26.3/lisp/org/)]
  2020-10-11 17:15 Bug: ODT exporter permission issue on functional distros (eg, Guix) [9.1.9 (release_9.1.9-65-g5e4542 @ /home/cwebber/.guix-profile/share/emacs/26.3/lisp/org/)] Christopher Lemmer Webber
@ 2020-10-13  4:18 ` Kyle Meyer
  0 siblings, 0 replies; 2+ messages in thread
From: Kyle Meyer @ 2020-10-13  4:18 UTC (permalink / raw)
  To: Christopher Lemmer Webber; +Cc: emacs-orgmode

Christopher Lemmer Webber writes:

> Emacs  : GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
> Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /home/cwebber/.guix-profile/share/emacs/26.3/lisp/org/)
[...]
> 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.

Thanks for the patch.  I believe the issue should already be fixed by
6315e1e76 (ox-odt: Get write permissions on styles.xml, 2019-12-20),
which was a part of the 9.3.1 release.  It makes the same set-file-modes
call as your patch, but a bit downstream of the spot you chose.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-13  4:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-11 17:15 Bug: ODT exporter permission issue on functional distros (eg, Guix) [9.1.9 (release_9.1.9-65-g5e4542 @ /home/cwebber/.guix-profile/share/emacs/26.3/lisp/org/)] Christopher Lemmer Webber
2020-10-13  4:18 ` Kyle Meyer

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git