rpm-software-management / rpmlint

Tool for checking common errors in rpm packages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

only-non-binary-in-usr-lib reported for systemd files

cyungmann opened this issue · comments

I have an RPM that packages a systemd service unit file (to be installed under /usr/lib/systemd/system/) and a systemd preset file (to be installed under /usr/lib/systemd/system-preset/). When I run rpmlint on the RPM I get only-non-binary-in-usr-lib. I assume that the warning is for one or both of these files as they are the only ones being installed to /usr/lib/ (though it would be nice if the warning would mention the problematic file). I see in rpmlint/configdefaults.toml that there is a setting for UsrLibBinaryException, but it does not include the systemd directory. Should it?

This seems similar to https://bugzilla.redhat.com/show_bug.cgi?id=794777

$ rpmlint --version
2.4.0
$ cat /etc/os-release
NAME="Fedora Linux"
VERSION="37 (Container Image)"
ID=fedora
VERSION_ID=37
VERSION_CODENAME=""
PLATFORM_ID="platform:f37"
PRETTY_NAME="Fedora Linux 37 (Container Image)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:37"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f37/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=37
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=37
SUPPORT_END=2023-11-14
VARIANT="Container Image"
VARIANT_ID=container

Please attach here the problematic rpm file.

Note we disable the warning in openSUSE distribution with:

'only-non-binary-in-usr-lib',

Maybe Fedora needs to follow the settings as well.

GitHub doesn't seem to allow attaching an RPM file to an issue comment. I get a "We don't support that file type." error. Here is a minimal repro spec file, though (note that the resulting RPM has other issues, but I'm just concerned with only-non-binary-in-usr-lib):

Name: foo
Version: 0.0.1
Release: 1
Summary: Foo
License: MIT
BuildRequires: systemd-rpm-macros
Source0: %{name}.service
Source1: 00-%{name}.preset

%description
Foo.

%prep

%build

%install
%__install -d %{buildroot}%{_unitdir} %{buildroot}%{_presetdir}
%__install --mode=644 %SOURCE0 %{buildroot}%{_unitdir}/
%__install --mode=644 %SOURCE1 %{buildroot}%{_presetdir}/

%files
%{_unitdir}/%{name}.service
%{_presetdir}/00-%{name}.preset

GitHub doesn't seem to allow attaching an RPM file to an issue comment. I get a "We don't support that file type." error.

Sure, it's a known limitation:
https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files

You have to use a ZIP format (.tgz or so). Anyway, as already mentioned, we as openSUSE ignore the check, so it's something Fedora might consider ignoring as well.

foo.tar.gz

Is there some reason not to update rpmlint/configdefaults.toml, perhaps by modifying UsrLibBinaryException?

That's something you would need to discuss with Fedora folks (@Conan-Kudo). Note our configdefaults.toml does not set any Filter, it enables all checks by default. It's up to the distro configurations to override it.

@marxin why did you close this as completed? I was not necessarily suggesting modifying the output filters in configdefaults.toml but rather the regex for UsrLibBinaryException. Is that not acceptable for some reason?

Sorry for that. Yes, the modification of UsrLibBinaryException should work here, please make a pull request.

Thank you, @marxin. I opened a PR.