emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] LaTeX preview should use a subdirectory in /tmp


From: Ihor Radchenko
Subject: Re: [BUG] LaTeX preview should use a subdirectory in /tmp
Date: Mon, 25 Mar 2024 11:40:31 +0000

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.

>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

-- 
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 via email to

[Prev in Thread] Current Thread [Next in Thread]