URL:
https://github.com/SSSD/sssd/pull/5636
Title: #5636: Improve assertion when verifying paths for Python modules
elkoniu commented:
"""
If I understand this test cases correctly the steps are (based on `pyhbac` usecase):
1) Create temporary `MODPATH` subdirectory under `TEST_DIR`
2) Depending on python version make symbolic link to correct `pyhbac.so` version in the
`MODPATH` directory
3) Import `pyhbac`
4) Confirm that imported `pyhbac` module path is the same as created `pyhbac.so` symlink
path.
What `chroot` breaks is injection of prefix `/<<PKGBUILDDIR>>/build/` into
loaded module path.
By using `realpath()` you forcing following symbolic links for both: chroot path and the
link we created in steep (2).
I think functionally it is correct. What I am wondering is, if we should detect and thread
chroot environment special here.
For example instead of calling `realpath()` - subtract "chroot" piece from
`module.__file__`.
Can you check if any module loaded into chroot environment will have this chroot-specific
prefix added to `module.__file__`? Maybe this should be addressed in Python directly.
"""
See the full comment at
https://github.com/SSSD/sssd/pull/5636#issuecomment-843620673