Bug 2248571 - fedora-review false negative on systemd macro usage
Summary: fedora-review false negative on systemd macro usage
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: fedora-review
Version: 38
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Neal Gompa
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-11-07 19:03 UTC by Jerry James
Modified: 2024-05-31 08:58 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-05-31 08:58:53 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jerry James 2023-11-07 19:03:19 UTC
I am reviewing bug 2244378.  Fedora-review says:

- systemd_user_post is invoked in %post and systemd_user_preun in %preun
  for Systemd user units service files.
  Note: Systemd user unit service file(s) in xdg-desktop-portal-hyprland
  See: https://docs.fedoraproject.org/en-US/packaging-
  guidelines/Scriptlets/#_user_units

which is wrong, because the spec file has exactly what it is asking for:

%post
%systemd_user_post %{name}.service

%preun
%systemd_user_preun %{name}.service

I stepped through the python code in /usr/share/fedora-review/plugins/generic.py, CheckSystemdUserunitdirScriplets.run.  At the point where the regular expression searches are tried, str(rpmpkg.post) is:

'\n \nif [ $1 -eq 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then \n    # Initial installation \n    /usr/lib/systemd/systemd-update-helper install-user-units xdg-desktop-portal-hyprland.service || : \nfi'

The call to rpm.expandMacro("%systemd_user_post .*.service") on the other hand, produces this:

'\n \nif [ $1 -eq 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then \n    # Initial installation \n    /usr/lib/systemd/systemd-update-helper install-user-units .*.service || : \nfi \n'

Notice that has an extra ' \n' at the end.  I see that systemd_user_post_re is altered by taking a slice: [2:].  Should that remove the *final* 2 characters instead of the *initial* 2 characters?

Reproducible: Always

Steps to Reproduce:
1. fedora-review -b 2244378 -m fedora-rawhide-x86_64
2.
3.
Actual Results:  
Fedora-review complains about missing systemd scriptlets that are not, in fact, missing.

Expected Results:  
No complaints, since the systemd scripts are present.

Comment 1 Aoife Moloney 2024-05-31 08:58:53 UTC
Fedora Linux 38 entered end-of-life (EOL) status on 2024-05-21.

Fedora Linux 38 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.