emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] LaTeX preview should use a subdirectory in /tmp
Date: Mon, 25 Mar 2024 11:40:31 +0000	[thread overview]
Message-ID: <87r0fyo7yo.fsf@localhost> (raw)
In-Reply-To: <utrkah$4s0$1@ciao.gmane.io>

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

Max Nikulin <manikulin@gmail.com> writes:

> This feature should not write temporary files to /tmp directly, some 
> subdirectory should be created for this purpose. The idea is to mitigate 
> consequences if a user opens a file from a compromised or a malicious 
> source and gets /tmp flooded with a crowd of files. It is easier to 
> delete single directory than to spent time trying to figure out what 
> files are necessary for other applications and what ones are generated 
> by LaTeX code.

See the attached tentative patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-create-formula-image-Keep-temporary-LaTeX-files-.patch --]
[-- Type: text/x-patch, Size: 1206 bytes --]

From df4d827d98063ee665d71906f358ca08ad4d0023 Mon Sep 17 00:00:00 2001
Message-ID: <df4d827d98063ee665d71906f358ca08ad4d0023.1711366791.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Mon, 25 Mar 2024 14:38:42 +0300
Subject: [PATCH] org-create-formula-image: Keep temporary LaTeX files in
 subfir of /tmp

* lisp/org.el (org-create-formula-image): When compiling formula
images, keep temporary LaTeX logs in a subdirectory of
`temporary-file-directory' instead of littering the top-level /tmp.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/utrkah$4s0$1@ciao.gmane.io
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index f0f85822f..0793b72d6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16361,7 +16361,7 @@ (defun org-create-formula-image
 	       org-format-latex-header
 	       'snippet)))
 	 (latex-compiler (plist-get processing-info :latex-compiler))
-	 (tmpdir temporary-file-directory)
+	 (tmpdir (concat temporary-file-directory "orgtex/"))
 	 (texfilebase (make-temp-name
 		       (expand-file-name "orgtex" tmpdir)))
 	 (texfile (concat texfilebase ".tex"))
-- 
2.44.0


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

  reply	other threads:[~2024-03-25 11:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 10:40 [BUG] LaTeX preview should use a subdirectory in /tmp Max Nikulin
2024-03-25 11:40 ` Ihor Radchenko [this message]
2024-03-25 12:49   ` Max Nikulin
2024-03-26 11:29     ` Max Nikulin
  -- strict thread matches above, loose matches on Subject: below --
2024-04-17 15:12 copropriete27ruemoret
2024-04-17 15:21 Emmanuel Charpentier
2024-04-17 16:48 ` Ihor Radchenko
2024-04-17 20:04   ` Emmanuel Charpentier
2024-04-17 20:18     ` Ihor Radchenko
2024-04-17 20:41       ` Emmanuel Charpentier
2024-04-18 12:23         ` Emmanuel Charpentier
2024-04-19 11:56         ` Ihor Radchenko
2024-04-19 15:00           ` emm.charpentier
2024-04-20 12:49             ` Max Nikulin
2024-05-02 10:30     ` Ihor Radchenko
2024-07-03 11:23       ` Ihor Radchenko

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=87r0fyo7yo.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    /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).