homebrew `base64` vs `/usr/bin/base64`
Closed this issue · 5 comments
I found that the homebrew version of base64
does not seem to work the same way as the mac delivered /usr/bin/bas64
version:
➜ b1 git:(main) ✗ /opt/homebrew/bin/base64 --help
base64 -- Encode/decode file as base64. Call:
base64 [-e / -d] [options] [infile] [outfile]
Options:
--copyright Print copyright information
-d, --decode Decode base64 encoded file
-e, --encode Encode file into base64
-n, --noerrcheck Ignore errors when decoding
-u, --help Print this message
--version Print version number
by John Walker
http://www.fourmilab.ch/
➜ b1 git:(main) ✗ /usr/bin/base64 -h
Usage: base64 [-hDd] [-b num] [-i in_file] [-o out_file]
-h, --help display this message
-Dd, --decode decodes input
-b, --break break encoded string into num character lines
-i, --input input file (default: "-" for stdin)
-o, --output output file (default: "-" for stdout)
The homebrew version creates a file with line endings whereas the mac version does not:
➜ f1 git:(main) ✗ /opt/homebrew/bin/base64 test-data/to2c1-i.txt homebrew
➜ f1 git:(main) ✗ /usr/bin/base64 -i test-data/to2c1-i.txt -o mac
Getting a line count, shows that the homebrew version has a line count of 109 and the mac version a count of 1:
➜ f1 git:(main) ✗ wc -l homebrew mac
109 homebrew
1 mac
110 total
The shell doesn't work great with putting the homebrew version in variable (it gets chopped at the Ctrl-M character).
Workaround
Simplest workaround is to brew uninstall base64
and use the system provided base64.
Uninstalling the homebrew-installed base64 might break other homebrew software that depends on it.
I have a homebrew-installed base64, but I didn't install it manually. It must have been installed by some other homebrew packages I installed, and those packages probably depend on it, so they could break if I uninstall homebrew's base64.
Could The Power hardcode the path to the base64 it wants to use?
I want to revisit the base64
compatibility issue because Keep it portable is a principal of The Power. If base64
command isn't portable as like grep, sed, awk, we'd better avoid using base64
command.
There are (at least) three variants of base64
command available on macOS.
- Builtin
/usr/bin/base64
- Homebrew version by John Walker - can install by
brew install base64
- GNU version - can install by
brew install coreutils
Typically, Homebrew version will be installed to /usr/local/bin/base64
. GNU version has a prefix g
as like other coreutils commands, so it will be installed to /usr/local/bin/gbase64
. Users can install GNU version without prefix by adding options to brew install coreutils
. In this case, GNU version would be installed to /usr/local/bin/base64
.
These three variants behave differently.
Builtin /usr/bin/base64
❯ /usr/bin/base64 --help
Usage: base64 [-Ddh] [-b num] [-i in_file] [-o out_file]
-b, --break break encoded string into num character lines
-Dd, --decode decodes input
-h, --help display this message
-i, --input input file (default: "-" for stdin)
-o, --output output file (default: "-" for stdout)
It doesn't take a file as an argument. You need to specify input file with -i/--input
option. Otherwise the command fails.
❯ /usr/bin/base64 dotnet.csproj_
base64: invalid argument dotnet.csproj_
It generates a base64 encoded string as a single line, which is good.
❯ /usr/bin/base64 -i dotnet.csproj_
PFByb2plY3QgU2RrPSJNaWNyb3NvZnQuTkVULlNkay5XZWIiPgogIDxQcm9wZXJ0eUdyb3VwPgogICAgPFRhcmdldEZyYW1ld29yaz5uZXRjb3JlYXBwMy4wPC9UYXJnZXRGcmFtZXdvcms+CiAgPC9Qcm9wZXJ0eUdyb3VwPgogIDxJdGVtR3JvdXA+CiAgICA8UGFja2FnZVJlZmVyZW5jZSBJbmNsdWRlPSJFbGVjdHJvbk5FVC5BUEkiIFZlcnNpb249IjUuMzAuMSIgLz4KICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1hcnZpbi5TdHJlYW1FeHRlbnNpb25zIiBWZXJzaW9uPSIxLjEuMCIgLz4KICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1pY3Jvc29mdC5Bc3BOZXRDb3JlLkFwcCIgLz4KICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1pY3Jvc29mdC5WaXN1YWxTdHVkaW8uV2ViLkNvZGVHZW5lcmF0aW9uLkRlc2lnbiIgVmVyc2lvbj0iMy4xLjAiIC8+CiAgICA8UGFja2FnZVJlZmVyZW5jZSBJbmNsdWRlPSJOZXd0b25zb2Z0Lkpzb24iIFZlcnNpb249IjEyLjAuMyIgLz4KICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1pY3Jvc29mdC5Bc3BOZXRDb3JlLk12Yy5OZXd0b25zb2Z0SnNvbiIgVmVyc2lvbj0iMy4wLjAiIC8+CiAgICA8UGFja2FnZVJlZmVyZW5jZSBJbmNsdWRlPSJTeXN0ZW0uSU8uUGlwZWxpbmVzIiBWZXJzaW9uPSI0LjUuMCIgLz4KICA8L0l0ZW1Hcm91cD4KICA8SXRlbUdyb3VwPjwvSXRlbUdyb3VwPgogIDxJdGVtR3JvdXA+CiAgICA8Q29udGVudCBVcGRhdGU9ImVsZWN0cm9uLm1hbmlmZXN0Lmpzb24iPgogICAgICA8Q29weVRvT3V0cHV0RGlyZWN0b3J5PlByZXNlcnZlTmV3ZXN0PC9Db3B5VG9PdXRwdXREaXJlY3Rvcnk+CiAgICA8L0NvbnRlbnQ+CiAgPC9JdGVtR3JvdXA+CjwvUHJvamVjdD4K
Some scripts don't work with /usr/bin/base64
. To demonstrate it, I hard code /usr/bin/base64
in create-commit-csproj.sh
and run it.
❯ git diff create-commit-csproj.sh
1 diff --git a/create-commit-csproj.sh b/create-commit-csproj.sh
2 index 3a4c27f..23b52d0 100755
3 --- a/create-commit-csproj.sh
4 +++ b/create-commit-csproj.sh
5 @@ -10,7 +10,7 @@ if [ -z "$1" ]
6 repo=$1
7 fi
8
9 -base64_string=$(base64 dotnet.csproj_)
10 +base64_string=$(/usr/bin/base64 dotnet.csproj_)
11 content=${base64_string}
12 filename_in_repo=dotnet.csproj
13 comment=".net project file like a pom.xml or requirements.txt. Used to trigger dependabot."
❯ bash create-commit-csproj.sh
base64: invalid argument dotnet.csproj_
Usage: base64 [-Ddh] [-b num] [-i in_file] [-o out_file]
-b, --break break encoded string into num character lines
-Dd, --decode decodes input
-h, --help display this message
-i, --input input file (default: "-" for stdin)
-o, --output output file (default: "-" for stdout)
{
"content": {
"name": "dotnet.csproj",
"path": "dotnet.csproj",
"sha": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
"size": 0,
(snip)
It creates an empty commit, that isn't what we expect.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ImVsZWN0cm9uLm1hbmlmZXN0Lmpzb24iPgogICAgICA8Q29weVRvT3V0cHV0RGlyZWN0b3J5PlByZXNlcnZlTmV3ZXN0PC9Db3B5VG9PdXRwdXREaXJlY3Rvcnk+CiAgICA8L0NvbnRlbnQ+CiAgPC9JdGVtR3JvdXA+CjwvUHJvamVjdD4K
Homebrew version
https://www.fourmilab.ch/webtools/base64/ is the homepage.
❯ /usr/local/bin/base64 --help
base64 -- Encode/decode file as base64. Call:
base64 [-e / -d] [options] [infile] [outfile]
Options:
--copyright Print copyright information
-d, --decode Decode base64 encoded file
-e, --encode Encode file into base64
-n, --noerrcheck Ignore errors when decoding
-u, --help Print this message
--version Print version number
by John Walker
http://www.fourmilab.ch/
It takes input file as an argument which is good for The Power, but it generates a base64 encoded string with newlines.
❯ /usr/local/bin/base64 dotnet.csproj_
PFByb2plY3QgU2RrPSJNaWNyb3NvZnQuTkVULlNkay5XZWIiPgogIDxQcm9wZXJ0eUdyb3Vw
PgogICAgPFRhcmdldEZyYW1ld29yaz5uZXRjb3JlYXBwMy4wPC9UYXJnZXRGcmFtZXdvcms+
CiAgPC9Qcm9wZXJ0eUdyb3VwPgogIDxJdGVtR3JvdXA+CiAgICA8UGFja2FnZVJlZmVyZW5j
ZSBJbmNsdWRlPSJFbGVjdHJvbk5FVC5BUEkiIFZlcnNpb249IjUuMzAuMSIgLz4KICAgIDxQ
YWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1hcnZpbi5TdHJlYW1FeHRlbnNpb25zIiBWZXJz
aW9uPSIxLjEuMCIgLz4KICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1pY3Jvc29m
dC5Bc3BOZXRDb3JlLkFwcCIgLz4KICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1p
Y3Jvc29mdC5WaXN1YWxTdHVkaW8uV2ViLkNvZGVHZW5lcmF0aW9uLkRlc2lnbiIgVmVyc2lv
bj0iMy4xLjAiIC8+CiAgICA8UGFja2FnZVJlZmVyZW5jZSBJbmNsdWRlPSJOZXd0b25zb2Z0
Lkpzb24iIFZlcnNpb249IjEyLjAuMyIgLz4KICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1
ZGU9Ik1pY3Jvc29mdC5Bc3BOZXRDb3JlLk12Yy5OZXd0b25zb2Z0SnNvbiIgVmVyc2lvbj0i
My4wLjAiIC8+CiAgICA8UGFja2FnZVJlZmVyZW5jZSBJbmNsdWRlPSJTeXN0ZW0uSU8uUGlw
ZWxpbmVzIiBWZXJzaW9uPSI0LjUuMCIgLz4KICA8L0l0ZW1Hcm91cD4KICA8SXRlbUdyb3Vw
PjwvSXRlbUdyb3VwPgogIDxJdGVtR3JvdXA+CiAgICA8Q29udGVudCBVcGRhdGU9ImVsZWN0
cm9uLm1hbmlmZXN0Lmpzb24iPgogICAgICA8Q29weVRvT3V0cHV0RGlyZWN0b3J5PlByZXNl
cnZlTmV3ZXN0PC9Db3B5VG9PdXRwdXREaXJlY3Rvcnk+CiAgICA8L0NvbnRlbnQ+CiAgPC9J
dGVtR3JvdXA+CjwvUHJvamVjdD4K
Create or update file contents API endpoint isn't happy with multiline base64 encoded strings and it rejects requests because the contents is not valid Base64.
❯ bash create-commit-csproj.sh
{
"message": "content is not valid Base64",
"documentation_url": "https://docs.github.com/rest/repos/contents#create-or-update-file-contents"
}
As far as I know, Homebrew version base64
command doesn't have an option to generate a single line output. We can use tr
to make it into a single line though.
❯ /usr/local/bin/base64 dotnet.csproj_ | tr -d '\r\n'
PFByb2plY3QgU2RrPSJNaWNyb3NvZnQuTkVULlNkay5XZWIiPgogIDxQcm9wZXJ0eUdyb3VwPgogICAgPFRhcmdldEZyYW1ld29yaz5uZXRjb3JlYXBwMy4wPC9UYXJnZXRGcmFtZXdvcms+CiAgPC9Qcm9wZXJ0eUdyb3VwPgogIDxJdGVtR3JvdXA+CiAgICA8UGFja2FnZVJlZmVyZW5jZSBJbmNsdWRlPSJFbGVjdHJvbk5FVC5BUEkiIFZlcnNpb249IjUuMzAuMSIgLz4KICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1hcnZpbi5TdHJlYW1FeHRlbnNpb25zIiBWZXJzaW9uPSIxLjEuMCIgLz4KICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1pY3Jvc29mdC5Bc3BOZXRDb3JlLkFwcCIgLz4KICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1pY3Jvc29mdC5WaXN1YWxTdHVkaW8uV2ViLkNvZGVHZW5lcmF0aW9uLkRlc2lnbiIgVmVyc2lvbj0iMy4xLjAiIC8+CiAgICA8UGFja2FnZVJlZmVyZW5jZSBJbmNsdWRlPSJOZXd0b25zb2Z0Lkpzb24iIFZlcnNpb249IjEyLjAuMyIgLz4KICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1pY3Jvc29mdC5Bc3BOZXRDb3JlLk12Yy5OZXd0b25zb2Z0SnNvbiIgVmVyc2lvbj0iMy4wLjAiIC8+CiAgICA8UGFja2FnZVJlZmVyZW5jZSBJbmNsdWRlPSJTeXN0ZW0uSU8uUGlwZWxpbmVzIiBWZXJzaW9uPSI0LjUuMCIgLz4KICA8L0l0ZW1Hcm91cD4KICA8SXRlbUdyb3VwPjwvSXRlbUdyb3VwPgogIDxJdGVtR3JvdXA+CiAgICA8Q29udGVudCBVcGRhdGU9ImVsZWN0cm9uLm1hbmlmZXN0Lmpzb24iPgogICAgICA8Q29weVRvT3V0cHV0RGlyZWN0b3J5PlByZXNlcnZlTmV3ZXN0PC9Db3B5VG9PdXRwdXREaXJlY3Rvcnk+CiAgICA8L0NvbnRlbnQ+CiAgPC9JdGVtR3JvdXA+CjwvUHJvamVjdD4K
We can eventually get the one line base64 encoded string same to /usr/bin/base64
's, but it isn't convenient.
❯ /usr/local/bin/base64 dotnet.csproj_ | tr -d '\r\n' | sha256sum
10cfd075b63d12de9d5cfb722881f5027b79818d8f1527975223127e11815c97 -
❯ /usr/bin/base64 -i dotnet.csproj_ | tr -d '\r\n' | sha256sum
10cfd075b63d12de9d5cfb722881f5027b79818d8f1527975223127e11815c97 -
Bonus point: tr
command has platform compatibility issue as there are (at least) two variants: GNU or BSD, as like other many utilities. Relying on tr
would cause another compatibility problem.
GNU version
❯ /usr/local/bin/gbase64 --help
Usage: /usr/local/bin/gbase64 [OPTION]... [FILE]
Base64 encode or decode FILE, or standard input, to standard output.
With no FILE, or when FILE is -, read standard input.
Mandatory arguments to long options are mandatory for short options too.
-d, --decode decode data
-i, --ignore-garbage when decoding, ignore non-alphabet characters
-w, --wrap=COLS wrap encoded lines after COLS character (default 76).
Use 0 to disable line wrapping
--help display this help and exit
--version output version information and exit
The data are encoded as described for the base64 alphabet in RFC 4648.
When decoding, the input may contain newlines in addition to the bytes of
the formal base64 alphabet. Use --ignore-garbage to attempt to recover
from any other non-alphabet bytes in the encoded stream.
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>
Full documentation <https://www.gnu.org/software/coreutils/base64>
or available locally via: info '(coreutils) base64 invocation'
GNU base64
behaves similar to Homebrew version, though output with no options looks different.
❯ /usr/local/bin/gbase64 dotnet.csproj_
PFByb2plY3QgU2RrPSJNaWNyb3NvZnQuTkVULlNkay5XZWIiPgogIDxQcm9wZXJ0eUdyb3VwPgog
ICAgPFRhcmdldEZyYW1ld29yaz5uZXRjb3JlYXBwMy4wPC9UYXJnZXRGcmFtZXdvcms+CiAgPC9Q
cm9wZXJ0eUdyb3VwPgogIDxJdGVtR3JvdXA+CiAgICA8UGFja2FnZVJlZmVyZW5jZSBJbmNsdWRl
PSJFbGVjdHJvbk5FVC5BUEkiIFZlcnNpb249IjUuMzAuMSIgLz4KICAgIDxQYWNrYWdlUmVmZXJl
bmNlIEluY2x1ZGU9Ik1hcnZpbi5TdHJlYW1FeHRlbnNpb25zIiBWZXJzaW9uPSIxLjEuMCIgLz4K
ICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1pY3Jvc29mdC5Bc3BOZXRDb3JlLkFwcCIg
Lz4KICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1pY3Jvc29mdC5WaXN1YWxTdHVkaW8u
V2ViLkNvZGVHZW5lcmF0aW9uLkRlc2lnbiIgVmVyc2lvbj0iMy4xLjAiIC8+CiAgICA8UGFja2Fn
ZVJlZmVyZW5jZSBJbmNsdWRlPSJOZXd0b25zb2Z0Lkpzb24iIFZlcnNpb249IjEyLjAuMyIgLz4K
ICAgIDxQYWNrYWdlUmVmZXJlbmNlIEluY2x1ZGU9Ik1pY3Jvc29mdC5Bc3BOZXRDb3JlLk12Yy5O
ZXd0b25zb2Z0SnNvbiIgVmVyc2lvbj0iMy4wLjAiIC8+CiAgICA8UGFja2FnZVJlZmVyZW5jZSBJ
bmNsdWRlPSJTeXN0ZW0uSU8uUGlwZWxpbmVzIiBWZXJzaW9uPSI0LjUuMCIgLz4KICA8L0l0ZW1H
cm91cD4KICA8SXRlbUdyb3VwPjwvSXRlbUdyb3VwPgogIDxJdGVtR3JvdXA+CiAgICA8Q29udGVu
dCBVcGRhdGU9ImVsZWN0cm9uLm1hbmlmZXN0Lmpzb24iPgogICAgICA8Q29weVRvT3V0cHV0RGly
ZWN0b3J5PlByZXNlcnZlTmV3ZXN0PC9Db3B5VG9PdXRwdXREaXJlY3Rvcnk+CiAgICA8L0NvbnRl
bnQ+CiAgPC9JdGVtR3JvdXA+CjwvUHJvamVjdD4K
That is because GNU base64
wraps encoded lines after 76 characters by default. It accepts number of characters with -w/--wraps
option. -w 0
generates single base64 encoded line.
❯ /usr/local/bin/gbase64 -w 0 dotnet.csproj_
PFByb2plY3QgU2RrPSJNaWNyb3NvZnQuTkVULlNkay5XZWIiPgogIDxQcm9wZXJ0eUdyb3VwPgogICAgPFRhcmdldEZyYW1ld29yaz5uZXRjb3JlYXBwMy4wPC9UYXJnZXRGcm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dD4K
❯ /usr/local/bin/gbase64 -w 0 dotnet.csproj_ | sha256sum
10cfd075b63d12de9d5cfb722881f5027b79818d8f1527975223127e11815c97 -
GNU version is the most powerful and flexible one, but it won't get installed as /usr/local/bin/base64
without giving specific command line options to brew install coreutils
, that we can't expect all users do. We of course shouldn't hard code /usr/local/bin/gbase64
unless we make a decision that The Power depends on GNU base64.
Conclusion
No base64
commands are perfect match to the usage in The Power scripts.
To make it platform portable, why not writing alternative base64
utility with platform agnostic technology such as Ruby or Python?
I'm going to open opened a pull request to address it.
#131 has merged. base64
command issue has been resolved by base64encode.py
utility. @gm3dmo went ahead and updated the known-issue documentation.