Hi,

I noticed that qs doesn't escape pipe characters. I suggest the patch
below, which not only makes it so that pipes get escaped, but it also
switches away from the blacklist approach, which invariably doesn't
work ;-)

Regards, Florian

---------------------------------------------------------------------------
diff --git a/utils.scm b/utils.scm
index 58469d7..b41c90b 100644
--- a/utils.scm
+++ b/utils.scm
@@ -63,16 +63,16 @@
     ((mingw32)
      (string-append "\"" str "\""))
     (else
-     (if (zero? (string-length str))
-        "''"
+     (string-append
+        "'"
         (string-concatenate
          (map (lambda (c)
-                (if (or (char-whitespace? c)
-                        (memq c '(#\# #\" #\' #\` #\ยด #\~ #\& #\% #\$ #\! #\* 
#\;
-                                  #\< #\> #\\ #\( #\) #\[ #\] #\{ #\} #\?)))
-                    (string #\\ c)
-                    (string c)))
-              (string->list str)))))))
+                (case c
+                    ((#\') "'\\''")
+                    ((#\nul) (error 'qs "NUL character can not be represented 
in shell string" str))
+                    (else (string c))))
+              (string->list str)))
+        "'"))))
 
 
 ;;; Compile and load file

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to