Bug 2229984 - [regression] rpmuncompress calls an unpackaged binary when trying to extract .7z archives
Summary: [regression] rpmuncompress calls an unpackaged binary when trying to extract ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 39
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1546091
TreeView+ depends on / blocked
 
Reported: 2023-08-08 11:30 UTC by Dominik 'Rathann' Mierzejewski
Modified: 2023-09-18 00:15 UTC (History)
4 users (show)

Fixed In Version: rpm-4.18.92-3.fc40 rpm-4.18.99-1.fc39
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-09-18 00:15:51 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github rpm-software-management rpm issues 2608 0 None closed Regression on detecting 7zip helper utility 2023-08-15 20:00:44 UTC

Description Dominik 'Rathann' Mierzejewski 2023-08-08 11:30:21 UTC
In F39/rawhide, the /usr/lib/rpm/uncompress binary that rpmbuild invokes to extract source archives tries to call /usr/bin/7zip (rpm-build-4.18.92-1.fc39.x86_64 in F39) instead of /usr/bin/7a (rpm-build-4.18.1-3.fc38.x86_64 in F38) and fails, because it's not available in Fedora repositories.

It looks like the binary to call is supplied via macro (%{__7zip})[1][2] and rpm's cmake script[3] fails to find 7zip[4]:

INFO7zip got 7ZIP: __7ZIP-NOTFOUND

but doesn't[5] fail the build so rpm gets built pointing to a non-existent binary.

[1] https://github.com/rpm-software-management/rpm/blob/2043f2ac57ae2690cc1b11242f040085df8eed83/tools/rpmuncompress.c#L46
[2] https://github.com/rpm-software-management/rpm/blob/2043f2ac57ae2690cc1b11242f040085df8eed83/macros.in#L25
[3] https://github.com/rpm-software-management/rpm/blob/master/CMakeLists.txt#L76
[4] https://kojipkgs.fedoraproject.org//packages/rpm/4.18.92/1.fc39/data/logs/x86_64/build.log
[5] https://github.com/rpm-software-management/rpm/blob/master/CMakeLists.txt#L93

Reproducible: Always

Steps to Reproduce:
1. wget https://downloads.sourceforge.net/project/sevenzip/LZMA%20SDK/lzma2201.7z
2. /usr/lib/rpm/rpmuncompress -v -x lzma2201.7z

Actual Results:  
/usr/bin/7zip x  'lzma2201.7z'
sh: line 1: /usr/bin/7zip: No such file or directory


Expected Results:  
/usr/bin/7za x  'lzma2201.7z'

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=pl_PL.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz (806C1),ASM,AES-NI)

Scanning the drive for archives:
1 file, 1261282 bytes (1232 KiB)

Extracting archive: lzma2201.7z
--
Path = lzma2201.7z
Type = 7z
Physical Size = 1261282
Headers Size = 11755
Method = LZMA:22 BCJ2
Solid = +
Blocks = 3

Everything is Ok

Files: 693
Size:       5921595
Compressed: 1261282

/usr/bin/7zip doesn't exist in Fedora repositories:
# dnf install /usr/bin/7zip
Last metadata expiration check: 3:29:05 ago on Tue 08 Aug 2023 09:55:55 CEST.
No match for argument: /usr/bin/7zip
Error: Unable to find a match: /usr/bin/7zip

Before switching to cmake, rpm's configure script defaulted to /usr/bin/7za[1], so it worked out fine even if the binary wasn't around at configure time.

[1] https://github.com/rpm-software-management/rpm/blob/c10e2310e4c41a626b524ae71b3c4f87a29134b2/configure.ac#L75

Comment 1 Panu Matilainen 2023-08-10 08:11:57 UTC
Thanks for reporting. This is an upstream issue though so moved there for better tracking wrt releases and such: https://github.com/rpm-software-management/rpm/issues/2608

Comment 2 Dominik 'Rathann' Mierzejewski 2023-08-10 08:16:55 UTC
Thanks for looking at this so quickly!

Comment 3 Dominik 'Rathann' Mierzejewski 2023-08-15 20:01:47 UTC
Thanks for fixing this upstream, please add the missing BuildRequires: p7zip to the spec file, too.

Comment 4 Panu Matilainen 2023-08-16 06:53:46 UTC
Yeah, although I'm now wondering if having "7zip" in the list of things to try is right at all. It's there in the initial commit, but then it defaults to /usr/bin/7za when it doesn't find a command named "7zip". Even on Windows the command seems to be either 7z or 7za. And if we just drop the apparently non-existent 7zip from the thing-to-try list, it'll use a working default even without the otherwise pointless buildrequire.

Comment 5 Fedora Release Engineering 2023-08-16 08:14:03 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.

Comment 6 Panu Matilainen 2023-08-22 11:34:18 UTC
Fixed in rpm-4.18.92-3.fc40 but will need an update for f39 too.

Comment 7 Fedora Update System 2023-08-24 06:45:59 UTC
FEDORA-2023-d1971fb6db has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-d1971fb6db

Comment 8 Fedora Update System 2023-09-05 02:01:12 UTC
FEDORA-2023-067d943f23 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-067d943f23`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-067d943f23

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2023-09-18 00:15:51 UTC
FEDORA-2023-067d943f23 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.


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