Bug 1930096 - Unexpected shifting elfdepargs --filter-private
Summary: Unexpected shifting elfdepargs --filter-private
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm-mpi-hooks
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Sandro Mani
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1924665
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-02-18 11:07 UTC by Honggang LI
Modified: 2021-04-08 20:42 UTC (History)
5 users (show)

Fixed In Version: rpm-mpi-hooks-7-1.fc33 rpm-mpi-hooks-8-1.fc32
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1924665
Environment:
Last Closed: 2021-02-26 23:54:43 UTC
Type: Bug


Attachments (Terms of Use)

Description Honggang LI 2021-02-18 11:07:14 UTC
+++ This bug was initially created as a clone of Bug #1924665 +++

Description of problem:

``GLIBC_PRIVATE`` has not been filtered after defining ``%global __filter_GLIBC_PRIVATE 1``. 

Version-Release number of selected component (if applicable):

rpm-mpi-hooks-5-4.el8.noarch

How reproducible:

The spec can be found here at https://github.com/apache/incubator-brpc/blob/master/package/rpm/brpc.spec.

The output of ``rpmbuild`` show that it using ``mpi.req`` to generate requires info. And I find that ``--filter-private`` as the first argument has been shifted.


```
D: /home/xxx/BUILDROOT/brpc-0.9.8-3.el8.x86_64/usr/lib/.build-id: directory
D: /home/xxx/BUILDROOT/brpc-0.9.8-3.el8.x86_64/usr/lib/.build-id/a1: directory
D: /home/xxx/BUILDROOT/brpc-0.9.8-3.el8.x86_64/usr/lib/.build-id/a1/c5ff47fbd927a009e0279540aeb057a0903bc0: symbolic link to ../../../../usr/lib64/libbrpc.so
D: /home/xxx/BUILDROOT/brpc-0.9.8-3.el8.x86_64/usr/lib64/libbrpc.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=a1c5ff47fbd927a009e0279540aeb057a0903bc0, stripped
D: Executing /usr/lib/rpm/mpi.prov --filter-private on /home/xxx/BUILDROOT/brpc-0.9.8-3.el8.x86_64/usr/lib64/libbrpc.so

D: 	execv(/usr/lib/rpm/mpi.prov) pid 188809
D: 	waitpid(188809) rc 188809 status 0
D: Executing /usr/lib/rpm/mpi.req --filter-private on /home/xxx/BUILDROOT/brpc-0.9.8-3.el8.x86_64/usr/lib64/libbrpc.so

D: 	execv(/usr/lib/rpm/mpi.req) pid 188860
args to mpi.req: --filter-private
D: 	waitpid(188860) rc 188860 status 0
===================================== final: files 4 cdict[3] 75% ddictx[42]
  0 /home/xxx/BUILDROOT/brpc-0.9.8-3.el8.x86_64/usr/lib/.build-id	directory [none]
  1 /home/xxx/BUILDROOT/brpc-0.9.8-3.el8.x86_64/usr/lib/.build-id/a1	directory [none]
  2 /home/xxx/BUILDROOT/brpc-0.9.8-3.el8.x86_64/usr/lib/.build-id/a1/c5ff47fbd927a009e0279540aeb057a0903bc0	 [none]
  3 /home/xxx/BUILDROOT/brpc-0.9.8-3.el8.x86_64/usr/lib64/libbrpc.so	0x2 [mpi]
	P libbrpc.so()(64bit)
	R libdl.so.2(GLIBC_2.2.5)(64bit)
	R libgcc_s.so.1(GCC_3.0)(64bit)
	R libm.so.6(GLIBC_2.2.5)(64bit)
	R ld-linux-x86-64.so.2(GLIBC_2.3)(64bit)
	R libpthread.so.0(GLIBC_2.3.2)(64bit)
	R libpthread.so.0(GLIBC_2.2.5)(64bit)
	R libcrypto.so.1.1(OPENSSL_1_1_0)(64bit)
	R libc.so.6(GLIBC_PRIVATE)(64bit)
	R libc.so.6(GLIBC_2.3)(64bit)
	R libc.so.6(GLIBC_2.17)(64bit)
	R libc.so.6(GLIBC_2.6)(64bit)
	R libc.so.6(GLIBC_2.14)(64bit)
	R libc.so.6(GLIBC_2.3.2)(64bit)
	R libc.so.6(GLIBC_2.2.5)(64bit)
	R libssl.so.1.1(OPENSSL_1_1_0)(64bit)
	R libstdc++.so.6(GLIBCXX_3.4.18)(64bit)
	R libstdc++.so.6(CXXABI_1.3.8)(64bit)
	R libstdc++.so.6(CXXABI_1.3.5)(64bit)
	R libstdc++.so.6(GLIBCXX_3.4.9)(64bit)
	R libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
	R libstdc++.so.6(GLIBCXX_3.4.11)(64bit)
	R libstdc++.so.6(CXXABI_1.3)(64bit)
	R libstdc++.so.6(GLIBCXX_3.4.20)(64bit)
	R libstdc++.so.6(GLIBCXX_3.4)(64bit)
	R libstdc++.so.6(GLIBCXX_3.4.21)(64bit)
	R libgflags.so.2.1()(64bit)
	R libprotobuf.so.15()(64bit)
	R libpthread.so.0()(64bit)
	R libleveldb.so.1()(64bit)
	R libprotoc.so.15()(64bit)
	R libcrypto.so.1.1()(64bit)
	R libdl.so.2()(64bit)
	R libz.so.1()(64bit)
	R libssl.so.1.1()(64bit)
	R librt.so.1()(64bit)
	R libstdc++.so.6()(64bit)
	R libm.so.6()(64bit)
	R libgcc_s.so.1()(64bit)
	R libc.so.6()(64bit)
	R ld-linux-x86-64.so.2()(64bit)
	R rtld(GNU_HASH)
```


Steps to Reproduce:
1. 
2. 
3.

Actual results:


Expected results:


Additional info:

--- Additional comment from Honggang LI on 2021-02-18 00:21:29 UTC ---

I can't trigger the error. Please provide a reproducer for me. Thanks

[root@ incubator-brpc (master)]$ cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.4 Beta (Ootpa)

[root@ incubator-brpc (master)]$ rpm -qa | grep mpi
openmpi-devel-4.0.5-3.el8.x86_64
protobuf-compiler-3.5.0-13.el8.x86_64
compiler-rt-11.0.0-1.module+el8.4.0+8598+a071fcd5.x86_64
rpm-mpi-hooks-5-4.el8.noarch
openmpi-4.0.5-3.el8.x86_64

$ git clone https://github.com/apache/incubator-brpc.git
$ git archive --format=tar --prefix=incubator-brpc-0.9.7/ HEAD | gzip > /root/rpmbuild/SOURCES/incubator-brpc-0.9.7.tar.gz
$ rpmbuild  -ba package/rpm/brpc.spec  2>&1 | tee log
......
Recommends: brpc-debugsource(x86-64) = 0.9.7-1.el8
Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/brpc-0.9.7-1.el8.x86_64
Wrote: /root/rpmbuild/SRPMS/brpc-0.9.7-1.el8.src.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/brpc-0.9.7-1.el8.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/brpc-devel-0.9.7-1.el8.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/brpc-static-0.9.7-1.el8.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/brpc-debugsource-0.9.7-1.el8.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/brpc-debuginfo-0.9.7-1.el8.x86_64.rpm

--- Additional comment from Xiaofeng on 2021-02-18 03:13:57 UTC ---

Hi Honggang,

Thanks for the attention.

The problem is not cannot generate the RPMs, but the GLIBC_PRIVATE cannot be filtered out, does your building show the GLIBC_PRIVATE Requires like below?

Requires: ... libc.so.6(GLIBC_PRIVATE)(64bit) ...

If no, I will try to reproduce it in a mock or fresh environment. Thanks.


And I have upgraded the os to 8.3, the same problem.

$ cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.3 (Ootpa)

--- Additional comment from Xiaofeng on 2021-02-18 03:56:03 UTC ---

Hi,

Here are the steps to reproduce the problem:
1. git clone https://github.com/apache/incubator-brpc.git && cd incubator-brpc
2. git archive --format=tar --prefix=incubator-brpc-0.9.7/ HEAD | gzip > /root/rpmbuild/SOURCES/incubator-brpc-0.9.7.tar.gz
3. add BuildRequires cmake and rpm-mpi-hooks(to reproduce problem only) to the spec file package/rpm/brpc.spec;
   ```
   BuildRequires:  cmake
   BuildRequires:  rpm-mpi-hooks
   ```
4. rpmbuild -bs package/rpm/brpc.spec
5. mock -r rhelepel-8-x86_64 /root/rpmbuild/SRPMS/brpc-0.9.7-1.el8.src.rpm


And here are parts of the outputs:
```
......
Processing files: brpc-0.9.7-1.el8.x86_64
Provides: brpc = 0.9.7-1.el8 brpc(x86-64) = 0.9.7-1.el8 libbrpc.so()(64bit)
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: ld-linux-x86-64.so.2()(64bit) ld-linux-x86-64.so.2(GLIBC_2.3)(64bit) libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.17)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.2)(64bit) libc.so.6(GLIBC_2.6)(64bit) libc.so.6(GLIBC_PRIVATE)(64bit) libcrypto.so.1.1()(64bit) libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) libdl.so.2()(64bit) libdl.so.2(GLIBC_2.2.5)(64bit) libgcc_s.so.1()(64bit) libgcc_s.so.1(GCC_3.0)(64bit) libgflags.so.2.1()(64bit) libleveldb.so.1()(64bit) libm.so.6()(64bit) libm.so.6(GLIBC_2.2.5)(64bit) libprotobuf.so.15()(64bit) libprotoc.so.15()(64bit) libpthread.so.0()(64bit) libpthread.so.0(GLIBC_2.2.5)(64bit) libpthread.so.0(GLIBC_2.3.2)(64bit) librt.so.1()(64bit) libssl.so.1.1()(64bit) libssl.so.1.1(OPENSSL_1_1_0)(64bit) libstdc++.so.6()(64bit) libstdc++.so.6(CXXABI_1.3)(64bit) libstdc++.so.6(CXXABI_1.3.5)(64bit) libstdc++.so.6(CXXABI_1.3.8)(64bit) libstdc++.so.6(GLIBCXX_3.4)(64bit) libstdc++.so.6(GLIBCXX_3.4.11)(64bit) libstdc++.so.6(GLIBCXX_3.4.15)(64bit) libstdc++.so.6(GLIBCXX_3.4.18)(64bit) libstdc++.so.6(GLIBCXX_3.4.20)(64bit) libstdc++.so.6(GLIBCXX_3.4.21)(64bit) libstdc++.so.6(GLIBCXX_3.4.9)(64bit) libz.so.1()(64bit) rtld(GNU_HASH)
Processing files: brpc-devel-0.9.7-1.el8.x86_64
Provides: brpc-devel = 0.9.7-1.el8 brpc-devel(x86-64) = 0.9.7-1.el8 pkgconfig(brpc) = 0.9.0
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /usr/bin/pkg-config
Processing files: brpc-static-0.9.7-1.el8.x86_64
Provides: brpc-static = 0.9.7-1.el8 brpc-static(x86-64) = 0.9.7-1.el8
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Processing files: brpc-debugsource-0.9.7-1.el8.x86_64
Provides: brpc-debugsource = 0.9.7-1.el8 brpc-debugsource(x86-64) = 0.9.7-1.el8
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Processing files: brpc-debuginfo-0.9.7-1.el8.x86_64
Provides: brpc-debuginfo = 0.9.7-1.el8 brpc-debuginfo(x86-64) = 0.9.7-1.el8 debuginfo(build-id) = 57ad6b8b7e90f007528be01fbae9e8d096090fcb
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Recommends: brpc-debugsource(x86-64) = 0.9.7-1.el8
Checking for unpackaged file(s): /usr/lib/rpm/check-files /builddir/build/BUILDROOT/brpc-0.9.7-1.el8.x86_64
Wrote: /builddir/build/RPMS/brpc-0.9.7-1.el8.x86_64.rpm
Wrote: /builddir/build/RPMS/brpc-devel-0.9.7-1.el8.x86_64.rpm
Wrote: /builddir/build/RPMS/brpc-static-0.9.7-1.el8.x86_64.rpm
Wrote: /builddir/build/RPMS/brpc-debugsource-0.9.7-1.el8.x86_64.rpm
Wrote: /builddir/build/RPMS/brpc-debuginfo-0.9.7-1.el8.x86_64.rpm
......
```

libc.so.6(GLIBC_PRIVATE)(64bit) is not filter out as expected.

Thanks.

Comment 1 Honggang LI 2021-02-18 11:13:03 UTC
It seems this simple patch fixes the issue.

rpm-mpi-hooks (rawhide *)]$ git diff
diff --git a/mpi.attr b/mpi.attr
index 03ea6af..22aea42 100644
--- a/mpi.attr
+++ b/mpi.attr
@@ -1,5 +1,5 @@
-%__mpi_provides            %{_rpmconfigdir}/mpi.prov %{?__filter_GLIBC_PRIVATE:--filter-private}
-%__mpi_requires            %{_rpmconfigdir}/mpi.req %{?__filter_GLIBC_PRIVATE:--filter-private}
+%__mpi_provides            %{_rpmconfigdir}/mpi.prov --provides %{?__filter_GLIBC_PRIVATE:--filter-private}
+%__mpi_requires            %{_rpmconfigdir}/mpi.req  --requires %{?__filter_GLIBC_PRIVATE:--filter-private}
 %__mpi_path                ^%{_prefix}/lib(64)?/.*$
 %__mpi_magic               ^(setuid )?(setgid )?(sticky )?ELF (32|64)-bit.*$
 %__mpi_flags               exeonly,magic_and_path

Comment 2 Sandro Mani 2021-02-18 11:16:53 UTC
--provides and --requires are already passed to /usr/lib/rpm/elfdeps inside mpi.req resp. mpi.prov, this would result in it getting passed twice?

Comment 3 Xiaofeng 2021-02-18 13:15:54 UTC
(In reply to Sandro Mani from comment #2)
> --provides and --requires are already passed to /usr/lib/rpm/elfdeps inside
> mpi.req resp. mpi.prov, this would result in it getting passed twice?

No, as the first parameter(--provides/--requires) has already been shifted in mpi.prov/mpi.req.

$ cat -n /usr/lib/rpm/mpi.prov
......
    30	# Remaining arguments are passed to elfdeps
    31	shift
    32	elfdepsargs="$@"
......

Comment 4 Xiaofeng 2021-02-18 13:41:16 UTC
(In reply to Honggang LI from comment #1)
> It seems this simple patch fixes the issue.
> 
> rpm-mpi-hooks (rawhide *)]$ git diff
> diff --git a/mpi.attr b/mpi.attr
> index 03ea6af..22aea42 100644
> --- a/mpi.attr
> +++ b/mpi.attr
> @@ -1,5 +1,5 @@
> -%__mpi_provides            %{_rpmconfigdir}/mpi.prov
> %{?__filter_GLIBC_PRIVATE:--filter-private}
> -%__mpi_requires            %{_rpmconfigdir}/mpi.req
> %{?__filter_GLIBC_PRIVATE:--filter-private}
> +%__mpi_provides            %{_rpmconfigdir}/mpi.prov --provides
> %{?__filter_GLIBC_PRIVATE:--filter-private}
> +%__mpi_requires            %{_rpmconfigdir}/mpi.req  --requires
> %{?__filter_GLIBC_PRIVATE:--filter-private}
>  %__mpi_path                ^%{_prefix}/lib(64)?/.*$
>  %__mpi_magic               ^(setuid )?(setgid )?(sticky )?ELF (32|64)-bit.*$
>  %__mpi_flags               exeonly,magic_and_path

Why not just remove the ``shift`` in mpi.prov and mpi.req? And I'm not sure whether this works for /usr/lib/rpm/fileattrs/mpilibsymlink.attr?

$ rpm -ql rpm-mpi-hooks-5-4.el8.noarch
/usr/lib/rpm/fileattrs/mpi.attr
/usr/lib/rpm/fileattrs/mpilibsymlink.attr
/usr/lib/rpm/mpi.prov
/usr/lib/rpm/mpi.req
/usr/share/licenses/rpm-mpi-hooks
/usr/share/licenses/rpm-mpi-hooks/LICENSE

$ cat -n /usr/lib/rpm/fileattrs/mpilibsymlink.attr
     1	# Make libfoo.so symlinks require the soname-provide of the target library
     2	%__mpilibsymlink_requires %{_rpmconfigdir}/mpi.prov %{buildroot} --soname-only
     3	%__mpilibsymlink_magic    ^symbolic link to .*lib.*\.so\..*$
     4	%__mpilibsymlink_path     ^%{_prefix}/lib(64)?/.*\.so$
     5	%__mpilibsymlink_flags    magic_and_path
     6	%__libsymlink_exclude_path ^%{_prefix}/lib(64)?/.*$

Comment 5 Sandro Mani 2021-02-18 15:05:25 UTC
I see now - the shift is a left-over oversight from before [1], I'll just drop it.

[1] https://src.fedoraproject.org/rpms/rpm-mpi-hooks/c/a9457917b1a04ba4b68678676689194fa907abd9?branch=rawhide

Comment 6 Fedora Update System 2021-02-18 15:16:55 UTC
FEDORA-2021-d823321a2d has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2021-d823321a2d

Comment 7 Fedora Update System 2021-02-18 15:16:56 UTC
FEDORA-2021-4e977a8858 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-4e977a8858

Comment 8 Honggang LI 2021-02-19 01:23:30 UTC
Confirmed the patch works for me. thanks

Comment 9 Fedora Update System 2021-02-19 02:00:17 UTC
FEDORA-2021-d823321a2d has been pushed to the Fedora 32 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-d823321a2d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-d823321a2d

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

Comment 10 Fedora Update System 2021-02-19 02:04:16 UTC
FEDORA-2021-4e977a8858 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-4e977a8858`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-4e977a8858

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

Comment 11 Fedora Update System 2021-02-26 23:54:43 UTC
FEDORA-2021-4e977a8858 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Fedora Update System 2021-04-01 02:36:50 UTC
FEDORA-2021-8f5d163f67 has been pushed to the Fedora 32 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-8f5d163f67`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-8f5d163f67

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

Comment 13 Fedora Update System 2021-04-08 20:42:37 UTC
FEDORA-2021-8f5d163f67 has been pushed to the Fedora 32 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.