Please describe the problem.
See e.g. on https://github.com/datalad/git-annex/actions/runs/6680765679/job/18154374923
Repo Tests v10 unlocked
Init Tests
init: OK (0.17s)
add: OK (0.73s)
addurl: OK (0.57s)
crypto: FAIL (3.07s)
./Test/Framework.hs:86:
initremote failed with unexpected exit code (transcript follows)
initremote foo (encryption setup) (to gpg keys: 129D6E0AC537B9C7)
git-annex: .git/annex/othertmp/remote.log: hPut: invalid argument (invalid character)
failed
(recording state in git...)
initremote: 1 failed
started only recently but consistently:
(git)smaug:/mnt/datasets/datalad/ci/git-annex/builds/2023/10[master]git
$> git grep -l 'hPut: invalid argument'
cron-20231027/build-ubuntu.yaml-1289-1c03c8fd-failed/0_test-annex (normal, ubuntu-latest).txt
...
Reproduced with LANG=C:
Not quite the same error but almost certianly the same problem.
I've confirmed this is caused by 3742263c99180d1391e4fd51724aae52d6d02137
Will probably need to revert the Remote/Helper/Encryptable.hs part of that commit.
What is happening here is, encodeBS is failing when run on the String from a SharedPubKeyCipher. That String comes from Utility.Gpg.genRandom and is literally a bunch of random bytes. So it's not encoded with the filesystem encoding. And it really ought to be a ByteString of course, but since it's not, anything involving encoding it fails.
That's why the old code had this comment:
And converted that String to a ByteString via
B.pack . s2w8
, which avoids this problem.What an ugly thing. Really ought to be fixed to use ByteString throughout. But for now, let's revert.