tox icon indicating copy to clipboard operation
tox copied to clipboard

tox4: infinite recursivity if any plugin is added to requires (regression)

Open ssbarnea opened this issue 2 years ago • 1 comments

Calling tox with tox 4 will produce an infinite loop, something that is not happening with tox 3.

[tox]
# adding any tox plugin below would trigger the recursive bug when calling tox
requires =
    tox-gh-actions
    # tox-extra

[testenv]
commands =
    tox --showconfig
deps = tox>=4.0.0b2

I do need to call tox from within an environment as I am testing some integration with it as my tool does parse the output of tox --showconfig. That worked fine for tox 3 but seems to fail with tox 4.

It seems that what is causing the loop is the requires =, as it puts tox into a loop of truing to provision itself:

  File "/Users/ssbarnea/c/a/zzz/.tox/.tox/.tox/.tox/.tox/.tox/.tox/.tox/lib/python3.10/site-packages/tox/tox_env/python/pip/req/file.py", line 14, in <module>
    import chardet
  File "/Users/ssbarnea/c/a/zzz/.tox/.tox/.tox/.tox/.tox/.tox/.tox/.tox/lib/python3.10/site-packages/chardet/__init__.py", line 19, in <module>
    from .universaldetector import UniversalDetector
  File "/Users/ssbarnea/c/a/zzz/.tox/.tox/.tox/.tox/.tox/.tox/.tox/.tox/lib/python3.10/site-packages/chardet/universaldetector.py", line 48, in <module>
    from .sbcsgroupprober import SBCSGroupProber
  File "/Users/ssbarnea/c/a/zzz/.tox/.tox/.tox/.tox/.tox/.tox/.tox/.tox/lib/python3.10/site-packages/chardet/sbcsgroupprober.py", line 37, in <module>
    from .langrussianmodel import (IBM855_RUSSIAN_MODEL, IBM866_RUSSIAN_MODEL,
KeyboardInterrupt

ssbarnea avatar May 06 '22 16:05 ssbarnea

IMHO, this is likely not caused by the plugins themselves and only by the presence of requires. What is likely happening is that when tox is called from within a virtualenv it will happen while the current directory is proj/.tox instead of prof and it attempts to reprovision itself while using this folder as root. We can guess that this will produce an endless loop of reprovisioning.

What we are likely to need is to ensure that once provisioned, we re-use it and not attempt to do it again, or at least ensure that we do not try to provision to wrong folder.

ssbarnea avatar May 19 '22 07:05 ssbarnea