From 0cd09d2babb67e275c10e09a77cdaddecda10ed8 Mon Sep 17 00:00:00 2001 From: Jacek Duszenko Date: Fri, 6 Sep 2024 01:47:04 +0200 Subject: [PATCH 1/3] gh-122765 make prompt in activate.csh robust against unbalanced quotes and newlines --- Lib/venv/scripts/posix/activate.csh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/venv/scripts/posix/activate.csh b/Lib/venv/scripts/posix/activate.csh index c707f1988b0acc..019bc318fd6fb9 100644 --- a/Lib/venv/scripts/posix/activate.csh +++ b/Lib/venv/scripts/posix/activate.csh @@ -16,10 +16,10 @@ setenv PATH "$VIRTUAL_ENV/__VENV_BIN_NAME__:$PATH" setenv VIRTUAL_ENV_PROMPT "__VENV_PROMPT__" -set _OLD_VIRTUAL_PROMPT="$prompt" +set _OLD_VIRTUAL_PROMPT="$prompt:q" if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then - set prompt = "(__VENV_PROMPT__) $prompt" + set prompt = "(__VENV_PROMPT__) $prompt:q" endif alias pydoc python -m pydoc From 2d48db8dfb96184bdc33a61002f02d5fb3fbc123 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 00:00:44 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2024-09-06-00-00-43.gh-issue-122765.tx4hsr.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2024-09-06-00-00-43.gh-issue-122765.tx4hsr.rst diff --git a/Misc/NEWS.d/next/Library/2024-09-06-00-00-43.gh-issue-122765.tx4hsr.rst b/Misc/NEWS.d/next/Library/2024-09-06-00-00-43.gh-issue-122765.tx4hsr.rst new file mode 100644 index 00000000000000..8a1bc4bce81d76 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-09-06-00-00-43.gh-issue-122765.tx4hsr.rst @@ -0,0 +1 @@ +Fix unbalanced quote errors occurring when activate.csh in :mod:`venv` was sourced with a custom prompt containing unpaired quotes or newlines. From ad6256f4d08e6f24ba499b6de5bb405c0d32f33f Mon Sep 17 00:00:00 2001 From: Jacek Duszenko Date: Fri, 6 Sep 2024 14:04:57 +0200 Subject: [PATCH 3/3] remove :q when saving the old prompt for later retrieval --- Lib/venv/scripts/posix/activate.csh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/venv/scripts/posix/activate.csh b/Lib/venv/scripts/posix/activate.csh index 019bc318fd6fb9..b5db4a0f847e06 100644 --- a/Lib/venv/scripts/posix/activate.csh +++ b/Lib/venv/scripts/posix/activate.csh @@ -16,7 +16,7 @@ setenv PATH "$VIRTUAL_ENV/__VENV_BIN_NAME__:$PATH" setenv VIRTUAL_ENV_PROMPT "__VENV_PROMPT__" -set _OLD_VIRTUAL_PROMPT="$prompt:q" +set _OLD_VIRTUAL_PROMPT="$prompt" if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then set prompt = "(__VENV_PROMPT__) $prompt:q"