qbase64
qbase64 copied to clipboard
Test suite only works with macOS base64
Sadly, there doesn't seem to be a portable way to specify the line length for the base64(1)
tool (since it is not part of the POSIX standard as far as I can tell). GNU coreutils and macOS base64 sadly have different command line interfaces, i. e. the following patch makes the test suite work with GNU coreutils:
diff --git a/qbase64-test.lisp b/qbase64-test.lisp
index 310fdf3..b92abb5 100644
--- a/qbase64-test.lisp
+++ b/qbase64-test.lisp
@@ -14,7 +14,7 @@
(with-open-temporary-file (tmp :direction :output :element-type '(unsigned-byte 8))
(write-sequence bytes tmp)
(force-output tmp)
- (let* ((encoded (uiop:run-program `("base64" "-b" ,(format nil "~A" linebreak) "-i" ,(namestring tmp)) :output (if (zerop linebreak) '(:string :stripped t) :string)))
+ (let* ((encoded (uiop:run-program `("base64" "-w" ,(format nil "~A" linebreak) ,(namestring tmp)) :output (if (zerop linebreak) '(:string :stripped t) :string) :error-output *error-output*))
(length (length encoded)))
(cond ((and (> length 1)
(string= (subseq encoded (- length 2))
Not really sure how to best fix this, doesn't seem like there is a single solution that would work everywhere.
Thanks for bringing this to my notice. Will keep this issue open until we can figure out a good fix for this.