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

Tox 4 interprets quoted hash in commands as comment start #2662

Closed
nsoranzo opened this issue Dec 9, 2022 · 4 comments
Closed

Tox 4 interprets quoted hash in commands as comment start #2662

nsoranzo opened this issue Dec 9, 2022 · 4 comments

Comments

@nsoranzo
Copy link

nsoranzo commented Dec 9, 2022

Issue

Using 'foo#bar' other as part of a command seems to truncate it as soon as the first hash is encountered (i.e. 'foo).

Environment

Provide at least:

  • OS: Ubuntu 20.04
  • pip list of the host Python where tox is installed: irrelevant

Output of running tox

...
py: commands[0]> sed -i ''"'"'s'
/bin/sed: -e expression #1, char 1: unknown command: `''
py: exit 1 (0.00 seconds) /usr/users/ga002/soranzon/software/nsoranzo_ephemeris> sed -i ''"'"'' pid=720035
.pkg: _exit> python /usr/users/ga002/soranzon/software/nsoranzo_ephemeris/.venv/lib/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
  py: FAIL code 1 (1.23=setup[1.23]+cmd[0.00] seconds)
  evaluation failed :( (1.28 seconds)

Minimal example

Minimal tox.ini to reproduce:

[testenv]
allowlist_externals = sed
commands = sed -i 's#/path/to#/newpath/to#' test.txt
nsoranzo added a commit to galaxyproject/ephemeris that referenced this issue Dec 9, 2022
@jugmac00
Copy link
Member

jugmac00 commented Dec 9, 2022

This is documented in https://tox.wiki/en/latest/faq.html#tox-4-changed-ini-rules

Your example would probably need to look like:

[testenv]
allowlist_externals = sed
commands = sed -i 's\#/path/to\#/newpath/to\#' test.txt

As you already know ( galaxyproject/ephemeris@f8e754f ) you can easily use a different marker/separator, e.g. |.

@jugmac00 jugmac00 closed this as completed Dec 9, 2022
@nsoranzo
Copy link
Author

nsoranzo commented Dec 9, 2022

Thanks for the quick reply. Search for hash in the documentation didn't help, maybe including it in the docs would make this more discoverable.

@jugmac00
Copy link
Member

jugmac00 commented Dec 9, 2022

@nsoranzo Makes sense! I created #2663

@nsoranzo
Copy link
Author

nsoranzo commented Dec 9, 2022

Great, thanks @jugmac00 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants