Skip to content

Passing a bare path to open_pty() attempts to execute / #108

Done

Description

@tony

Summary

The annotated Sequence[str] accepts a bare executable path. Expanding that path treats each character as a separate argument and attempts to execute the leading slash of an absolute POSIX path.

Reproduction

  1. From the tagged libvt checkout, install the locked development dependencies with uv sync --frozen --python 3.14 --all-groups --all-extras. Use the checkout root as the working directory.

  2. Save the following as case.py at the checkout root.

import asyncio
import sys
from libvt.aio import open_pty

async def main():
    async with open_pty([sys.executable, "-c", "print('OK')"]) as run:
        print("argv list:", (await run.wait_for("OK")).text)
    try:
        async with open_pty(sys.executable):
            pass
    except OSError as exc:
        print("argv string:", type(exc).__name__, str(exc))

asyncio.run(main())
  1. Run the case.
$ uv run --no-sync python case.py

Expected

The API accepts a single executable name as one argument or rejects the bare string before spawning, with guidance to pass [executable].

Actual

A list starts Python and prints OK. Supplying the same absolute executable path as a string raises PermissionError for /.

Environment

Tested versions

CPython 3.14.6 on Linux under WSL2 ARM64. Identical output on release v0.0.1a4 (09611e5) and trunk (0864aa2).

Evidence

Observed output
argv list: OK
argv string: PermissionError [Errno 13] Permission denied: '/'

Proposal

Define single-string argv behavior and validate it before opening a PTY. Add a typed positive example, a bare path and an empty sequence.

  • Developer experience — An error points directly to the argument that needs changing.
  • Immediate benefit — Eliminates misleading executable-permission reports for the filesystem root.
  • Longer-term benefit — Sets an explicit command contract for future sync and async process interfaces.
  • End-user experience — A first-time caller gets a useful explanation for a familiar subprocess call shape.

References

Activity

  1. added
    bug
    p2
    on Nov 30, 2026
  2. tony commented on Dec 3, 2026

    @tony
    ContributorAuthor

    open_pty() now rejects a bare command string before allocating a PTY. The allocation guard confirms the error precedes openpty(). Passing [executable] launches the real Linux child and the fixture receives READY. PR #165

  3. added a commit that references this issue on Dec 3, 2026
    cf2a696
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugp2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions