emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: [BUG] LaTeX preview should use a subdirectory in /tmp
@ 2024-04-17 15:21 Emmanuel Charpentier
  2024-04-17 16:48 ` Ihor Radchenko
  0 siblings, 1 reply; 16+ messages in thread
From: Emmanuel Charpentier @ 2024-04-17 15:21 UTC (permalink / raw)
  To: manikulin, emacs-orgmode

On 25/03/2024 19:49, Max Nikulin wrote:

> > (defun org-ensure-tmp-dir (dir-symbol prefix)
> >    (let ((dir (symbol-value dir-symbol)))
> >      ;; Temporary directory has not been cleaned.
> >      (or (and dir (file-directory-p dir) dir)
>
>
>`if' should be used instead of `or' here.
>
>
>
>>
>>     (setf (symbol-value dir-symbol)
>>           (make-temp-file (or prefix "orgtmp-") 'dir)))))
>> 
>> (defvar org-tex-tmpdir nil)
>> 
>> Usage example: (org-ensure-tmp-dir 'org-tex-tmpdir "orgtex-")

> I do not like that the function may be called with
different `temporary-file-directory' and I can not figure out how to
adjust API to handle such case. On the other hand I am unsure if it is
a realistic case when this function is called with
alternating `temporary-file-directory'.  

I have a case where the current way of forcing the temporary directory
to me `/tmp` is wrong. Running emacs on Ubuntu **under WSL2**,,
exporting latex snippets to ODT *as images* fails : the `.dvi` files
are correctly compiled and placed in `/tmp{, but the convert program
tries to read them in `../../../../tmp/`, which is indeed `/tmp` in a
"normal" filesystem but **is not** in WSL, where the root (`/`) is in
fact a mounted tree.

Admittedly, this is a corner case, but it turned out to be necessary
(exporting via mathml gave unsatisfying results).




^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [BUG] LaTeX preview should use a subdirectory in /tmp
@ 2024-04-17 15:12 copropriete27ruemoret
  0 siblings, 0 replies; 16+ messages in thread
From: copropriete27ruemoret @ 2024-04-17 15:12 UTC (permalink / raw)
  To: manikulin, emacs-orgmode

On 25/03/2024 19:49, Max Nikulin wrote:

> > (defun org-ensure-tmp-dir (dir-symbol prefix)
> >    (let ((dir (symbol-value dir-symbol)))
> >      ;; Temporary directory has not been cleaned.
> >      (or (and dir (file-directory-p dir) dir)
>
>
>`if' should be used instead of `or' here.
>
>
>
>>
>>     (setf (symbol-value dir-symbol)
>>           (make-temp-file (or prefix "orgtmp-") 'dir)))))
>> 
>> (defvar org-tex-tmpdir nil)
>> 
>> Usage example: (org-ensure-tmp-dir 'org-tex-tmpdir "orgtex-")

> I do not like that the function may be called with different `temporary-file-directory' and I can not figure out how to adjust API to handle such case. On the other hand I am unsure if it is a realistic case when this function is called with alternating `temporary-file-directory'.  

I have a case where the current way of forcing the temporary directory to me `/tmp` is wrong. Running emacs on Ubuntu **under WSL2**,, exporting latex snippets to ODT *as images* fails : the `.dvi` files are correctly compiled and placed in `/tmp{, but the convert program tries to read them in `../../../../tmp/`, which is indeed `/tmp` in a "normal" filesystem but **is not** in WSL, where the root (`/`) is in fact a mounted tree.

Admittedly, this is a corner case, but it turned out to be necessary (exporting via mathml gave unsatisfying results).


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [BUG] LaTeX preview should use a subdirectory in /tmp
@ 2024-03-25 10:40 Max Nikulin
  2024-03-25 11:40 ` Ihor Radchenko
  0 siblings, 1 reply; 16+ messages in thread
From: Max Nikulin @ 2024-03-25 10:40 UTC (permalink / raw)
  To: emacs-orgmode

This is a follow-up to recent changes related to LaTeX preview.

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.

P.S. I do not mind double level structure: all temporary Org mode files 
(babel, etc.) are created in single (per Emacs process) directory in tmp 
and each task creates its own subdirectory there.



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

end of thread, other threads:[~2024-07-03 11:22 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-17 15:21 [BUG] LaTeX preview should use a subdirectory in /tmp 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
  -- strict thread matches above, loose matches on Subject: below --
2024-04-17 15:12 copropriete27ruemoret
2024-03-25 10:40 Max Nikulin
2024-03-25 11:40 ` Ihor Radchenko
2024-03-25 12:49   ` Max Nikulin
2024-03-26 11:29     ` Max Nikulin

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).