Skip to content

Commit a8b10a1

Browse files
author
Cassandra Comar
committed
fakedir patch upstreamed
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.
1 parent 8a9cac1 commit a8b10a1

File tree

3 files changed

+7
-28
lines changed

3 files changed

+7
-28
lines changed

Diff for: fakedir-null-buffer.patch

-23
This file was deleted.

Diff for: flake.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: flake.nix

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
bundlers = {
99
nix-bundle = { program, system }: let
1010
nixpkgs' = nixpkgs.legacyPackages.${system};
11-
fakedir = fakedir-pkgs.packages.${system}.fakedir.overrideAttrs (old: { patches = [./fakedir-null-buffer.patch]; });
11+
fakedir = fakedir-pkgs.packages.${system}.fakedir-universal;
1212
nix-bundle = import self { nixpkgs = nixpkgs'; inherit fakedir; };
1313
script-linux = nixpkgs'.writeScript "startup" ''
1414
#!/bin/sh
@@ -22,8 +22,10 @@
2222
export DYLD_INSERT_LIBRARIES="''${__TMPX_DAT_PATH}/lib/libfakedir.dylib"
2323
export FAKEDIR_PATTERN=/nix
2424
export FAKEDIR_TARGET="''${__TMPX_DAT_PATH}/nix"
25+
export FAKEDIR_DEBUG=1
2526
26-
exec "''${__TMPX_DAT_PATH}$(dirname ${program})/$(basename "$0")" "$@"
27+
# make sure the fakedir libraries are loaded and avoid sh execing without the libraries loaded first
28+
sh -c "test -e $DYLD_INSERT_LIBRARIES && ''${__TMPX_DAT_PATH}$(dirname ${program})/$(basename "$0") $@"
2729
'';
2830
script = if nixpkgs'.stdenv.isDarwin then script-darwin else script-linux;
2931
in nix-bundle.makebootstrap {

0 commit comments

Comments
 (0)