Skip to content

Test suite only works with macOS base64 #7

Open
@sternenseemann

Description

@sternenseemann

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions