[Rpm-maint] [rpm-software-management/rpm] rpmuncompress misdetects single-root archives when the top-level directory entry has no trailing slash (Issue #4182)
jialin
notifications at github.com
Thu Apr 16 06:48:14 UTC 2026
yyjeqhc created an issue (rpm-software-management/rpm#4182)
**Describe the bug**
`rpmuncompress -x -C <dst>` incorrectly detects some valid single-root source archives as not having a single top-level directory.
The problem is in `singleRoot()`: it reads the first archive entry and assumes that a single-root archive must have a `/` in that entry's pathname. If the first entry is a top-level directory stored as `foo` instead of `foo/`, the function returns `NULL`, and `doUntar()` does not apply `--strip-components=1`.
As a result, archives can be extracted with an extra directory level.
A concrete example is `Devel-CallChecker-0.009.tar.gz`, whose first entry is stored as:
```text
Devel-CallChecker-0.009
```
instead of:
```text
Devel-CallChecker-0.009/
```
This causes rpmuncompress to treat it differently from archives such as IO-String-1.08.tar.gz, where the first entry is explicitly stored with a trailing slash.
**To Reproduce**
In our OBS.
https://pickaxe.oerv.ac.cn/package/live_build_log/home:yyjeqhc/perl-Devel-CallChecker/x64/x86_64
```sh
[ 33s] + pwd
[ 33s] /home/abuild/rpmbuild/BUILD/perl-Devel-CallChecker-0.009-build/perl-Devel-CallChecker-0.009
[ 33s] + perl Build.PL --installdirs=vendor 'optimize=-O2 -g -fno-omit-frame-pointer -pipe -flto=auto -ffat-lto-objects -funwind-tables -fasynchronous-unwind-tables -fstack-protector-strong -D_FORTIFY_SOURCE=3 -fstack-clash-protection -Wformat -Werror=format-security'
[ 33s] Can't open perl script "Build.PL": No such file or directory
```
perl-Devel-CallChecker builds fail.
https://pickaxe.oerv.ac.cn/package/live_build_log/home:yyjeqhc/perl-IO-String/x64/x86_64
perl-IO-String builds successfully.
**Expected behavior**
Both of the above archives should be recognized as single-root archives.
That is:
a top-level directory entry stored as foo/
and a top-level directory entry stored as foo
should be treated equivalently if the first entry is a directory and all archive members belong to the same top-level directory.
rpmuncompress should strip the top-level directory in both cases when extracting with -x -C <dst>.
**Output**
```text
[ 33s] + /usr/lib/rpm/rpmuncompress -x -C perl-Devel-CallChecker-0.009 /home/abuild/rpmbuild/SOURCES/Devel-CallChecker-0.009.tar.gz
[ 33s] + STATUS=0
[ 33s] + '[' 0 -ne 0 ']'
[ 33s] + cd perl-Devel-CallChecker-0.009
[ 33s] + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
[ 33s] + RPM_EC=0
[ 33s] ++ jobs -p
[ 33s] + exit 0
[ 33s] Executing(%conf): /usr/bin/bash -e /var/tmp/rpm-tmp.ioaeHZ
[ 33s] + umask 022
[ 33s] + cd /home/abuild/rpmbuild/BUILD/perl-Devel-CallChecker-0.009-build
[ 33s] + cd perl-Devel-CallChecker-0.009
[ 33s] + RPM_EC=0
[ 33s] ++ jobs -p
[ 33s] + exit 0
[ 33s] Executing(%build): /usr/bin/bash -e /var/tmp/rpm-tmp.mfgNB1
[ 33s] + umask 022
[ 33s] + cd /home/abuild/rpmbuild/BUILD/perl-Devel-CallChecker-0.009-build
[ 33s] + cd perl-Devel-CallChecker-0.009
[ 33s] + pwd
[ 33s] /home/abuild/rpmbuild/BUILD/perl-Devel-CallChecker-0.009-build/perl-Devel-CallChecker-0.009
[ 33s] + perl Build.PL --installdirs=vendor 'optimize=-O2 -g -fno-omit-frame-pointer -pipe -flto=auto -ffat-lto-objects -funwind-tables -fasynchronous-unwind-tables -fstack-protector-strong -D_FORTIFY_SOURCE=3 -fstack-clash-protection -Wformat -Werror=format-security'
[ 33s] Can't open perl script "Build.PL": No such file or directory
[ 33s] error: Bad exit status from /var/tmp/rpm-tmp.mfgNB1 (%build)
```
**Environment**
- OS / Distribution: openRuyi
- Version rpm-4.20.0
**Additional context**
We are adding Perl buildsystem support. While testing the two packages, we found that the only relevant difference between them is whether the root archive entry is stored with a trailing slash (`/`) or not.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/4182
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/issues/4182 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20260415/54206698/attachment-0001.htm>
More information about the Rpm-maint
mailing list