#16209·uv

Generated shebang lines output 'realpath: --: No such file or directory'

Author: maxwell-kCreated Oct 9, 2025Updated Sep 16, 2026
Labelsbugcompatibilitygreat writeup

Example command to reproduce on Alpine Linux:

uv tool run --from charset-normalizer normalizer --version

Expected output:

Charset-Normalizer 3.4.3 - Python 3.12.11 - Unicode 15.0.0 - SpeedUp ON

Actual output:

realpath: --: No such file or directory
Charset-Normalizer 3.4.3 - Python 3.12.11 - Unicode 15.0.0 - SpeedUp ON
Background to --

As background POSIX guidelines encourage utilities to accept --; this can be helpful to handle file name arguments that start with a dash. Python itself follows this guideline.

Guideline 10: The first -- argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the '-' character.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html

Alpine Linux utilities like realpath come from BusyBox not GNU Coreutils. The BusyBox realpath does not support --; and as a result outputs realpath: --: No such file or directory:

~ # touch /file
~ # realpath -- /file
realpath: --: No such file or directory
/file
~ # which realpath
/usr/bin/realpath
~ # apk info --who-owns /usr/bin/realpath
/usr/bin/realpath symlink target is owned by busybox-1.37.0-r19

Because, in certain conditions, uv adds a shebang line that includes realpath -- the output from certain uv commands includes an extra error message.

A naive solution is a pull request removing -- from shebang lines. This makes uv more portable to distributions like Alpine Linux that use BusyBox. A negative of that solution is for the majority of distributions, which use GNU coreutils, uv will perhaps not handle scripts starting with a dash, -, as effectively. I haven't quantified this negative.

Detailed reproduction steps

Commands to reproduce:

incus launch images:alpine/3.22 c1
incus exec c1 apk add curl python3
incus exec c1 -- su -lc 'curl -LsSf https://astral.sh/uv/install.sh | sh'
incus exec c1 -- su -lc \
    'uv tool run --from charset-normalizer normalizer --version'

Commands to view the shebang line:

incus exec c1 -- sh -c \
    "find /root/.cache/uv -path '*/bin/normalizer' | xargs head -n5"

Output:

#!/bin/sh
'''exec' "$(dirname -- "$(realpath -- "$0")")"/'python' "$0" "$@"
' '''
# -*- coding: utf-8 -*-
import sys

I edited the description to use a more popular package in the reproduction steps. charset-normalizer appears around number 8 on https://pypistats.org/top. The original report used https://github.com/Vimjas/vint which is niche by comparison.