Skip to content

uv run --preview-features=target-workspace-discovery fails needlessly reading uv.toml, pyproject.toml from inaccessible cwd #18687

@andersk

Description

@andersk

Summary

$ uv init /tmp/project
$ uv --project=/tmp/project add requests
$ echo 'import requests; print(requests.__version__)' > /tmp/project/main.py
$ mkdir /tmp/elsewhere
$ cd /tmp/elsewhere
$ uv run --preview-features=target-workspace-discovery /tmp/project/main.py
2.32.5
$ chmod 000 .
$ uv run --preview-features=target-workspace-discovery /tmp/project/main.py
error: failed to open file `/tmp/elsewhere/uv.toml`: Permission denied (os error 13)

This comes up when an administrator with cwd /root uses su to run a script as another user who can’t read /root. For example, a Zulip administrator expects to be able to run su zulip -c '/home/zulip/deployments/current/manage.py backup'.

(Rereported from #11302 (comment) with a more streamlined test case.)

Please merge this fix:

Platform

Linux amd64

Version

0.11.0

Python version

Python 3.14.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions