flox / flox

Developer environments you can take with you
https://flox.dev
GNU General Public License v2.0
2.46k stars 58 forks source link

Test `ld-floxlib.bats` fails if `LD_LIBRARY_PATH` is set on runner #1350

Closed aakropotkin closed 2 months ago

aakropotkin commented 5 months ago

Describe the bug:

Steps to reproduce:

  1. Set LD_LIBARARY_PATH in some rc script such as bashrc or zshrc.
  2. Run just test-all
  3. See output for ld-floxlib.bats

Result:

ld-floxlib.bats
 ✗ test ld-floxlib.so on Linux only [3216]
   tags: end2end ld-floxlib
   (from function `assert_success' in file /nix/store/6x5775cx4h68lvzz9n47l20qyww57jz0-bats-with-libraries-1.10.0/share/bats/bats-assert/src/assert_success.bash, line 42,
    in test file ld-floxlib.bats, line 106)
     `assert_success' failed
   + _PKGDB_GA_REGISTRY_REF_OR_REV=bc01a2be500c10f1507dcc8e98c9f5bd72c02aa3
   + /home/camus/src/flox/cli/target/debug/flox init
   ✨ Created environment project-1 (x86_64-linux)

   Next:
     $ flox search <package>    <- Search for a package
     $ flox install <package>   <- Install a package into an environment
     $ flox activate            <- Enter the environment

   + _PKGDB_GA_REGISTRY_REF_OR_REV=bc01a2be500c10f1507dcc8e98c9f5bd72c02aa3
   + /home/camus/src/flox/cli/target/debug/flox update
   🔒  Locked input 'nixpkgs' in environment project-1 at /tmp/nix-shell.GwAROh/bats-run-g6ms7c/test/161/project-1.
   + _PKGDB_GA_REGISTRY_REF_OR_REV=bc01a2be500c10f1507dcc8e98c9f5bd72c02aa3
   + /home/camus/src/flox/cli/target/debug/flox edit -f ./manifest.toml
   ✅ Environment successfully updated.
   boost: boost (1.79.0)
   curl: curl (7.84.0)
   gcc: gcc (11.3.0)
   gcc-unwrapped: gcc-unwrapped (11.3.0)
   glibc: glibc (2.34)
   libarchive: libarchive (3.6.1)
   nix: nix (2.10.3)
   patchelf: patchelf (0.14.5)
   + realpath /tmp/nix-shell.GwAROh/bats-run-g6ms7c/test/161/project-1/.flox/run/x86_64-linux.project-1/lib/ld-linux-x86-64.so.2
   /nix/store/mhhlymrg2m70r8h94cwhv2d7a0c8l7g6-glibc-2.34-210/lib/ld-linux-x86-64.so.2
   + test -n /tmp/nix-shell.GwAROh/bats-run-g6ms7c/test/161/project-1/.flox/run/x86_64-linux.project-1/lib:lib
   + test -e /home/camus/src/flox/pkgdb/lib/ld-floxlib.so
   + [[ /home/camus/src/flox/pkgdb/lib/ld-floxlib.so == */ld-floxlib.so ]]
   + test -z /nix/store/b5z55wa9s58k38s3wjap6dbamkri1ss6-pipewire-0.3.80-jack/lib:/home/camus/.nix-profile/lib:/home/camus/.local/lib:/nix/var/nix/profiles/default/lib:/etc/profiles/per-user/camus/lib

   -- command failed --
   status : 1
   output (4 lines):
     + test -n /tmp/nix-shell.GwAROh/bats-run-g6ms7c/test/161/project-1/.flox/run/x86_64-linux.project-1/lib:lib
     + test -e /home/camus/src/flox/pkgdb/lib/ld-floxlib.so
     + [[ /home/camus/src/flox/pkgdb/lib/ld-floxlib.so == */ld-floxlib.so ]]
     + test -z /nix/store/b5z55wa9s58k38s3wjap6dbamkri1ss6-pipewire-0.3.80-jack/lib:/home/camus/.nix-profile/lib:/home/camus/.local/lib:/nix/var/nix/profiles/default/lib:/etc/profiles/per-user/camus/lib
   --

   Last output:
   + test -n /tmp/nix-shell.GwAROh/bats-run-g6ms7c/test/161/project-1/.flox/run/x86_64-linux.project-1/lib:lib
   + test -e /home/camus/src/flox/pkgdb/lib/ld-floxlib.so
   + [[ /home/camus/src/flox/pkgdb/lib/ld-floxlib.so == */ld-floxlib.so ]]
   + test -z /nix/store/b5z55wa9s58k38s3wjap6dbamkri1ss6-pipewire-0.3.80-jack/lib:/home/camus/.nix-profile/lib:/home/camus/.local/lib:/nix/var/nix/profiles/default/lib:/etc/profiles/per-user/camus/lib

Expected: Test passes

aakropotkin commented 5 months ago

I think this may be caused by cli/tests/ld-floxlib/test-load-library-last.sh:16

limeytexan commented 5 months ago

I think this may be caused by cli/tests/ld-floxlib/test-load-library-last.sh:16

Yeah I think that was just in there as an assertion that we weren't still doing it the old way, but there's nothing that inherently renders ld-floxlib incompatible for use with LD_LIBRARY_PATH. I'd be happy to just see that line deleted.

mkenigs commented 5 months ago

Let's just drop that line then, estimating this a 1