Skip to content

Error in venv/scripts/common/activate when $OSTYPE is not set #112252

@jamesturk

Description

@jamesturk

Bug report

Bug description:

When trying to use . .venv/bin/activate to activate a virtualenv from within a Justfile the script exits with an error "sh: 42: .venv/bin/activate: OSTYPE: parameter not set".

Failing Test on 3.12.0: https://github.com/jamesturk/venv-just-experiment/actions/runs/6917021149/job/18817722528
Successful on 3.11.6: https://github.com/jamesturk/venv-just-experiment/actions/runs/6917021149/job/18817722369

This only started happening on Python 3.12, and I confirmed is still happening on the main branch.

It seems a change to Lib/venv/scripts/common/activate is at issue here. I'll submit a matching PR.

Due to the use of the variable without a default (unlike other variables in this script), running activate inside of a script with set -u/set -o nounset will fail.

CPython versions tested on:

3.12, CPython main branch

Operating systems tested on:

Linux, macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixestopic-venvRelated to the venv moduletype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions