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

"Permission denied" error for workdir when running client with different users #808

Closed
The-Compiler opened this issue Jul 15, 2020 · 3 comments

Comments

@The-Compiler
Copy link

On Debian 10, with devpi-client 5.2.0, py 1.9.0 and Python 3.7.7, I'm getting this when trying to run e.g. devpi upload with different user accounts:

Traceback (most recent call last):
  File "/opt/venv/lib/python3.7/site-packages/devpi/main.py", line 216, in _workdir
    return self.__workdir
AttributeError: 'Hub' object has no attribute '_Hub__workdir'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/venv/lib/python3.7/site-packages/py/_error.py", line 66, in checked_call
    return func(*args, **kwargs)
PermissionError: [Errno 13] Permission denied: '17952' -> '/tmp/devpi4/.lock'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/venv/bin/devpi", line 10, in <module>
    sys.exit(main())
  File "/opt/venv/lib/python3.7/site-packages/devpi/main.py", line 36, in main
    return method(hub, hub.args)
  File "/opt/venv/lib/python3.7/site-packages/devpi/upload.py", line 35, in main
    uploadbase = hub.getdir("upload")
  File "/opt/venv/lib/python3.7/site-packages/devpi/main.py", line 211, in getdir
    return self._workdir.mkdir(name)
  File "/opt/venv/lib/python3.7/site-packages/devpi/main.py", line 218, in _workdir
    self.__workdir = py.path.local.make_numbered_dir(prefix="devpi")
  File "/opt/venv/lib/python3.7/site-packages/py/_path/local.py", line 943, in make_numbered_dir
    create_lockfile(path)
  File "/opt/venv/lib/python3.7/site-packages/py/_path/local.py", line 866, in create_lockfile
    lockfile.mksymlinkto(str(mypid))
  File "/opt/venv/lib/python3.7/site-packages/py/_path/local.py", line 87, in mksymlinkto
    py.error.checked_call(os.symlink, str(value), self.strpath)
  File "/opt/venv/lib/python3.7/site-packages/py/_error.py", line 86, in checked_call
    raise cls("%s%r" % (func.__name__, args))
py.error.EACCES: [Permission denied]: symlink('17952', '/tmp/devpi4/.lock')

I think what's happening is that devpi tries to re-use the same temporary directory when a directory already exists from a different users.

Perhaps this is something that should be fixed in pylib's make_numbered_dir? On the other hand, pytest uses pytest-of-{username} as subdir name, so maybe devpi should do the same which would fix this issue?

@fschulze
Copy link
Contributor

Same cause as for #807 I think. I will look at what pytest is doing.

@The-Compiler
Copy link
Author

Indeed, that looks like the same thing. Sorry, I didn't notice that and only searched for parts of the stacktrace.

@fschulze
Copy link
Contributor

fschulze commented Apr 4, 2021

I guess pytest-dev/pytest#8414 is the same, as the code was initially the same.

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

No branches or pull requests

2 participants