tox-dev / filelock

A platform-independent file lock for Python.

Home Page:https://py-filelock.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Today after after this change poetry installs in Docker/Podman containers started to fail (it depends on filelock which was bumped from 3.10.0 to 3.10.12), from our CI log:

gaborbernat opened this issue · comments

          Today after after this change poetry installs in Docker/Podman containers started to fail (it depends on filelock which was bumped from 3.10.0 to 3.10.12), from our CI log:
$ pip install --user poetry

Successfully installed <...> filelock-3.10.2 <...>

$ $HOME/.local/bin/poetry env use python3.8
Creating virtualenv <...>-YGs9DcwD-py3.8 in /home/workspace/.cache/pypoetry/virtualenvs
failed to build image pip, wheel, setuptools because:
Traceback (most recent call last):
  File "/home/workspace/.local/lib/python3.10/site-packages/virtualenv/seed/embed/via_app_data/via_app_data.py", line 52, in _install
    with parent.non_reentrant_lock_for_key(wheel_img.name):
  File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/home/workspace/.local/lib/python3.10/site-packages/virtualenv/util/lock.py", line 146, in non_reentrant_lock_for_key
    with _CountedFileLock(str(self.path / f"{name}.lock")):
  File "/home/workspace/.local/lib/python3.10/site-packages/filelock/_api.py", line 227, in __enter__
    self.acquire()
  File "/home/workspace/.local/lib/python3.10/site-packages/virtualenv/util/lock.py", line 29, in acquire
    super().acquire(timeout, poll_interval)
  File "/home/workspace/.local/lib/python3.10/site-packages/filelock/_api.py", line 182, in acquire
    self._acquire()
  File "/home/workspace/.local/lib/python3.10/site-packages/filelock/_unix.py", line 36, in _acquire
    os.chmod(fd, self._mode)
PermissionError: [Errno 1] Operation not permitted: 3

The only w/a is after installing poetry forcefully downgrading filelock to <= 3.10.1

Originally posted by @xiormeesh in #206 (comment)

cc @jahrules perhaps we should put this change request in try/cache?

@xiormeesh can you post a docker image reproducing this?

cc @jahrules perhaps we should put this change request in try/cache?

Yep. I suspect what's happening is that now it's trying to modify permissions of files in doesn't own. Putting this in a try catch will resolve this quickly. I'll have the fix ready within an hour

Image is https://quay.io/repository/ccxdev/ccx-builder-py?tab=tags&tag=latest, if fix @jahrules has in mind won't help I'll try to prepare a simpler reproducer tomorrow/next week, that image is indeed quite loaded (it's out multi-purpose CI image based on ubi8). If we are the only ones having this issue I'll dig deeper if something in our image is triggering that. But yeah, same image works if we force downgrading filelock to 3.10.0.

Fixed