Skip to content

Command resolution prefers /usr/sbin over /usr/bin despite identical PATH order #58440

@ergolyam

Description

@ergolyam

Is this a new report?

Yes

System Info

Void 6.12.63_1 x86_64 AuthenticAMD notuptodate rF

Package(s) Affected

fish-shell-4.3.2_1, bash-5.3_2, etc.

Does a report exist for this bug with the project's home (upstream) and/or another distro?

No response

Expected behaviour

With identical PATH order, command resolution should prefer the binary located earlier in the filesystem hierarchy only according to PATH lookup rules, consistently with other distributions (e.g. Alpine).

In this case, fish should resolve to /usr/bin/fish.

Actual behaviour

On Void Linux, fish resolves to /usr/sbin/fish, even though PATH order is identical to Alpine Linux where /usr/bin/fish is chosen.
This indicates the issue is not PATH order itself, but Void-specific command resolution behavior or filesystem/packaging layout.

Steps to reproduce

My host:

$ echo $PATH
/home/user/.local/bin /home/user/.local/share/android-sdk/cmdline-tools/bin /home/user/.local/share/android-sdk/platform-tools /home/user/.local/share/android-sdk/build-tools/33.0.0 /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin
$ command -v fish
/usr/sbin/fish
$ command -v bash
/usr/sbin/bash
$ command -v podman
/usr/sbin/podman

Void glibc container:

$ podman run --rm -it ghcr.io/void-linux/void-glibc
# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# command -v fish
/usr/sbin/fish

Alpine container:

$ podman run --rm -it docker.io/alpine
# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# command -v fish
/usr/bin/fish

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-testingTesting a PR or reproducing an issue needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions