containers / udica

This repository contains a tool for generating SELinux security profiles for containers
GNU General Public License v3.0
488 stars 47 forks source link

Pip installs templates in wrong place #59

Closed gatoniel closed 4 years ago

gatoniel commented 4 years ago

Describe the bug pip install udica puts the data_files (/usr/share/udica/templates/*.cil) in the wrong place. pip install git+https://github.com/containers/udica works fine.

To Reproduce Steps to reproduce the behavior:

  1. pip install udica then pip uninstall udica gives these file listing:

Uninstalling udica-0.2.1: /usr/local/bin/udica /usr/local/lib/python3.6/site-packages/udica-0.2.1.dist-info/INSTALLER /usr/local/lib/python3.6/site-packages/udica-0.2.1.dist-info/LICENSE /usr/local/lib/python3.6/site-packages/udica-0.2.1.dist-info/METADATA /usr/local/lib/python3.6/site-packages/udica-0.2.1.dist-info/RECORD /usr/local/lib/python3.6/site-packages/udica-0.2.1.dist-info/WHEEL /usr/local/lib/python3.6/site-packages/udica-0.2.1.dist-info/entry_points.txt /usr/local/lib/python3.6/site-packages/udica-0.2.1.dist-info/top_level.txt /usr/local/lib/python3.6/site-packages/udica/init.py /usr/local/lib/python3.6/site-packages/udica/main.py /usr/local/lib/python3.6/site-packages/udica/pycache/init.cpython-36.pyc /usr/local/lib/python3.6/site-packages/udica/pycache/main.cpython-36.pyc /usr/local/lib/python3.6/site-packages/udica/pycache/parse.cpython-36.pyc /usr/local/lib/python3.6/site-packages/udica/pycache/perms.cpython-36.pyc /usr/local/lib/python3.6/site-packages/udica/pycache/policy.cpython-36.pyc /usr/local/lib/python3.6/site-packages/udica/parse.py /usr/local/lib/python3.6/site-packages/udica/perms.py /usr/local/lib/python3.6/site-packages/udica/policy.py /usr/local/lib/python3.6/site-packages/usr/share/licenses/udica/LICENSE /usr/local/lib/python3.6/site-packages/usr/share/udica/ansible/deploy-module.yml /usr/local/lib/python3.6/site-packages/usr/share/udica/templates/base_container.cil /usr/local/lib/python3.6/site-packages/usr/share/udica/templates/config_container.cil /usr/local/lib/python3.6/site-packages/usr/share/udica/templates/home_container.cil /usr/local/lib/python3.6/site-packages/usr/share/udica/templates/log_container.cil /usr/local/lib/python3.6/site-packages/usr/share/udica/templates/net_container.cil /usr/local/lib/python3.6/site-packages/usr/share/udica/templates/tmp_container.cil /usr/local/lib/python3.6/site-packages/usr/share/udica/templates/tty_container.cil /usr/local/lib/python3.6/site-packages/usr/share/udica/templates/virt_container.cil /usr/local/lib/python3.6/site-packages/usr/share/udica/templates/x_container.cil Proceed (y/n)? y Successfully uninstalled udica-0.2.1

  1. pip install git+https://github.com/containers/udica and then pip uninstall udica gives the correct listing:

Uninstalling udica-0.2.1: /usr/local/bin/udica /usr/local/lib/python3.6/site-packages/udica-0.2.1-py3.6.egg-info /usr/local/lib/python3.6/site-packages/udica/init.py /usr/local/lib/python3.6/site-packages/udica/main.py /usr/local/lib/python3.6/site-packages/udica/pycache/init.cpython-36.pyc /usr/local/lib/python3.6/site-packages/udica/pycache/main.cpython-36.pyc /usr/local/lib/python3.6/site-packages/udica/pycache/parse.cpython-36.pyc /usr/local/lib/python3.6/site-packages/udica/pycache/perms.cpython-36.pyc /usr/local/lib/python3.6/site-packages/udica/pycache/policy.cpython-36.pyc /usr/local/lib/python3.6/site-packages/udica/parse.py /usr/local/lib/python3.6/site-packages/udica/perms.py /usr/local/lib/python3.6/site-packages/udica/policy.py /usr/share/licenses/udica/LICENSE /usr/share/udica/ansible/deploy-module.yml /usr/share/udica/templates/base_container.cil /usr/share/udica/templates/config_container.cil /usr/share/udica/templates/home_container.cil /usr/share/udica/templates/log_container.cil /usr/share/udica/templates/net_container.cil /usr/share/udica/templates/tmp_container.cil /usr/share/udica/templates/tty_container.cil /usr/share/udica/templates/virt_container.cil /usr/share/udica/templates/x_container.cil Proceed (y/n)? y Successfully uninstalled udica-0.2.1

Expected behavior pip install udica should show the same behaviour as pip install git+https://github.com/containers/udica

Additional context

wrabcak commented 4 years ago

Hi @gatoniel , Thank you for issue report.

What is the version of pip and what distribution are you using?

On my Fedora-32, it works as expected:

# pip install udica 
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip install --user` instead.
Collecting udica
  Using cached https://files.pythonhosted.org/packages/f8/a2/fc4acc53ea6efce2f3b85720d8de36ce834faf12289ccefb54d8ad9117cb/udica-0.2.1.tar.gz
Installing collected packages: udica
    Running setup.py install for udica ... done
Successfully installed udica-0.2.1

# ls /usr/share/udica/templates/
base_container.cil    home_container.cil  net_container.cil  tty_container.cil   x_container.cil
config_container.cil  log_container.cil   tmp_container.cil  virt_container.cil
gatoniel commented 4 years ago

Hi,

I am on CentOS 8 and was using an old pip version (9.0.3), so I updated to 20.1.1 (pip 20.1.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)). When I use pip install udica --no-cache-dir it works fine. But using pip install udica puts the templates in the wrong place... Maybe this is more of a pip problem or there is just one bad package in my cache.

wrabcak commented 4 years ago

Hi @gatoniel, For me it works as expected also on RHEL-8.

# rpm -q python3-pip
python3-pip-9.0.3-16.el8.noarch

# # ls /usr/share/udica/templates/
base_container.cil    home_container.cil  net_container.cil  tty_container.cil   x_container.cil
config_container.cil  log_container.cil   tmp_container.cil  virt_container.cil

I don't see any issue in setup files. I'll close this ticket, if you find some reproducer, I'm happy to help.