gvalkov / python-evdev

Python bindings for the Linux input subsystem
https://python-evdev.rtfd.org/
BSD 3-Clause "New" or "Revised" License
334 stars 112 forks source link

Wrong permission on files in EGG-INFO #136

Open bryantfhayes opened 4 years ago

bryantfhayes commented 4 years ago

After installing evdev with pip, other modules that do not have adequate permissions fail to read PKG_INFO file for python-evdev, with an error like: PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.5/site-packages/evdev-0.7.0-py3.5.egg-info/PKG-INFO'

Files in EGG-INFO showed permission like this.

ls -al /usr/lib/python3.5/site-packages/evdev-0.7.0-py3.5.egg-info/PKG-INFO total 40 drwxr-x---@ 7 guest staff 224 Jan 11 2020 . drwxr-x---@ 10 guest staff 320 Jan 11 2020 .. -rw-r-----@ 1 guest staff 1855 Jan 11 2020 PKG-INFO -rw-r-----@ 1 guest staff 401 Jan 11 2020 SOURCES.txt -rw-r-----@ 1 guest staff 1 Jan 11 2020 dependency_links.txt -rw-r-----@ 1 guest staff 6 Jan 11 2020 top_level.txt -rw-r-----@ 1 guest staff 1 Jan 11 2020 zip-safe

Shouldn't the PKG-INFO file have 644 permissions?

gvalkov commented 4 years ago

Hi @bryantfhayes,

I think that depends entirely on the umask and pip. Given two virtualenvs a1 and a2:

$ ( umask 0002 ; /tmp/a1/bin/python3 -m pip install evdev )
$ ls -lsh /tmp/a1/lib/python3.8/site-packages/evdev-1.3.0-py3.8.egg-info                                                                                     4.0K -rw-rw-r--. 1 gvalkov gvalkov    1 Oct  2 00:36 dependency_links.txt
4.0K -rw-rw-r--. 1 gvalkov gvalkov  904 Oct  2 00:36 installed-files.txt
4.0K -rw-rw-r--. 1 gvalkov gvalkov 1.9K Oct  2 00:36 PKG-INFO
4.0K -rw-rw-r--. 1 gvalkov gvalkov  401 Oct  2 00:36 SOURCES.txt
4.0K -rw-rw-r--. 1 gvalkov gvalkov    6 Oct  2 00:36 top_level.txt
4.0K -rw-rw-r--. 1 gvalkov gvalkov    1 Jan 11  2020 zip-safe

$ ( umask 0007 ; /tmp/a2/bin/python3 -m pip install evdev ) 
$ ls -lsh /tmp/a2/lib/python3.8/site-packages/evdev-1.3.0-py3.8.egg-info                                                                                     
4.0K -rw-rw----. 1 gvalkov gvalkov    1 Oct  2 00:36 dependency_links.txt
4.0K -rw-rw----. 1 gvalkov gvalkov  904 Oct  2 00:36 installed-files.txt
4.0K -rw-rw----. 1 gvalkov gvalkov 1.9K Oct  2 00:36 PKG-INFO
4.0K -rw-rw----. 1 gvalkov gvalkov  401 Oct  2 00:36 SOURCES.txt
4.0K -rw-rw----. 1 gvalkov gvalkov    6 Oct  2 00:36 top_level.txt
4.0K -rw-rw----. 1 gvalkov gvalkov    1 Jan 11  2020 zip-safe
bryantfhayes commented 4 years ago

Hi @gvalkov,

I should probably be more specific, that I am using version 0.7.0 as part of the Sumo Yocto release.

https://layers.openembedded.org/layerindex/recipe/83219/

Are you saying that this problem is addressed in v1.3.0? My assumption is that the pypi tarball for this version just happened to have lacking permissions.