Skip to content
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

Change builder argv[0] to full path, instead of only basename #4358

Closed
wants to merge 1 commit into from

Conversation

puckipedia
Copy link
Contributor

@puckipedia puckipedia commented Dec 12, 2020

See commit message.
I have a few projects that use Nix, but cannot resolve their own location without knowing the full path they were called with (e.g. GCC). It seems, either way, that this decision was arbitrarily made (see 8227940), and calling the builder by its full path (so /nix/store/...-foo/bar instead of bar) follows expected behavior more closely.

Running a similar patch, but against 2.3.5, locally.

There's no reason to use only the basename of the builder; most
builders are shells of various kinds, which don't care about the full
argv[0] they're called with, but some other software *does* depend on
being called with their full path.
@grahamc
Copy link
Member

grahamc commented Dec 16, 2020

I wonder if there is a problem w.r.t. initial bootstrapping using /bin/sh in the build, which points to something else (like ash) on disk? I have no reason to think this is a problem, just curious.

@puckipedia
Copy link
Contributor Author

I haven't actually seen anything use /bin/sh, outside a single NixOS hydra test. the /bin/sh in the Nix sandbox is just a static busybox binary, and being called as /bin/sh is fine for that binary anyways.

@edolstra
Copy link
Member

I don't think we should change this. It's been this way for a long time without causing problems, it's an observable change to the behaviour of the sandbox, and it's not really clear why it's necessary (e.g. gcc is never invoked as the top-level builder). If a top-level program really needs an absolute argv[0], you can always re-exec with an absolute path.

@edolstra edolstra closed this Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants