Bug 1574509

Summary: No such file or directory: '/usr/share/locale/ar/LC_MESSAGES/rpm.mo' [rpmlint-1.10-11]
Product: [Fedora] Fedora Reporter: Viliam Križan <vkrizan>
Component: rpmlintAssignee: Tom "spot" Callaway <tcallawa>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 28CC: j, tcallawa, tmz, twoerner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpmlint-1.10-12.fc28 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-09 21:24:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Viliam Križan 2018-05-03 12:49:18 UTC
Description of problem:

FileNotFoundError on Fedora 28 (default Docker container).


Version-Release number of selected component (if applicable):
rpmlint-1.10-11

How reproducible:


Steps to Reproduce:
1. $ docker run -it registry.fedoraproject.org/fedora:28
2. get spec file, e.g. `rpmlint.spec`
3. $ rpmlint rpmlint.spec

Actual results:
~~~
Traceback (most recent call last):
  File "/usr/bin/rpmlint", line 378, in <module>
    main()
  File "/usr/bin/rpmlint", line 99, in main
    loadCheck(c)
  File "/usr/bin/rpmlint", line 80, in loadCheck
    importlib.import_module(name)
  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
    self._gatherFilesInfo()
  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'
~~~

Expected results:

No crash.


Thanks!

Comment 1 Jason Tibbitts 2018-05-03 16:38:40 UTC
❯ rpm -qf /usr/share/locale/ar/LC_MESSAGES/rpm.mo
rpm-4.14.1-8.fc28.x86_64

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).

Comment 2 Todd Zullinger 2018-05-03 16:55:35 UTC
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 
%_install_langs en_US

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.

Comment 3 Todd Zullinger 2018-05-03 18:50:05 UTC
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.

Comment 4 Todd Zullinger 2018-05-03 20:06:12 UTC
I also submitted a more general fix to upstream rpmlint:

    https://github.com/rpm-software-management/rpmlint/pull/132

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.

Comment 5 Fedora Update System 2018-05-04 05:28:09 UTC
rpmlint-1.10-12.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-9f603e1981

Comment 6 Todd Zullinger 2018-05-04 05:32:27 UTC
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.

Comment 7 Viliam Križan 2018-05-04 09:11:29 UTC
(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.

Comment 8 Fedora Update System 2018-05-06 10:07:14 UTC
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

Comment 9 Fedora Update System 2018-05-09 21:24:57 UTC
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.