gpg-agent: fix usage of splitString
`splitString "" "some string"` would throw exception `error: invalid regular expression` on Darwin (or accurately, on Nix built against libc++). Refer to https://github.com/NixOS/nix/issues/7208 for details. Before Nix handles that issue correctly, we should refrain from using `splitString ""`, and luckliy `lib.stringAsChars` can do the same thing.
This commit is contained in:
parent
373ead2060
commit
a9b36cbe92
|
@ -48,9 +48,8 @@ let
|
||||||
hexStringToBase32 = let
|
hexStringToBase32 = let
|
||||||
mod = a: b: a - a / b * b;
|
mod = a: b: a - a / b * b;
|
||||||
pow2 = elemAt [ 1 2 4 8 16 32 64 128 256 ];
|
pow2 = elemAt [ 1 2 4 8 16 32 64 128 256 ];
|
||||||
splitChars = s: init (tail (splitString "" s));
|
|
||||||
|
|
||||||
base32Alphabet = splitChars "ybndrfg8ejkmcpqxot1uwisza345h769";
|
base32Alphabet = stringToCharacters "ybndrfg8ejkmcpqxot1uwisza345h769";
|
||||||
hexToIntTable = listToAttrs (genList (x: {
|
hexToIntTable = listToAttrs (genList (x: {
|
||||||
name = toLower (toHexString x);
|
name = toLower (toHexString x);
|
||||||
value = x;
|
value = x;
|
||||||
|
@ -76,7 +75,7 @@ let
|
||||||
buf = buf';
|
buf = buf';
|
||||||
bufBits = bufBits';
|
bufBits = bufBits';
|
||||||
};
|
};
|
||||||
in hexString: (foldl' go initState (splitChars hexString)).ret;
|
in hexString: (foldl' go initState (stringToCharacters hexString)).ret;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
meta.maintainers = [ maintainers.rycee ];
|
meta.maintainers = [ maintainers.rycee ];
|
||||||
|
|
Loading…
Reference in a new issue