Skip to content

venv activate.csh fails when user prompt contains newline #122765

Closed

Description

@brandyn

Bug report

Bug description:

activate.csh uses "$prompt" in quotes like that, which fails when the user prompt contains a newline (error: unbalanced quotes).

Using $prompt:q or "$prompt:q" solves this with no harm, at least in tcsh (not sure about vanilla csh), at least for activate. (Deactivate may have similar issue.)

CPython versions tested on:

3.11

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Aug 6, 2024
  2. added a commit that references this issue on Sep 5, 2024
  3. JacekDuszenko commented on Sep 6, 2024

    @JacekDuszenko
    Contributor

    sent a PR with a fix however there is a similar issue with __VENV_PROMPT__ variable. When you set a custom prompt e.g. with --prompt='"' the script crashes @ https://github.com/python/cpython/blob/main/Lib/venv/scripts/posix/activate.csh#L22.

    It's fixable by extracting the concatenated __VENV_PROMPT__ and prompt to a separate variable and then using it with ":q" on the next line while setting the prompt.
    Can send another PR with a fix if sounds good.

  4. changed the title [-]venv activate.csh fails when user prompt contains newline. Easy to fix.[/-] [+]venv activate.csh fails when user prompt contains newline[/+] on Sep 6, 2024
  5. added a commit that references this issue on Sep 17, 2024
  6. added a commit that references this issue on Sep 17, 2024
  7. added a commit that references this issue on Sep 22, 2024
  8. added a commit that references this issue on Oct 10, 2024
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

    easytopic-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