From 2a0740b95af87167c2954d7106dc0dc4143a31ca Mon Sep 17 00:00:00 2001 From: Benjamin Riefenstahl Date: Mon, 4 Jul 2022 12:57:34 +0200 Subject: [PATCH] lisp/thumbs.el: Fix calling the "convert" command * lisp/thumbs.el (thumbs-call-convert): Pass 'action-prefix' and 'action' as a combined parameter. Do not pass 'arg' if it is nil. (thumbs-modify-image): Do not pass "" as 'arg' to 'thumbs-call-convert' (bug#56375). Some time in the past this was converted from using the shell to passing the parameters directly, but the fallout was not handled correctly. --- lisp/thumbs.el | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lisp/thumbs.el b/lisp/thumbs.el index 3bf08dd6a58..e622bcedc4e 100644 --- a/lisp/thumbs.el +++ b/lisp/thumbs.el @@ -215,16 +215,17 @@ FILEIN is the input file, FILEOUT is the output file, ACTION is the command to send to convert. Optional arguments are: -ARG any arguments to the ACTION command, +ARG if non-nil, the argument of the ACTION command, OUTPUT-FORMAT is the file format to output (default is jpeg), ACTION-PREFIX is the symbol to place before the ACTION command (defaults to `-' but can sometimes be `+')." - (call-process thumbs-conversion-program nil nil nil - (or action-prefix "-") - action - (or arg "") - filein - (format "%s:%s" (or output-format "jpeg") fileout))) + (let ((action-param (concat (or action-prefix "-") action)) + (fileout-param (format "%s:%s" (or output-format "jpeg") fileout))) + (if arg + (call-process thumbs-conversion-program nil nil nil + action-param arg filein fileout-param) + (call-process thumbs-conversion-program nil nil nil + action-param filein fileout-param)))) (defun thumbs-new-image-size (s increment) "New image (a cons of width x height)." @@ -610,7 +611,7 @@ ACTION and ARG should be a valid convert command." (thumbs-call-convert (or old thumbs-current-image-filename) tmp action - (or arg "")) + arg) (save-excursion (thumbs-insert-image tmp 'jpeg 0)) (setq thumbs-current-tmp-filename tmp))) -- 2.39.2