diff --git a/docs/changelog/2182.bugfix.txt b/docs/changelog/2182.bugfix.txt new file mode 100644 index 000000000..0f26a202b --- /dev/null +++ b/docs/changelog/2182.bugfix.txt @@ -0,0 +1,2 @@ +Fixed path collision that could lead to a PermissionError or writing to system +directories when using PyPy3.8 - by :user:`mgorny`. diff --git a/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py b/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py index be5319a2b..f740de963 100644 --- a/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py +++ b/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py @@ -44,6 +44,8 @@ def sources(cls, interpreter): host_lib = Path(interpreter.system_prefix) / "lib" if host_lib.exists() and host_lib.is_dir(): for path in host_lib.iterdir(): + if path.is_dir(): + continue yield PathRefToDest(path, dest=cls.to_lib)