-
Notifications
You must be signed in to change notification settings - Fork 133
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
Does exec/command need full paths? #1609
Comments
first off - thanks for the nix port! (let us know if there is a link we can throw up on ops.city or something) no, this is just convention ideally we aren't shelling out for anything but that is a completely diff. chunk of work to do which is independent of this work; if you've got something that will work on (linux, wsl2, macos) we are def. open |
Well, I can't take credit for the initial packaging. It was actually first packaged 2years ago around version 0.1.32, but hasn't been updated since so I'm trying to update it. I'm not a go developer, but I took a look at the docs which suggests to me that when getting rid of the absolute path, go will find executables to run based on the normal path rules for the platform it's compiled on (minus go ignores the PWD...) I'll put a PR together for this. Do you have CI checks for wsl or macos? I only have access to a linux machine unfortunately... |
is it possible to just symlink this in your nix pkg (mayl/nixpkgs@9dcb1d3) ? if that's not possible we could look to see if one of these env vars are set (https://nixos.org/manual/nix/stable/command-ref/env-common) and if so use that; i had forgotten that go in the past few releases has changed how exec works |
I can't symlink to What's the reluctance to use |
that actually doesn't work anymore in newer go versions on purpose; i've seen quite a few pkgs put symlinks in - why wouldn't that work? i was looking at the nix env vars and that seems like something that could be dealt with there; we don't really want to force another cmd on non-nix users just to lookup the path of a shell but we can do that behavior if we know we're in nix (by seeing that one of these env vars are set) |
Is this link out of date? When I read "The functions Command and LookPath look for a program in the directories listed in the current path, following the conventions of the host operating system.", I interpreted that as long as Nix makes lots of symlinks generally, but as part of it's sandboxing rules any given derivation can only write to it's output path in the nix store (which is under Those env vars you linked are for configuring how I'm not sure how clear the above is, there's a lot of nix weirdness that we could get into that I'm trying to avoid and keep things brief... If we have to resort to reading an absolute path out of environment variables, I guess I'd prefer we just write the logic to find |
does this work for you? #1615 |
Yep, that'll work! |
Also, thanks for sticking with this weird edge case. I'll update my nix expression to this latest version and work on getting that into a nixpkgs pr. |
I working on updating the version of ops included in nixpkgs here.
Because in nix, binaries like bash are not found at
/bin/bash
, I've been patching out the calls like below from/bin/bash/
to justbash
and then populatingops
's path so that it can find the required binaries.ops/cmd/cmd_network.go
Line 255 in 0df5de6
So far, this seems to be working for me and it got me wondering, does
ops
actually need these hardcoded absolute paths tobash
? If not, would you be open to a PR to letops
find these binaries solely based onPATH
? If it doesn't have negative impact for other systems it would make packaging in nixos cleaner, which I accept is a bit of a niche use case... But maybe you are sympathetic to niche use cases? 😄The text was updated successfully, but these errors were encountered: