RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1945455 - macros.forge expands git timestamps twice
Summary: macros.forge expands git timestamps twice
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: redhat-rpm-config
Version: CentOS Stream
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: beta
: ---
Assignee: Michal Domonkos
QA Contact: Tomáš Bajer
URL:
Whiteboard:
Depends On: 1774139
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-01 00:48 UTC by Michel Lind
Modified: 2021-11-05 16:54 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-05 16:54:22 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)

Description Michel Lind 2021-04-01 00:48:50 UTC
Description of problem:
When building gnome-shell-extension-argos on EPEL8, the commit information is recorded twice in %release

Version-Release number of selected component (if applicable):
redhat-rpm-config-123-1.el8.noarch

How reproducible:
Always

Steps to Reproduce:
1. fedpkg clone -a gnome-shell-extension-argos
2. cd gnome-shell-extension-argos
3. fedpkg srpm

Actual results:
gnome-shell-extension-argos-3-5.20210326git23718a8.20210326git23718a8.el8

see https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-8437bf9382

Expected results:
gnome-shell-extension-argos-3-5.20200505git23718a8.el8

see https://bodhi.fedoraproject.org/updates/FEDORA-2021-7a9ed18fd4


Additional info:

Comment 1 Michel Lind 2021-04-01 00:54:37 UTC
Also note that the %date macro is not honored, and %forgemeta just uses the current date.

Comment 2 Michal Domonkos 2021-11-05 16:54:22 UTC
The reason the timestamp gets duplicated in %{dist} is that rpmbuild actually parses the spec file *twice* (reason: implementation details, not important here) which the %forgemeta macro (defined in /usr/lib/rpm/macros.d/macros.forge) doesn't account for.  Since it prepends the timestamp to the existing %{dist} value, when it's called the second time during rpmbuild, it reuses the previous value with the timestamp already in it, hence duplicating it.

Fixing this in %forgemeta would be quite difficult (if not impossible) without running the risk of breaking existing specs out there.  The original %{dist} value ("el8" in this case) has to be retained as a suffix so we have to read it first.  The thing is, we can't tell whether the timestamp was already prepended or not due to a previous call of this macro (technically, we can, of course, but that would be a dirty solution).  Upstream, this macro was recently completely revamped and it no longer seems to cause this issue, but we don't want to rebase the macro in RHEL-8 as that, as mentioned, could cause regressions.

Luckily, as it turns out, this can be very easily worked around; just move the %forgemeta call to *after* the %{dist} macro usage, i.e. after the Release: tag in the spec file.  The exact mechanics of why this works are unknown to me - perhaps it's because the Release: tag is only applied during the first spec pass.  I've also seen other package specs utilizing %forgemeta do the exact same thing.  In fact, I've tried this with the gnome-shell-extension-argos-3-5 version of the spec file mentioned in Comment 0 and it fixed the problem.

As for the date discrepancy mentioned in Comment 1, that's actually completely unrelated to this.  In fact, it doesn't even work in RHEL-8 at the moment - the %date macro isn't read in %forgemeta at all.  Instead, the tarball's mtime is used.  Support for %date was only added later and the patch isn't in RHEL-8.  While adding it into RHEL-8 wouldn't be too hard, unless it's going to be generally useful, we'd rather not backport random features.

Therefore, I'm closing this bug as WONTFIX.  If you'd like to see the %date feature backported, please reopen this BZ or file a new one.  Thanks!


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