-
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
resholve fails to parse aliases with = chars in their definition because aliases are split with .split('=') here, this breaks derivation realisation whether or not solutions.default.fix.aliases is set to true.
example alias that triggers the issue:
ssh_prod='ssh $(AWS_REGION=us-east-1 ssm-machine jump)'error emitted during evaluation:
> File "/nix/store/bmnmsvgqamwdcvybicmw5hkv1lanihnh-resholve-0.10.5/bin/.resholve-wrapped", line 3509, in handle_builtin_alias
> alias, definition = word.strip("\"='").split("=")
> ValueError: too many values to unpack
patching resholve as follows to only split on the first occurrence of = fixed it for me, I'm willing to create a PR for this if you don't mind.
diff --git a/resholve b/resholve
index c163fa9..e0581bc 100755
--- a/resholve
+++ b/resholve
@@ -3506,7 +3506,7 @@ class RecordCommandlike(object):
if word.ok:
# not dynamic; more examples in tests/aliases.sh, but:
# 'd', 'echo $SOURCE_DATE_EPOCH'
- alias, definition = word.strip("\"='").split("=")
+ alias, definition = word.strip("\"='").split("=", 1)
# TODO: maybe below deserves an explicit API
cmdlikes[alias].alias = True
commandlike = definition.split()[0]
abathur
Metadata
Metadata
Assignees
Labels
No labels