Bug 1422193

Summary: gdb doesn't rebuild when devtoolset-6-build is installed
Product: Red Hat Enterprise Linux 7 Reporter: Martin Cermak <mcermak>
Component: gdbAssignee: Jan Kratochvil <jan.kratochvil>
Status: CLOSED ERRATA QA Contact: Michal Kolar <mkolar>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: gdb-bugs, jan.kratochvil, mkolar, mnewsome, sergiodj
Target Milestone: rc   
Target Release: 7.4   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: 7.6.1-95.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 18:46:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1390370    

Description Martin Cermak 2017-02-14 16:58:04 UTC
Michal Kolar spotted that gdb-7.6.1-94.el7.src.rpm doesn't rebuild when all the devtoolset-6 RPMs are installed.  The failure looks like this:

=======
+ echo 'Patch #836 (gdb-upstream-framefilters-1of2.patch):'
Patch #836 (gdb-upstream-framefilters-1of2.patch):
+ /usr/bin/cat /root/rpmbuild/SOURCES/gdb-upstream-framefilters-1of2.patch
+ /usr/bin/patch -p1 --fuzz=0 -R
patching file gdb/Makefile.in
Hunk #3 succeeded at 2179 (offset 5 lines).
patching file gdb/NEWS
Hunk #1 FAILED at 4.
1 out of 1 hunk FAILED -- saving rejects to file gdb/NEWS.rej
patching file gdb/stack.c
Hunk #2 succeeded at 1676 (offset 21 lines).
Hunk #3 succeeded at 1701 (offset 21 lines).
Hunk #4 succeeded at 1722 (offset 21 lines).
Hunk #5 succeeded at 1744 (offset 21 lines).
Hunk #6 succeeded at 1769 (offset 21 lines).
Hunk #7 succeeded at 1794 (offset 21 lines).
Hunk #8 succeeded at 1811 (offset 21 lines).
Hunk #9 succeeded at 1841 (offset 21 lines).
Hunk #10 succeeded at 1849 (offset 21 lines).
Hunk #11 succeeded at 2583 (offset 21 lines).
patching file gdb/data-directory/Makefile.in
patching file gdb/doc/gdb.texinfo
Hunk #5 succeeded at 23135 (offset 35 lines).
Hunk #6 succeeded at 24485 (offset 35 lines).
Hunk #7 succeeded at 25315 (offset 35 lines).
Hunk #8 succeeded at 25365 (offset 35 lines).
Hunk #9 succeeded at 26383 (offset 35 lines).
Hunk #10 succeeded at 30260 (offset 41 lines).
Hunk #11 succeeded at 30327 (offset 41 lines).
Hunk #12 succeeded at 30350 (offset 41 lines).
Hunk #13 succeeded at 30421 (offset 41 lines).
Hunk #14 succeeded at 30457 (offset 41 lines).
Hunk #15 succeeded at 30527 (offset 41 lines).
Hunk #16 succeeded at 30542 (offset 41 lines).
Hunk #17 succeeded at 30567 (offset 41 lines).
Hunk #18 succeeded at 30581 (offset 41 lines).
patching file gdb/mi/mi-cmd-stack.c
patching file gdb/mi/mi-cmds.c
patching file gdb/mi/mi-cmds.h
patching file gdb/python/py-framefilter.c
Unreversed patch detected!  Ignore -R? [n]
=======

Closer look shows that the culprit is devtoolset-6-build that, when installed, defines the %{scl} rpm macro:

=======
 7.4 Server x86_64 # rpm --eval '%{scl}'
devtoolset-6
 7.4 Server x86_64 #
=======

... which drives following specfile condition:

=======
%if 0%{?scl:1}
%patch836 -p1 -R
%patch837 -p1 -R
%patch998 -p1 -R
%endif
=======

Apparently, when %{scl} is defined, then patch 836 (gdb-upstream-framefilters-1of2.patch) collides with patch 1017         
(gdb-rhbz1105165-ibm-tdb-support-system-z-3of9.patch).  Both of them are trying to modify the NEWS file.  IOW, after applying 836 and 1017 on top of it, patch 863 can't be reverted (-R) any more:

=======
 7.4 Server x86_64 # cat gdb.spec | egrep '%patch(836|1017)'
%patch836 -p1
%patch1017 -p1
%patch836 -p1 -R
 7.4 Server x86_64 #
=======

Observed with gdb-7.6.1-94.el7.src.rpm.

Comment 4 errata-xmlrpc 2017-08-01 18:46:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2041