Bug 1518120 - find-debuginfo.sh gets _smp_mflags but doesn't support "--jobs N" (only "-jN" and "-j N")
Summary: find-debuginfo.sh gets _smp_mflags but doesn't support "--jobs N" (only "-jN"...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-28 09:08 UTC by James Ralston
Modified: 2018-02-06 15:33 UTC (History)
6 users (show)

Fixed In Version: rpm-4.14.1-1.fc27
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-06 15:33:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
libkeepalive.spec (1.40 KB, text/plain)
2017-11-28 09:11 UTC, James Ralston
no flags Details
libkeepalive-0.3-cflags.patch (534 bytes, patch)
2017-11-28 09:11 UTC, James Ralston
no flags Details | Diff

Description James Ralston 2017-11-28 09:08:55 UTC
Description of problem:

On Fedora 27, in at least some circumstances, rpmbuild passes "--jobs nnn" to find-debuginfo.sh, but Fedora 27's find-debuginfo.sh does not understand that option. As a result, find-debuginfo.sh misparses the rest of its options, fails, and the build fails.

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

rpm-4.14.0-2.fc27.x86_64

How reproducible:

Attempt to build the attached SPEC file on Fedora 27.

Additional info:

Patching /usr/lib/rpm/find-debuginfo.sh as follows works around the problem:

--- find-debuginfo.sh.ORIG      2017-10-12 10:16:53.000000000 -0400
+++ find-debuginfo.sh   2017-11-28 04:01:05.876901281 -0500
@@ -135,6 +135,10 @@
     unique_debug_src_base=$2
     shift
     ;;
+  --jobs)
+    # We ignore this.
+    shift
+    ;;
   -g)
     strip_g=true
     ;;

But this should not be necessary.

Comment 1 Igor Gnatenko 2017-11-28 09:10:28 UTC
Did you forgot to attach spec?

Comment 2 James Ralston 2017-11-28 09:11:06 UTC
Created attachment 1359733 [details]
libkeepalive.spec

Comment 3 James Ralston 2017-11-28 09:11:47 UTC
Created attachment 1359734 [details]
libkeepalive-0.3-cflags.patch

Comment 4 Mark Wielaard 2017-11-28 09:14:06 UTC
I wonder if it is %{?_smp_mflags}
%__debug_install_post passes that to find-debuginfo.sh.
We expect -j N.
But maybe in some circumstances it is --jobs N?

In that case a better patch would be:
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
index d8725ad..a7c2db0 100755
--- a/scripts/find-debuginfo.sh
+++ b/scripts/find-debuginfo.sh
@@ -182,6 +182,10 @@ while [ $# -gt 0 ]; do
   -j*)
     n_jobs=${1#-j}
     ;;
+  --jobs)
+    n_jobs=$2
+    shift
+    ;;
   -S)
     srcout=$2
     shift

Comment 5 Igor Gnatenko 2017-11-28 09:15:10 UTC
➜  SPECS curl https://bugzilla.redhat.com/attachment.cgi\?id\=1359733 -o libkeepalive.spec
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1432  100  1432    0     0   1432      0  0:00:01  0:00:01 --:--:--  1045
➜  SPECS curl https://bugzilla.redhat.com/attachment.cgi\?id\=1359734 -o ../SOURCES/libkeepalive-0.3-cflags.patch
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   534  100   534    0     0    534      0  0:00:01  0:00:01 --:--:--   307
➜  SPECS spectool -g -R ./libkeepalive.spec 
Getting http://downloads.sourceforge.net/project/libkeepalive/libkeepalive/0.3/libkeepalive-0.3.tar.gz to /home/brain/rpmbuild/SOURCES/libkeepalive-0.3.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0   381    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  4281  100  4281    0     0   4281      0  0:00:01  0:00:01 --:--:-- 21088mb
➜  SPECS rpmbuild -ba ./libkeepalive.spec 
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.jJGLGo
+ umask 022
+ cd /home/brain/rpmbuild/BUILD
+ cd /home/brain/rpmbuild/BUILD
+ rm -rf libkeepalive-0.3
+ /usr/bin/gzip -dc /home/brain/rpmbuild/SOURCES/libkeepalive-0.3.tar.gz
+ /usr/bin/tar -xof -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd libkeepalive-0.3
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ echo 'Patch #0 (libkeepalive-0.3-cflags.patch):'
Patch #0 (libkeepalive-0.3-cflags.patch):
+ /usr/bin/patch --no-backup-if-mismatch -p1 -b --suffix .cflags --fuzz=0
patching file src/Makefile
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.XNSCAL
+ umask 022
+ cd /home/brain/rpmbuild/BUILD
+ cd libkeepalive-0.3
+ make 'CFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic'
make -C src/
make[1]: Entering directory '/home/brain/rpmbuild/BUILD/libkeepalive-0.3/src'
gcc -c  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fPIC -o libkeepalive.o libkeepalive.c
gcc -shared -Wl,-soname,libkeepalive.so -o libkeepalive.so libkeepalive.o -ldl
rm libkeepalive.o
make[1]: Leaving directory '/home/brain/rpmbuild/BUILD/libkeepalive-0.3/src'
make -C test/
make[1]: Entering directory '/home/brain/rpmbuild/BUILD/libkeepalive-0.3/test'
gcc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic    test.c   -o test
make[1]: Leaving directory '/home/brain/rpmbuild/BUILD/libkeepalive-0.3/test'
cp src/libkeepalive.so libkeepalive.so
strip -s libkeepalive.so
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.1JVSj9
+ umask 022
+ cd /home/brain/rpmbuild/BUILD
+ '[' /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64 '!=' / ']'
+ rm -rf /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64
++ dirname /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64
+ mkdir -p /home/brain/rpmbuild/BUILDROOT
+ mkdir /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64
+ cd libkeepalive-0.3
+ rm -rf /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64
+ install -d /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64/usr/lib64
+ install -m 0755 src/libkeepalive.so /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64/usr/lib64/libkeepalive.so
+ /usr/lib/rpm/find-debuginfo.sh -j8 --strict-build-id -m -i --build-id-seed 0.3-1.fc28 --unique-debug-suffix -0.3-1.fc28.x86_64 --unique-debug-src-base libkeepalive-0.3-1.fc28.x86_64 --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 -S debugsourcefiles.list /home/brain/rpmbuild/BUILD/libkeepalive-0.3
extracting debug info from /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64/usr/lib64/libkeepalive.so
/usr/lib/rpm/sepdebugcrcfix: Updated 1 CRC32s, 0 CRC32s did match.
7 blocks
+ '[' '%{buildarch}' = noarch ']'
+ QA_CHECK_RPATHS=1
+ case "${QA_CHECK_RPATHS:-}" in
+ /usr/lib/rpm/check-rpaths
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/brp-compress
+ /home/brain/Projects/upstream/rpm/scripts/brp-mangle-shebangs
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
+ /usr/lib/rpm/brp-python-hardlink
Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.N0P4ey
+ umask 022
+ cd /home/brain/rpmbuild/BUILD
+ cd libkeepalive-0.3
+ env LD_PRELOAD=src/libkeepalive.so test/test
+ grep 'SO_KEEPALIVE is ON'
SO_KEEPALIVE is ON
+ exit 0
Processing files: libkeepalive-0.3-1.fc28.x86_64
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.LlOYbX
+ umask 022
+ cd /home/brain/rpmbuild/BUILD
+ cd libkeepalive-0.3
+ DOCDIR=/home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64/usr/share/doc/libkeepalive
+ export LC_ALL=C
+ LC_ALL=C
+ export DOCDIR
+ /usr/bin/mkdir -p /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64/usr/share/doc/libkeepalive
+ cp -pr AUTHORS /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64/usr/share/doc/libkeepalive
+ cp -pr ChangeLog /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64/usr/share/doc/libkeepalive
+ cp -pr FEEDBACK /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64/usr/share/doc/libkeepalive
+ cp -pr LICENSE /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64/usr/share/doc/libkeepalive
+ cp -pr README /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64/usr/share/doc/libkeepalive
+ exit 0
Provides: libkeepalive = 0.3-1.fc28 libkeepalive(x86-64) = 0.3-1.fc28 libkeepalive.so()(64bit)
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.4)(64bit) libdl.so.2()(64bit) libdl.so.2(GLIBC_2.2.5)(64bit) rtld(GNU_HASH)
Processing files: libkeepalive-debugsource-0.3-1.fc28.x86_64
Provides: libkeepalive-debugsource = 0.3-1.fc28 libkeepalive-debugsource(x86-64) = 0.3-1.fc28
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Processing files: libkeepalive-debuginfo-0.3-1.fc28.x86_64
Provides: debuginfo(build-id) = b16cb079540299ea84d214398a8658c747391230 libkeepalive-debuginfo = 0.3-1.fc28 libkeepalive-debuginfo(x86-64) = 0.3-1.fc28
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Recommends: libkeepalive-debugsource(x86-64) = 0.3-1.fc28
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64
Wrote: /home/brain/rpmbuild/SRPMS/libkeepalive-0.3-1.fc28.src.rpm
Wrote: /home/brain/rpmbuild/RPMS/x86_64/libkeepalive-0.3-1.fc28.x86_64.rpm
Wrote: /home/brain/rpmbuild/RPMS/x86_64/libkeepalive-debugsource-0.3-1.fc28.x86_64.rpm
Wrote: /home/brain/rpmbuild/RPMS/x86_64/libkeepalive-debuginfo-0.3-1.fc28.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.t1v8um
+ umask 022
+ cd /home/brain/rpmbuild/BUILD
+ cd libkeepalive-0.3
+ rm -rf /home/brain/rpmbuild/BUILDROOT/libkeepalive-0.3-1.fc28.x86_64
+ exit 0

Comment 6 Panu Matilainen 2017-11-28 09:23:28 UTC
I can't reproduce it either.

James, please attach
1) the output of 'rpm --showrc' from a system exhibiting problems
2) the build log of such a failure

Comment 7 James Ralston 2017-11-28 09:33:57 UTC
Ah: the "--jobs 3" was coming from my ~/.rpmmacros file, where I was overriding _smp_mflags.

So the problem here is that rpmbuild now seems to be passing _smp_mflags to find-debuginfo.sh, but unlike make, which understands all of "-jN", "-j N", and "--jobs N", find-debuginfo.sh only understands "-jN" and "-j N".

If rpmbuild is going to pass _smp_mflags to find-debuginfo.sh, then find-debuginfo.sh should support the "--jobs N" syntax, the same as make. So applying the patch in comment 4 is probably the best course of action.

Comment 8 Igor Gnatenko 2017-11-28 10:04:08 UTC
I would go with Mark's patch as well. %_smp_mflags are not designed only for `make` but seem to be generic enough. On the other hand, one of its "competitors" ninja doesn't support long option.

Anyhow, it will hurt nothing if we will add support for --jobs in find-debuginfo.sh

Comment 9 Panu Matilainen 2017-12-08 12:49:31 UTC
Mark's patch applied upstream now:
https://github.com/rpm-software-management/rpm/commit/e5abfd8b574c7dece80a5176978469e7c8f2b23f

Comment 10 Fedora Update System 2018-02-01 12:05:53 UTC
rpm-4.14.1-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-cf91c45f15

Comment 11 Fedora Update System 2018-02-01 19:32:38 UTC
rpm-4.14.1-1.fc27 has been pushed to the Fedora 27 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-2018-cf91c45f15

Comment 12 Fedora Update System 2018-02-06 15:33:20 UTC
rpm-4.14.1-1.fc27 has been pushed to the Fedora 27 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.