Subject: Re: bug#56375: 28.1.50; Calling "convert" from thumbs.el is broken

From: Benjamin Riefenstahl <[email-masked]>
Date: Mon, 04 Jul 2022 02:04:44 +0200

>From 7418e68266b9d593219c6a84be5d519844855f3a Mon Sep 17 00:00:00 2001
From: Benjamin Riefenstahl <[email-masked]>
Date: Sun, 3 Jul 2022 15:52:13 -0700
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)
---
 lisp/thumbs.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lisp/thumbs.el b/lisp/thumbs.el
index 3bf08dd6a5..e622bcedc4 100644
--- a/lisp/thumbs.el
+++ b/lisp/thumbs.el
@@ -215,16 +215,17 @@ thumbs-call-convert
 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 @@ thumbs-modify-image
     (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.30.2