Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows, trailing path sep causes command quoting issues #3222

Open
rmartin16 opened this issue Feb 17, 2024 · 0 comments
Open

On Windows, trailing path sep causes command quoting issues #3222

rmartin16 opened this issue Feb 17, 2024 · 0 comments
Labels
help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.

Comments

@rmartin16
Copy link

Issue

On Windows, using the provided path separator {/} as a trailing sep leads to weird quoting issues for at least commands. The quoting doesn't happen in my example on Linux, so unsure if only Windows is affected.

For example:

❯ tox -e py
py: commands[0]> command "path\to\trailing\sep -b" foo
py: exit 2 (0.02 seconds) C:\Users\user\github\beeware\toga\tmop> command "path\to\trailing\sep -b" foo
  py: FAIL code 2 (0.09=setup[0.08]+cmd[0.02] seconds)
  evaluation failed :( (0.27 seconds)

Environment

Provide at least:

  • OS: Windows 11
Output of pip list of the host Python, where tox is installed
python -m pip list
Package                       Version                 Editable project location
----------------------------- ----------------------- ------------------------------------------
alabaster                     0.7.16
apeye                         1.4.1
apeye-core                    1.1.5
autodocsumm                   0.2.12
Babel                         2.14.0
beautifulsoup4                4.12.3
CacheControl                  0.14.0
cachetools                    5.3.2
certifi                       2024.2.2
cffi                          1.16.0
cfgv                          3.4.0
chardet                       5.2.0
charset-normalizer            3.3.2
clr-loader                    0.2.6
colorama                      0.4.6
coverage                      7.4.1
cssutils                      2.9.0
dict2css                      0.3.0.post1
distlib                       0.3.8
docutils                      0.18.1
domdf-python-tools            3.8.0.post2
filelock                      3.13.1
freezegun                     1.4.0
furo                          2024.1.29
html5lib                      1.1
identify                      2.5.34
idna                          3.6
imagesize                     1.4.1
iniconfig                     2.0.0
Jinja2                        3.1.3
livereload                    2.6.3
MarkupSafe                    2.1.5
msgpack                       1.0.7
natsort                       8.4.0
nodeenv                       1.8.0
packaging                     23.2
pillow                        10.2.0
pip                           24.0
platformdirs                  4.2.0
pluggy                        1.4.0
pre-commit                    3.6.1
pycparser                     2.21
pyenchant                     3.2.2
Pygments                      2.17.2
pyproject-api                 1.6.1
pytest                        8.0.0
pytest-asyncio                0.23.5
pytest_freezer                0.4.8
python-dateutil               2.8.2
pythonnet                     3.0.3
PyYAML                        6.0.1
requests                      2.31.0
ruamel.yaml                   0.18.6
ruamel.yaml.clib              0.2.8
setuptools                    69.1.0
setuptools-scm                8.0.4
six                           1.16.0
snowballstemmer               2.2.0
soupsieve                     2.5
Sphinx                        7.2.6
sphinx-autobuild              2024.2.4
sphinx-autodoc-typehints      2.0.0
sphinx-basic-ng               1.0.0b2
sphinx-copybutton             0.5.2
sphinx-csv-filter             0.4.1
sphinx-jinja2-compat          0.2.0.post1
sphinx-prompt                 1.8.0
sphinx-tabs                   3.4.5
sphinx-toolbox                3.5.0
sphinxcontrib-applehelp       1.0.8
sphinxcontrib-devhelp         1.0.6
sphinxcontrib-htmlhelp        2.0.5
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.7
sphinxcontrib-serializinghtml 1.1.10
sphinxcontrib-spelling        8.0.0
tabulate                      0.9.0
toga-core                     0.4.3.dev172+g48afd06ab C:\Users\user\github\beeware\toga\core
toga-winforms                 0.4.3.dev172+g48afd06ab C:\Users\user\github\beeware\toga\winforms
tornado                       6.4
tox                           4.12.1
travertino                    0.3.0
typing_extensions             4.9.0
urllib3                       2.2.0
virtualenv                    20.25.0
webencodings                  0.5.1
wheel                         0.42.0

Output of running tox

Output of tox -rvv
tox -rvv
py: 359 W remove tox env folder C:\Users\user\github\beeware\toga\tmop\.tox\py [tox\tox_env\api.py:325]
py: 609 I find interpreter for spec PythonSpec(path=C:\Users\user\github\beeware\toga\venv-3.11-toga\Scripts\python.exe) [virtualenv\discovery\builtin.py:58]
py: 609 D got python info of %s from (WindowsPath('C:/Users/user/.pyenv/pyenv-win/versions/3.11.3/python.exe'), WindowsPath('C:/Users/user/AppData/Local/pypa/virtualenv/py_info/1/9a71c8dd084484b8624a042dcdeca01ae178b28815ee9c746c85da62fae408f1.json')) [virtualenv\app_data\via_disk_folder.py:131]
py: 609 I proposed PythonInfo(spec=CPython3.11.3.final.0-64, system=C:\Users\user\.pyenv\pyenv-win\versions\3.11.3\python.exe, exe=C:\Users\user\github\beeware\toga\venv-3.11-toga\Scripts\python.exe, platform=win32, version='3.11.3 (tags/v3.11.3:f3909b8, Apr  4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)]', encoding_fs_io=utf-8-cp1252) [virtualenv\discovery\builtin.py:65]
py: 609 D accepted PythonInfo(spec=CPython3.11.3.final.0-64, system=C:\Users\user\.pyenv\pyenv-win\versions\3.11.3\python.exe, exe=C:\Users\user\github\beeware\toga\venv-3.11-toga\Scripts\python.exe, platform=win32, version='3.11.3 (tags/v3.11.3:f3909b8, Apr  4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)]', encoding_fs_io=utf-8-cp1252) [virtualenv\discovery\builtin.py:67]
py: 609 D symlink on filesystem does not work [virtualenv\info.py:45]
py: 625 D filesystem is not case-sensitive [virtualenv\info.py:26]
py: 671 I create virtual environment via CPython3Windows(dest=C:\Users\user\github\beeware\toga\tmop\.tox\py, clear=False, no_vcs_ignore=False, global=False) [virtualenv\run\session.py:50]
py: 671 D create folder C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages [virtualenv\util\path\_sync.py:12]
py: 671 D create folder C:\Users\user\github\beeware\toga\tmop\.tox\py\Scripts [virtualenv\util\path\_sync.py:12]
py: 671 D write C:\Users\user\github\beeware\toga\tmop\.tox\py\pyvenv.cfg [virtualenv\create\pyenv_cfg.py:32]
py: 671 D       home = C:\Users\user\.pyenv\pyenv-win\versions\3.11.3 [virtualenv\create\pyenv_cfg.py:36]
py: 671 D       implementation = CPython [virtualenv\create\pyenv_cfg.py:36]
py: 671 D       version_info = 3.11.3.final.0 [virtualenv\create\pyenv_cfg.py:36]
py: 671 D       virtualenv = 20.25.0 [virtualenv\create\pyenv_cfg.py:36]
py: 671 D       include-system-site-packages = false [virtualenv\create\pyenv_cfg.py:36]
py: 671 D       base-prefix = C:\Users\user\.pyenv\pyenv-win\versions\3.11.3 [virtualenv\create\pyenv_cfg.py:36]
py: 671 D       base-exec-prefix = C:\Users\user\.pyenv\pyenv-win\versions\3.11.3 [virtualenv\create\pyenv_cfg.py:36]
py: 671 D       base-executable = C:\Users\user\.pyenv\pyenv-win\versions\3.11.3\python.exe [virtualenv\create\pyenv_cfg.py:36]
py: 671 D copy C:\Users\user\.pyenv\pyenv-win\versions\3.11.3\Lib\venv\scripts\nt\python.exe to C:\Users\user\github\beeware\toga\tmop\.tox\py\Scripts\python.exe [virtualenv\util\path\_sync.py:40]
py: 671 D copy C:\Users\user\.pyenv\pyenv-win\versions\3.11.3\Lib\venv\scripts\nt\pythonw.exe to C:\Users\user\github\beeware\toga\tmop\.tox\py\Scripts\pythonw.exe [virtualenv\util\path\_sync.py:40]
py: 687 D create virtualenv import hook file C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\_virtualenv.pth [virtualenv\create\via_global_ref\api.py:91]
py: 687 D create C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\_virtualenv.py [virtualenv\create\via_global_ref\api.py:94]
py: 687 D ============================== target debug ============================== [virtualenv\run\session.py:52]
py: 687 D debug via 'C:\Users\user\github\beeware\toga\tmop\.tox\py\Scripts\python.exe' 'C:\Users\user\github\beeware\toga\venv-3.11-toga\Lib\site-packages\virtualenv\create\debug.py' [virtualenv\create\creator.py:200]
py: 687 D {
  "sys": {
    "executable": "C:\\Users\\user\\github\\beeware\\toga\\tmop\\.tox\\py\\Scripts\\python.exe",
    "_base_executable": "C:\\Users\\user\\.pyenv\\pyenv-win\\versions\\3.11.3\\python.exe",
    "prefix": "C:\\Users\\user\\github\\beeware\\toga\\tmop\\.tox\\py",
    "base_prefix": "C:\\Users\\user\\.pyenv\\pyenv-win\\versions\\3.11.3",
    "real_prefix": null,
    "exec_prefix": "C:\\Users\\user\\github\\beeware\\toga\\tmop\\.tox\\py",
    "base_exec_prefix": "C:\\Users\\user\\.pyenv\\pyenv-win\\versions\\3.11.3",
    "path": [
      "C:\\Users\\user\\.pyenv\\pyenv-win\\versions\\3.11.3\\python311.zip",
      "C:\\Users\\user\\.pyenv\\pyenv-win\\versions\\3.11.3\\DLLs",
      "C:\\Users\\user\\.pyenv\\pyenv-win\\versions\\3.11.3\\Lib",
      "C:\\Users\\user\\.pyenv\\pyenv-win\\versions\\3.11.3",
      "C:\\Users\\user\\github\\beeware\\toga\\tmop\\.tox\\py",
      "C:\\Users\\user\\github\\beeware\\toga\\tmop\\.tox\\py\\Lib\\site-packages"
    ],
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib_external.PathFinder'>"
    ],
    "fs_encoding": "utf-8",
    "io_encoding": "cp1252"
  },
  "version": "3.11.3 (tags/v3.11.3:f3909b8, Apr  4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)]",
  "makefile_filename": "C:\\Users\\user\\.pyenv\\pyenv-win\\versions\\3.11.3\\Lib\\config\\Makefile",
  "os": "<module 'os' (frozen)>",
  "site": "<module 'site' (frozen)>",
  "datetime": "<module 'datetime' from 'C:\\\\Users\\\\user\\\\.pyenv\\\\pyenv-win\\\\versions\\\\3.11.3\\\\Lib\\\\datetime.py'>",
  "math": "<module 'math' (built-in)>",
  "json": "<module 'json' from 'C:\\\\Users\\\\user\\\\.pyenv\\\\pyenv-win\\\\versions\\\\3.11.3\\\\Lib\\\\json\\\\__init__.py'>"
} [virtualenv\run\session.py:53]
py: 796 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\user\AppData\Local\pypa\virtualenv) [virtualenv\run\session.py:57]
py: 796 D got embed update of distribution %s from ('pip', WindowsPath('C:/Users/user/AppData/Local/pypa/virtualenv/wheel/3.11/embed/3/pip.json')) [virtualenv\app_data\via_disk_folder.py:131]
py: 796 D got embed update of distribution %s from ('wheel', WindowsPath('C:/Users/user/AppData/Local/pypa/virtualenv/wheel/3.11/embed/3/wheel.json')) [virtualenv\app_data\via_disk_folder.py:131]
py: 796 D got embed update of distribution %s from ('setuptools', WindowsPath('C:/Users/user/AppData/Local/pypa/virtualenv/wheel/3.11/embed/3/setuptools.json')) [virtualenv\app_data\via_disk_folder.py:131]
py: 796 D using periodically updated wheel C:\Users\user\AppData\Local\pypa\virtualenv\wheel\house\pip-23.2.1-py3-none-any.whl [virtualenv\seed\wheels\periodic_update.py:49]
py: 796 D using periodically updated wheel C:\Users\user\AppData\Local\pypa\virtualenv\wheel\house\wheel-0.41.0-py3-none-any.whl [virtualenv\seed\wheels\periodic_update.py:49]
py: 796 D using periodically updated wheel C:\Users\user\AppData\Local\pypa\virtualenv\wheel\house\setuptools-68.0.0-py3-none-any.whl [virtualenv\seed\wheels\periodic_update.py:49]
py: 796 D install pip from wheel C:\Users\user\AppData\Local\pypa\virtualenv\wheel\house\pip-23.2.1-py3-none-any.whl via CopyPipInstall [virtualenv\seed\embed\via_app_data\via_app_data.py:49]
py: 796 D install wheel from wheel C:\Users\user\AppData\Local\pypa\virtualenv\wheel\house\wheel-0.41.0-py3-none-any.whl via CopyPipInstall [virtualenv\seed\embed\via_app_data\via_app_data.py:49]
py: 796 D install setuptools from wheel C:\Users\user\AppData\Local\pypa\virtualenv\wheel\house\setuptools-68.0.0-py3-none-any.whl via CopyPipInstall [virtualenv\seed\embed\via_app_data\via_app_data.py:49]
py: 796 D copy directory C:\Users\user\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\wheel-0.41.0-py3-none-any\wheel to C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\wheel [virtualenv\util\path\_sync.py:40]
py: 796 D copy directory C:\Users\user\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\pip-23.2.1-py3-none-any\pip to C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\pip [virtualenv\util\path\_sync.py:40]
py: 796 D copy C:\Users\user\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\distutils-precedence.pth to C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\distutils-precedence.pth [virtualenv\util\path\_sync.py:40]
py: 812 D copy directory C:\Users\user\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\pkg_resources to C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\pkg_resources [virtualenv\util\path\_sync.py:40]
py: 843 D copy directory C:\Users\user\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\wheel-0.41.0-py3-none-any\wheel-0.41.0.dist-info to C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\wheel-0.41.0.dist-info [virtualenv\util\path\_sync.py:40]
py: 859 D copy C:\Users\user\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\wheel-0.41.0-py3-none-any\wheel-0.41.0.virtualenv to C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\wheel-0.41.0.virtualenv [virtualenv\util\path\_sync.py:40]
py: 875 D copy directory C:\Users\user\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\setuptools to C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\setuptools [virtualenv\util\path\_sync.py:40]
py: 875 D generated console scripts wheel3.11.exe wheel.exe wheel-3.11.exe wheel3.exe [virtualenv\seed\embed\via_app_data\pip_install\base.py:43]
py: 1109 D copy directory C:\Users\user\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\setuptools-68.0.0.dist-info to C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\setuptools-68.0.0.dist-info [virtualenv\util\path\_sync.py:40]
py: 1109 D copy C:\Users\user\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\setuptools-68.0.0.virtualenv to C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\setuptools-68.0.0.virtualenv [virtualenv\util\path\_sync.py:40]
py: 1109 D copy directory C:\Users\user\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\_distutils_hack to C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\_distutils_hack [virtualenv\util\path\_sync.py:40]
py: 1125 D generated console scripts  [virtualenv\seed\embed\via_app_data\pip_install\base.py:43]
py: 1468 D copy directory C:\Users\user\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\pip-23.2.1-py3-none-any\pip-23.2.1.dist-info to C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\pip-23.2.1.dist-info [virtualenv\util\path\_sync.py:40]
py: 1468 D copy C:\Users\user\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\pip-23.2.1-py3-none-any\pip-23.2.1.virtualenv to C:\Users\user\github\beeware\toga\tmop\.tox\py\Lib\site-packages\pip-23.2.1.virtualenv [virtualenv\util\path\_sync.py:40]
py: 1484 D generated console scripts pip3.exe pip3.11.exe pip-3.11.exe pip.exe [virtualenv\seed\embed\via_app_data\pip_install\base.py:43]
py: 1484 I add activators for Bash, Batch, Fish, Nushell, PowerShell, Python [virtualenv\run\session.py:63]
py: 1484 D write C:\Users\user\github\beeware\toga\tmop\.tox\py\pyvenv.cfg [virtualenv\create\pyenv_cfg.py:32]
py: 1484 D      home = C:\Users\user\.pyenv\pyenv-win\versions\3.11.3 [virtualenv\create\pyenv_cfg.py:36]
py: 1484 D      implementation = CPython [virtualenv\create\pyenv_cfg.py:36]
py: 1484 D      version_info = 3.11.3.final.0 [virtualenv\create\pyenv_cfg.py:36]
py: 1484 D      virtualenv = 20.25.0 [virtualenv\create\pyenv_cfg.py:36]
py: 1484 D      include-system-site-packages = false [virtualenv\create\pyenv_cfg.py:36]
py: 1484 D      base-prefix = C:\Users\user\.pyenv\pyenv-win\versions\3.11.3 [virtualenv\create\pyenv_cfg.py:36]
py: 1484 D      base-exec-prefix = C:\Users\user\.pyenv\pyenv-win\versions\3.11.3 [virtualenv\create\pyenv_cfg.py:36]
py: 1484 D      base-executable = C:\Users\user\.pyenv\pyenv-win\versions\3.11.3\python.exe [virtualenv\create\pyenv_cfg.py:36]
py: 1500 W commands[0]> command "path\to\trailing\sep -b" foo [tox\tox_env\api.py:427]
py: 1500 C exit 2 (0.00 seconds) C:\Users\user\github\beeware\toga\tmop> command "path\to\trailing\sep -b" foo [tox\execute\api.py:280]
  py: FAIL code 2 (1.14=setup[1.14]+cmd[0.00] seconds)
  evaluation failed :( (1.31 seconds)

Minimal example

[testenv:py]
commands =
    command path{/}to{/}trailing{/}sep{/} -b foo
@gaborbernat gaborbernat added the help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

No branches or pull requests

2 participants