-
Notifications
You must be signed in to change notification settings - Fork 46
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
feat(arx): add experimental macos support via fakedir #107
base: master
Are you sure you want to change the base?
Conversation
fixes matthewbauer#17 see: [fakedir](https://github.com/nixie-dev/fakedir/tree/b0f70b805aa86fe881eeca642f12069c7983a8e7) for limitations and caveats.
thread argv0 through the arx call stack so we can select the binary in the target's bin path based on it. this also fixes an issue with fakedir where running `Dir.pwd` within ruby would cause a segfault due to a null ptr dereference.
I added a patch to fix a null pointer dereference when ruby calls I've also made it possible to run multiple executables within the same target package (in the same /bin directory). it uses argv0 to decide which binary to execute so symlink the bottle to the other binaries you want to reach and use lastly, because arx changes PWD and because fakedir can't set up a chroot with paths bind mounted into the right places, I added a way to restore PWD context, so bottled tools work just like a natively installed tool -- there's now a |
the null buffer issue has been resolved upstreamed with a PR. also, fix an issue with symlinks/shebangs not being rewritten for the initial program executed by the startup script -- we need to avoid that call to execvp happening in the process environment that existed prior to the injection of the fakedir libraries. to do that, run a new shell where the exported env vars are set and avoid that shell just execing by first testing if the fakedir library is present and loaded, then running the specified executable.
running into errors with a deficient sh that lacks `exec -a` when running in GitHub actions. switching to bash as a) it's available everywhere except windows and b) ensures we can still pass the bin name through as $0.
078473c
to
6100bf4
Compare
eeecf8f
to
71db641
Compare
fixes #17
see fakedir for limitations and caveats.
I've tested the
nix bundle
interface and am able to produce a working executable arx. I need to find a machine that doesn't have the /nix/store paths already loaded to do a final validation. I tested using ruby and I'm able to run basic ruby scripts. I'm going to continue testing with a more complicated application that makes use of native extensions next.basic flake for testing:
use this flake as your bundler:
once this PR merges and we're able to update the
nix-bundle
reference innixos/bundlers
,nix bundle
should work out of the box on macos, with the caveat thatfakedir
has to be able to intercept the syscalls in use by your application.