Bug 1296955 - Errors from mpi.prov when testing for dependencies including symbol versions
Summary: Errors from mpi.prov when testing for dependencies including symbol versions
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm-mpi-hooks
Version: 23
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Sandro Mani
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2016-01-08 14:32 UTC by Mark Wielaard
Modified: 2016-01-19 23:28 UTC (History)
2 users (show)

Fixed In Version: rpm-mpi-hooks-3-5.fc23
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2016-01-19 23:28:35 UTC
Type: Bug

Attachments (Terms of Use)

Description Mark Wielaard 2016-01-08 14:32:02 UTC
When building my package (elfutils) with fedpkg local I get lots of errors in the build log:

/usr/lib/rpm/mpi.prov: line 68: [: libebl_aarch64.so(ELFUTILS_0.165)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: libebl_alpha.so(ELFUTILS_0.165)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: libebl_arm.so(ELFUTILS_0.165)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: libebl_i386.so(ELFUTILS_0.165)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: libebl_ia64.so(ELFUTILS_0.165)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: libebl_ppc.so(ELFUTILS_0.165)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: libebl_ppc64.so(ELFUTILS_0.165)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: libebl_s390.so(ELFUTILS_0.165)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: libebl_sh.so(ELFUTILS_0.165)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: libebl_sparc.so(ELFUTILS_0.165)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: libebl_tilegx.so(ELFUTILS_0.165)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: libebl_x86_64.so(ELFUTILS_0.165)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: libasm.so.1(ELFUTILS_1.0)(64bit): binary operator expected
/usr/lib/rpm/mpi.prov: line 68: [: too many arguments

I believe you want to check for the empty string with:

--- /usr/lib/rpm/mpi.prov.orig	2016-01-08 15:16:40.217450308 +0100
+++ /usr/lib/rpm/mpi.prov	2016-01-08 15:17:27.481304796 +0100
@@ -65,7 +65,7 @@
     # Get the default provides string from elfdeps
     prov=$(echo $file | /usr/lib/rpm/elfdeps --provides $elfdepsargs)
-    if [ -z $prov ]; then
+    if [ -z "$prov" ]; then

Comment 1 Sandro Mani 2016-01-08 14:42:24 UTC
Uh indeed, thanks for reporting!

Comment 2 Fedora Update System 2016-01-08 14:53:12 UTC
rpm-mpi-hooks-3-5.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-40d2987dfe

Comment 3 Fedora Update System 2016-01-09 04:26:31 UTC
rpm-mpi-hooks-3-5.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-40d2987dfe

Comment 4 Helmut Schlattl 2016-01-09 16:15:26 UTC
I got a lot of 'Invalid buildroot' when performing 
rpmbuild --rebuild gcc-5.3.1-2.fc23.src.rpm

(using rpmmacro: %_use_internal_dependency_generator 0)

Apparently the first argument to mpi.req or mpi.prov is not buildroot anymore. 

Applying this patch solves it (analogue to mpi.prov):
--- mpi.req.orig     2016-01-08 15:41:19.000000000 +0100
+++ mpi.req      2016-01-09 17:10:16.703356110 +0100
@@ -22,11 +22,7 @@
 # First argument is buildroot
-if [ ! -d "$buildroot" ]; then
-  >&2 echo "Invalid buildroot"
-  exit 1
 # Try to determine python3 version in the same way that %{python3_version} does
 PYTHON3_VERSION="$(/usr/bin/python3 -c 'import sys; sys.stdout.write(sys.version[:3])')"

Comment 5 Sandro Mani 2016-01-09 17:57:08 UTC
The arguments to be passed to the mpi.req and mpi.prov scripts are listed in mpi.attr, so the buildroot *should* be passed. (Granted, it would probably be better to use $RPM_BUILD_ROOT directly anyway, but may be additional arguments passed to the scripts, see the lines

# Remaining arguments are passed to elfdeps

so $1==$RPM_BUILD_ROOT is actually a good test to check whether arguments are passed correctly).

That said, I've actually encountered a similar issue before, and it had to do with the old-style filtering syntax, i.e. in mpi4py I had to replace 

%filter_provides_in %{python2_sitearch}.*\.so$
%filter_requires_in %{python2_sitearch}/openmpi/mpi4py/lib-pmpi/lib.*\.so
%if 0%{?with_python3}
%filter_provides_in %{python3_sitearch}.*\.so$
%filter_requires_in %{python3_sitearch}/openmpi/mpi4py/lib-pmpi/lib.*\.so


%global __requires_exclude_from %{python2_sitearch}/openmpi/mpi4py/lib-pmpi/lib.*\.so$|%{python3_sitearch}/openmpi/mpi4py/lib-pmpi/lib.*\.so$
%global __provides_exclude_from %{python2_sitearch}.*\.so$|%{python3_sitearch}.*\.so$

Since the filtering syntax causing the issue is outdated, I did not bother, but perhaps there is a bug in rpmbuild somewhere which causes such issues? Do you have any filtering going on in the gcc you are rebuilding?

By the way, I assume that you are building in your main root environment and not in a separate chroot (i.e. via mock), since there should be nothing required to build gcc that involves pulling in the mpi dependency generator scripts.

Comment 6 Helmut Schlattl 2016-01-11 08:28:28 UTC
I am not familiar with all details of the rpmbuild process, so was not aware of the mpi.attr file. Anyway, there is no buildroot passed to mpi.prov and mpi.req, so it's not unlikely to be a bug in rpm itself (or more precisely in the sources to /usr/lib/rpm/rpmdeps). 

I was building as a standard user (not as root or in chroot). Frankly, it was not the original gcc.src.rpm I was rebuilding. I was building a full cross-compiler based on gcc-5.3.1-2.fc23.src.rpm (using a modified spec-file), which might have caused pulling in the mpi-stuff for building a couple of binary RPMs. But certainly not on purpose. Anyway, the question is not why mpi.rev or mpi.prov is invoked, but that the scripts operate correctly. Right?

Comment 7 Sandro Mani 2016-01-11 08:40:04 UTC
Yes sure.

Can you post the SRPM of the package you are building?

As said, buildroot is specified as first argument in mpi.attr:

$ cat mpi.attr
%__mpi_provides            %{_rpmconfigdir}/mpi.prov %{buildroot} %{?__filter_GLIBC_PRIVATE:--filter-private}
%__mpi_requires            %{_rpmconfigdir}/mpi.req %{buildroot} %{?__filter_GLIBC_PRIVATE:--filter-private}

So there is some conflict going on which is either killing the %{buildroot} variable or shifting the arguments.

Comment 8 Helmut Schlattl 2016-01-11 20:58:27 UTC
%{buildroot} is certainly defined, otherwise the build will not work at all.

At the moment I cannot reproduce the error, since I detected another problem (Bug 1297557) when using an external dependency generator. I will come back to the %{buildroot} problem, when that bug has been resolved.

Comment 9 Fedora Update System 2016-01-19 23:28:33 UTC
rpm-mpi-hooks-3-5.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, 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.