Skip to content

Python venvshellhook uses bash/zsh-isms in /bin/sh #2329

@cdegroot

Description

@cdegroot

What happened?

/home/cees/dev/cw/.devbox/virtenv/python/bin/venvShellHook.sh: 35: read: Illegal option -n

on loading a python-enabled devbox environment.

Steps to reproduce

Use Python on a system like Debian 12

The issue is that venvShellHook uses options on read that are only found in bash and zsh. The script itself, however, declares #!/bin/sh as the interpreter, and on systems like Debian 12 this points at dash, which is a very minimalistic shell.

I suggest to not overcomplicate things and trade off a bit of UX for robustness, by only using a minimal Posix subset of read. The other solution, #!/usr/bin/env bash, will be not nice on macOS' obsolete version of bash and run into trouble with people that don't have bash installed in the first place.

Devbox version

0.13.3

What system does this bug occur on?

Debian 12 (Intel)

Debug logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions