Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2029877

Summary: rpmbuild strips path and overwrites multiple %doc and %license files
Product: Red Hat Enterprise Linux 8 Reporter: Nico Kadel-Garcia <nkadel>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED NOTABUG QA Contact: swm-qe
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.5CC: maxwell, pmatilai
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-08 08:28:58 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:
Attachments:
Description Flags
Reduced ansible.spec to trigger duplicate README.md or LICENSE.md issue none

Description Nico Kadel-Garcia 2021-12-07 14:15:18 UTC
Created attachment 1845077 [details]
Reduced ansible.spec to trigger duplicate README.md or LICENSE.md issue

Description of problem:
  If .spec files contains multiple %doc or %license files with identical basenames, only one is published in RPM. Publicaton of files are being automatically path stripped. This is new with RHEL 8 and Fedora, RHEL 7 did not have this issue.

Version-Release number of selected component (if applicable):
  rpm-build-4.14.3-19.el8.x86_64

How reproducible:
  Use source tarball with multiple README.md or LICENSE.md files, such as ansible-5.0.1.
  Build RPM from spec file.
  RPM contains only the last README.md in /usr/share/doc/%{name}/README.md

Steps to Reproduce:
1. Get .spec file from https://github.com/nkadel/README-ansible-srpm/blob/master/README-ansible.spec
2. Run 'spectool -g README-ansible.spec' to get ansible-5.0.1 tarball
3. Build RPM locally with: rpmbuild --define '_topdir $PWD/rpmbuild' \
	--rebuild src.rpm
'
4. See warning messages about README.md listed twice
5. Check rpmbuild/RPMS/x86_64/*.rpm for README.md files
   rpm -qlp  rpmbuild/RPMS/x86_64/*.rpm | grep /README.md

Actual results:
    /usr/share/doc/README-ansible/README.md


Expected results:
   ansible_collections/amazon/aws/README.md
   ansible_collections/ansible/netcommon/README.md
   ansible_collections/ansible/posix/.azure-pipelines/README.md
   ansible_collections/ansible/posix/README.md
   ansible_collections/ansible/utils/README.md
   ansible_collections/ansible/windows/README.md

Additional info:
   This also happens with the rpmbuild on RHEL 7, but is less obvious due to the lack of reports about duplicate files. Few packages have so many README.md files or LICENSE files with the same basename, but the new ansible 5.0.1 tarball has over 300 REAME.md files. The path stripping is unnecessary, and unwelcome for tools that may be composed of multiple bundled source repositories this way.

Comment 1 Panu Matilainen 2021-12-08 08:28:58 UTC
Contrary to the initial report in https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/QYZYBWYFTXVOSXBR7JTFWMHQHGF4LAOZ/ the behavior is the same on RHEL 7 so it's not a regression at all, this is entirely expected behavior.

So this is an RFE, and I don't see us addressing it in RHEL 8. Moving this to upstream https://github.com/rpm-software-management/rpm/issues/1855 but thanks for the report, the use-case is legit and would be good to better support it.

Comment 2 Nico Kadel-Garcia 2021-12-08 09:36:14 UTC
I've agreed elsewhere that I was mistaken, it's indeed happening on RHEL 7. It's less apparent there because there's not a report to the console about duplicate files. The RPM documentation on %spec or %license do not document the behavior.

I can understand wanting to not alter existing default behavior. I'll urge updating the documentation. while many treat a documented bug as a feature, the converse is that an unreported feature can and should be treated as a bug.

Providing a flag to disable this path stripping, similar to the flag for disabling debuginfo packages, could help resolve this for software suites with multiple README.md files.