emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [PATCH] ob-maxima.el: Fix execution on MS Windows


From: Nikolay Kudryavtsev
Subject: Re: [PATCH] ob-maxima.el: Fix execution on MS Windows
Date: Thu, 30 Dec 2021 23:54:10 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1

When some external data is substituted into a Maxima command (batchload this case) there should be an extra pass of escaping that protects special characters like quotes (and backslashes?) accordingly to Maxima rules.
Not necessarily, Maxima is capable of understanding unescaped paths, for example, this works:

maxima --very-quiet -r "batchload(\"/tmp/sp ce/babel-gxqTkM/maxima-ua3e9j.max\")"$

I suspect that quotes your added around %S must not be used there. Due to them file name appears outside of quotes at all.
Yes, good catch.

Unsure concerning Maxima but usually it is possible to pass arguments avoiding quoting issues for particular language.
Command line Maxima actually has a batch flag, but using it returns the entire input file in the output too and that seems to be the reason why the original authors of ob-maxima didn't use it. It's probably possible to filter that on our side, but such filtering would require extra work, which they probably deemed unnecessary, for such a rather obscure set of use cases.

Anyway, I've tried to get it to work using shell-quote-argument, see the attached patch. Seems to work well enough in practice on both platforms and for cases like (setq temporary-file-directory "/tmp/`echo hi`/").

Attachment: 0001-ob-maxima.el-Fix-execution-on-MS-Windows.patch
Description: Text document


reply via email to

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