bug(global): expose fails when multiple nested executables share a basename
Checks
- I have checked that this issue has not already been reported.
- I have confirmed this bug exists on the latest version of pixi, using
pixi --version.
Reproducible example
Commands I ran and their output:
export PIXI_HOME="$(mktemp -d)"
pixi global install -e cxx --expose gcc c-compiler cxx-compiler
pixi global expose add -e cxx objdump -vv(installed) cxx
├── dependencies + c-compiler 2.0.0, + cxx-compiler 2.0.0
└── exposed + gcc
Error:
× Failed to add executables for environment: cxx
╰─▶ Couldn't find executable objdump in .../envs/cxx, found these executables: ["gcc", "objdump", "gcc", "objdump"]pixi info excerpt:
Pixi version: 0.81.0
Platform: linux-64No project manifest is required. The reproducer uses only packages from conda-forge and an
isolated PIXI_HOME.
Issue description
The environment contains a unique top-level toolchain executable:
envs/cxx/bin/x86_64-conda-linux-gnu-objdumpIt also contains two nested executables/symlinks whose basename is objdump, for example under the
target-prefix bin and GCC libexec directories. The exposure resolver finds both basename
matches, but when there is more than one match it accepts only a candidate whose parent is exactly
the known Unix binary folder bin. Neither nested candidate qualifies, so it reports that it
couldn't find objdump, even though the diagnostic itself lists it twice.
The explicit toolchain name works:
pixi global expose add -e cxx objdump=x86_64-conda-linux-gnu-objdump
objdump --versionGNU objdump (GNU Binutils) 2.46.1The relevant selection logic is in: https://github.com/prefix-dev/pixi/blob/main/crates/pixi_global/src/install.rs
This resembles #3077, which reported an executable listed multiple times but treated as missing and was closed as fixed. It is also adjacent to nested-path support in #2350, but this reproducer uses executables installed from Conda package metadata rather than an executable added after install.
Additional observation: in a pre-existing environment, adding several mappings in one command also
printed WARN Reverting of the operation failed and left an invalid objdump = "objdump" mapping
and broken trampoline. The isolated minimal reproducer above rolls back cleanly, so that rollback
failure may require additional state and is not claimed as part of the minimal reproducer.
Expected behavior
Pixi should either select an appropriate executable deterministically (for example, the shortest or top-level toolchain executable), or report an explicit ambiguity containing candidate paths. It should not say the executable is missing when matching executables were found.
Source: prefix-dev/pixi