-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Resholve doesn’t understand sudo --verison
#113
Comments
Egh :) My kingdom for a cli syntax parser that's a better fit for what we need. I think the positional arg is causing this. |
For whatever reason, when resholve encounters something like this: sudo echo hi it doesn’t resolve the echo command. I’m not sure why it doesn’t resolve that command, but I have a feeling that it’s related to this issue [1]. This commit works around that resholve limitation by pre-resolving commands that get executed by sudo. The main motivation behind this commit is to make creating a future commit easier. In order for that future commit to work, this command: sudo nixos-install must be transformed into this command: sudo <path-to-nixos-install> because nixos-install won’t be on the PATH. [1]: <abathur/resholve#113> TODO: • Add note referencing the future commit.
For whatever reason, when resholve encounters something like this: sudo echo hi it doesn’t resolve the echo command. I’m not sure why it doesn’t resolve that command, but I have a feeling that it’s related to this issue [1]. This commit works around that resholve limitation by pre-resolving commands that get executed by sudo. The main motivation behind this commit is to make creating a future commit easier. In order for that future commit to work, this command: sudo nixos-install must be transformed into this command: sudo <path-to-nixos-install> because nixos-install won’t be on the PATH. [1]: <abathur/resholve#113>
Will hopefully fix #113. The attempt to model one of sudo's forms with dest="skip" was a mistake, and we weren't testing sudo well enough (because of nix/nixpkgs issues here) for it to get caught quickly.
I pushed a tentative fix in 39f5012 if you're able to test it? |
It looks like that tentative fix works, but I think that I’ve discovered another problem. If I use #!/nix/store/f2ibj8np6dyddf3kq68dkcvwfr6bmi9n-bash-interactive-5.2-p15/bin/bash
# Caution: you're faking sudo as a script that runs `true`
/nix/store/q56d1m0ws1kf8vddfw71d8nfagnv0x6g-sudo-1.9.15p2/bin/sudo --version
/nix/store/q56d1m0ws1kf8vddfw71d8nfagnv0x6g-sudo-1.9.15p2/bin/sudo -v
/nix/store/q56d1m0ws1kf8vddfw71d8nfagnv0x6g-sudo-1.9.15p2/bin/sudo /nix/store/m38gwq0w8w7qyjn9s00balyp7cv3m5p9-coreutils-9.3/bin/ls
### resholve directives (auto-generated) ## format_version: 3
# resholve: fix sudo
# resholve: keep /nix/store/m38gwq0w8w7qyjn9s00balyp7cv3m5p9-coreutils-9.3/bin/ls
# resholve: keep /nix/store/q56d1m0ws1kf8vddfw71d8nfagnv0x6g-sudo-1.9.15p2/bin/sudo
But, if I use #!/nix/store/f2ibj8np6dyddf3kq68dkcvwfr6bmi9n-bash-interactive-5.2-p15/bin/bash
# Caution: you're faking sudo as a script that runs `true`
sudo --version
sudo -v
sudo ls
### resholve directives (auto-generated) ## format_version: 3
# resholve: fake external:sudo
Shouldn’t |
As implemented, fake directives preempt resolution, and sub-exec is part of resolution. That said, fake directives were implemented before sub-exec resolution, and I agree there's potential for confusion here. I'm tempted to say these might both deserve independent levers, though I'm not sure how much work it is and there are some confounding variables like whether faking a function/alias sudo should pull in sub-exec processing or not... |
Resholve’s parser for
sudo
is supposed to supportsudo --version
, but it doesn’t work. This Nix expression:fails to build with the following error:
The text was updated successfully, but these errors were encountered: