Description of problem:
FileNotFoundError on Fedora 28 (default Docker container).
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. $ docker run -it registry.fedoraproject.org/fedora:28
2. get spec file, e.g. `rpmlint.spec`
3. $ rpmlint rpmlint.spec
Traceback (most recent call last):
File "/usr/bin/rpmlint", line 378, in <module>
File "/usr/bin/rpmlint", line 99, in main
File "/usr/bin/rpmlint", line 80, in loadCheck
File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/share/rpmlint/TagsCheck.py", line 405, in <module>
VALID_GROUPS = Pkg.get_default_valid_rpmgroups()
File "/usr/share/rpmlint/Pkg.py", line 227, in get_default_valid_rpmgroups
groupsfiles = [x for x in p.files() if x.endswith('/GROUPS')]
File "/usr/share/rpmlint/Pkg.py", line 616, in files
File "/usr/share/rpmlint/Pkg.py", line 721, in _gatherFilesInfo
fd = os.open(pkgfile.path, os.O_RDONLY)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/locale/ar/LC_MESSAGES/rpm.mo'
❯ rpm -qf /usr/share/locale/ar/LC_MESSAGES/rpm.mo
How is it that rpm is not installed? It is in the dependency chain of the rpmlint package (rpm-python3 -> python3-rpm -> librpm -> rpm-libs -> rpm).
This looks to be due to the container images overriding the install language with an rpm macro (to reduce the size of the images, surely).
# cat /etc/rpm/macros.image-language-conf
Moving that file aside and reinstalling rpm install the rpm.mo language files.
I don't know how to best handle that. It's probably best if rpmlint handles these missing files more gracefully.
Viliam, if you want to quickly work around this, update your rpmlint config like this:
echo 'setOption("ValidGroups", "")' >> /etc/rpmlint/config
Details on why follow.
This was fun (for some strange definition of fun, that is). I poked around at this with Jason in IRC. What we found is that rpmlint tries to enumerate all the files within the rpm package so that it can find the GROUPS file. It then parses that file to determine ValidGroups used in the non-standard-groups check.
As rpm in Fedora no longer contains a GROUPS file, the list is effectively empty anyway. Out guidelines suggest skipping the Group: tag as well, so this test is of little value. Ideally we'd add a check for the presence of the the Group: tag, but that's a feature for another day.
To resolve this issue easily, set the ValidGroups variable to an empty list. This causes rpmlint to skip looking for the GROUPS file in rpm and sidesteps the failures due to missing files in the container image. That check in the Pkg class could stand to be improved, though exactly how it should be improved without complaining when files are unexpectedly missing is an open question.
If no one objects, I'll put the ValidGroups definition into the default rpmlint config we ship in Fedora. It's effectively what we do already, since there is no GROUPS file.
I also submitted a more general fix to upstream rpmlint:
We only hit this issue on f28 because of a tightening of catch-all exceptions that is part of b1742cd ("cleanup flake errors", 2018-04-17). On f27 the catch-all exception allows failures parsing the rpm package to pass without any user-visible error.
rpmlint-1.10-12.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-9f603e1981
Shortly after I submitted the PR from my previous comment, I looked to see if I could fix the deeper error in handling missing files (due to nodocs, %_install_langs, etc.). It was then that I discovered that there was already a fix upstream. That fix is what I applied in rpmlint-1.10-12.fc28.
(In reply to Todd Zullinger from comment #3)
> Viliam, if you want to quickly work around this, update your rpmlint config
> like this:
> echo 'setOption("ValidGroups", "")' >> /etc/rpmlint/config
Thank you Todd! It worked.
I will test the update once it gets into testing.
rpmlint-1.10-12.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-9f603e1981
rpmlint-1.10-12.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.