Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test suite only works with macOS base64 #7

Open
sternenseemann opened this issue Jan 23, 2022 · 1 comment
Open

Test suite only works with macOS base64 #7

sternenseemann opened this issue Jan 23, 2022 · 1 comment

Comments

@sternenseemann
Copy link
Contributor

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.

@chaitanyagupta
Copy link
Owner

Thanks for bringing this to my notice. Will keep this issue open until we can figure out a good fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants