Title: test_venv.test_special_chars_csh fails on NetBSD · Issue #139308 · python/cpython · GitHub
Open Graph Title: test_venv.test_special_chars_csh fails on NetBSD · Issue #139308 · python/cpython
X Title: test_venv.test_special_chars_csh fails on NetBSD · Issue #139308 · python/cpython
Description: Bug report Bug description: The test_venv.BasicTest.test_special_chars_csh test fails on NetBSD. NetBSD's csh cannot properly handle the specific character combination '";&&$e|"' even when correctly quoted, because $e is interpreted as a...
Open Graph Description: Bug report Bug description: The test_venv.BasicTest.test_special_chars_csh test fails on NetBSD. NetBSD's csh cannot properly handle the specific character combination '";&&$e|"' even when correctl...
X Description: Bug report Bug description: The test_venv.BasicTest.test_special_chars_csh test fails on NetBSD. NetBSD's csh cannot properly handle the specific character combination '";&&$e|...
Opengraph URL: https://github.com/python/cpython/issues/139308
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test_venv.test_special_chars_csh fails on NetBSD","articleBody":"# Bug report\n\n### Bug description:\n\nThe `test_venv.BasicTest.test_special_chars_csh` test fails on NetBSD. NetBSD's csh cannot properly handle the specific character combination `'\";\u0026\u0026$e|\"'` even when correctly quoted, because `$e` is interpreted as a variable reference.\n\n### Configuration\n\n```sh\n./configure --with-pydebug\n```\n\n### Test\n\n```python\nhome$ ./python -m test test_venv -m test_special_chars_csh -v\n== CPython 3.15.0a0 free-threading build (heads/main:e8382e55c57, Sep 23 2025, 21:04:49) [GCC 10.5.0]\n== NetBSD-10.1-amd64-x86_64-64bit-ELF little-endian\n== Python build: free_threading debug\n== cwd: /home/orange/cpython/build/test_python_worker_6821æ\n== CPU count: 16\n== encodings: locale=UTF-8 FS=utf-8\n== resources: all test resources are disabled, use -u option to unskip tests\n\nUsing random seed: 3517063575\n0:00:00 load avg: 0.08 Run 1 test sequentially in a single process\n0:00:00 load avg: 0.08 [1/1] test_venv\ntest_special_chars_csh (test.test_venv.BasicTest.test_special_chars_csh)\nTest that the template strings are quoted properly (csh) ... prompt: Undefined variable.\n\nERROR\n\n======================================================================\nERROR: test_special_chars_csh (test.test_venv.BasicTest.test_special_chars_csh)\nTest that the template strings are quoted properly (csh)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/home/orange/cpython/Lib/test/test_venv.py\", line 544, in test_special_chars_csh\n out, err = check_output([csh, test_script])\n ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^\n File \"/home/orange/cpython/Lib/test/test_venv.py\", line 58, in check_output\n raise subprocess.CalledProcessError(\n p.returncode, cmd, out, err)\nsubprocess.CalledProcessError: Command '['/bin/csh', '/tmp/tmp82wovfyk/test_special_chars.csh']' returned non-zero exit status 1.\n\n----------------------------------------------------------------------\nRan 1 test in 1.969s\n\nFAILED (errors=1)\ntest test_venv failed\n0:00:02 load avg: 0.15 [1/1/1] test_venv failed (1 error)\n\n== Tests result: FAILURE ==\n\n1 test failed:\n test_venv\n\nTotal duration: 2.3 sec\nTotal tests: run=1 (filtered)\nTotal test files: run=1/1 (filtered) failed=1\nResult: FAILURE\nhome$\n```\n\n### Reproduce\n```python\nimport os\nimport tempfile\nimport shutil\nimport subprocess\nimport shlex\nfrom venv import EnvBuilder\n\n\ndef test_original_test_case():\n print(\"\\n=== Reproducing original test case ===\")\n\n csh = shutil.which('tcsh') or shutil.which('csh')\n if not csh:\n print(\"No csh/tcsh found, skipping test\")\n return\n with tempfile.TemporaryDirectory() as tmpdir:\n env_name = '\";\u0026\u0026$e|\"'\n env_dir = os.path.join(os.path.realpath(tmpdir), env_name)\n try:\n builder = EnvBuilder(clear=True)\n builder.create(env_dir)\n activate = os.path.join(env_dir, 'bin', 'activate.csh')\n test_script = os.path.join(tmpdir, 'test_special_chars.csh')\n with open(test_script, \"w\") as f:\n f.write(f'source {shlex.quote(activate)}\\n'\n 'python -c \\'import sys; print(sys.executable)\\'\\n'\n 'python -c \\'import os; print(os.environ[\"VIRTUAL_ENV\"])\\'\\n'\n 'deactivate\\n')\n print(f\"\\nRunning test script with {csh}:\")\n try:\n result = subprocess.run([csh, test_script],\n capture_output=True, text=True, timeout=10)\n print(f\"Return code: {result.returncode}\")\n if result.returncode == 0:\n print(f\"Output: {result.stdout}\")\n else:\n print(f\"Error: {result.stderr}\")\n except Exception as e:\n print(f\"Error running test: {e}\")\n\n except Exception as e:\n print(f\"Error in test case: {e}\")\n\n\nif __name__ == \"__main__\":\n test_original_test_case()\n```\nOutput:\n```sh\nhome: {5} ./python reproducer.py\n\n=== Reproducing original test case ===\n\nRunning test script with /bin/csh:\nReturn code: 1\nError: prompt: Undefined variable.\n\nhome: {6} echo $SHELL\n/bin/csh\n```\n\n```sh\n# This FAILS with \"Unmatched .\" error\n/bin/csh -c 'echo \"Testing: \\\";\u0026\u0026$e|\\\"\"'\n\n# This FAILS with \"e: Undefined variable.\" error\n/bin/csh -c 'echo \"Testing: '\\'';\u0026\u0026$e|'\\''\"'\n\n# This WORKS correctly\n/bin/csh -c 'echo '\\''\";\u0026\u0026$e|\"'\\'''\n```\n\n### CPython versions tested on:\n\nCPython main branch, 3.15, 3.14, 3.13\n\n### Operating systems tested on:\n\nOther\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-139341\n* gh-139559\n* gh-139560\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/furkanonder","@type":"Person","name":"furkanonder"},"datePublished":"2025-09-24T19:31:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/139308/cpython/issues/139308"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a854a0ed-0208-0ff6-b056-7ea6976730a2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C5B2:275F42:F465B5:150ED1E:696A93F0 |
| html-safe-nonce | 45b12d315b64dc0b5fe1a0d4c7ac8b3c87e01e180a940ddf9e711538067cf03b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNUIyOjI3NUY0MjpGNDY1QjU6MTUwRUQxRTo2OTZBOTNGMCIsInZpc2l0b3JfaWQiOiI1MTM2MTk2Nzg1MTE3MjM4MjU3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 544b24caa54a94876b295f82c350bbb355c4407713452dfee17d18a84d7e1e99 |
| hovercard-subject-tag | issue:3450674500 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/139308/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f2b591f572aa19d4ce6e06b7e389f58e39c7fa18460f008a9c446935655f9e03/python/cpython/issues/139308 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f2b591f572aa19d4ce6e06b7e389f58e39c7fa18460f008a9c446935655f9e03/python/cpython/issues/139308 |
| og:image:alt | Bug report Bug description: The test_venv.BasicTest.test_special_chars_csh test fails on NetBSD. NetBSD's csh cannot properly handle the specific character combination '";&&$e|"' even when correctl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | furkanonder |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4dd496afc954da9c207b2d9fbe86e3074619f565754aa1d9274aec30d9e5b8d7 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 31496a13b80a2f6ad77d6c617ee2255a3545b539 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width