Bug 2048909

Summary: Unexpected options in 'krb5-config --libs' output
Product: [Fedora] Fedora Reporter: Sumit Bose <sbose>
Component: krb5Assignee: Julien Rische <jrische>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: abokovoy, aboscatt, antorres, atikhono, contribs, fdvorak, ftrivino, ipedrosa, j, npmccallum, redhat-bugzilla, sbose, ssorce, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: krb5-1.19.2-5.fc36 krb5-1.19.2-6.fc37 krb5-1.19.2-6.fc36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-02-03 11:19:05 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:

Description Sumit Bose 2022-02-01 07:22:07 UTC
Description of problem:
The linker script used to build the krb5 packages is somehow added to the output of the 'krb5-config' utility.

   # krb5-config --libs
   -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -Wl,--build-id=sha1 -Wl,-dT,/builddir/build/BUILD/.package_note-krb5-1.19.2-4.fc36.1.x86_64.ld -lkrb5 -lk5crypto -lcom_err

Packages using this output to add dependent libraries to the gcc command line will fail.

Version-Release number of selected component (if applicable):
krb5-devel-1.19.2-4.fc36.1.x86_64

How reproducible:
Install krb5-devel-1.19.2-4.fc36.1.x86_64 and call 'krb5-config --libs'

Actual results:
   # krb5-config --libs
   -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -Wl,--build-id=sha1 -Wl,-dT,/builddir/build/BUILD/.package_note-krb5-1.19.2-4.fc36.1.x86_64.ld -lkrb5 -lk5crypto -lcom_err

Expected results:
Here I'm note quite sure which linker options should be present, if any. In older versions of the krb5 package the output looks like:

    # krb5-config --libs
    -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -lkrb5 -lk5crypto -lcom_err

Comment 1 Alexander Bokovoy 2022-02-01 07:35:21 UTC
The last build was a mass-rebuild. krb5 spec file does a cleanup of krb5-config and last year we changed it in -3.fc35 to

-# Temporay workaround for krb5-config reading too much from LDFLAGS.
-# Upstream: http://krbdev.mit.edu/rt/Ticket/Display.html?id=8159
-sed -r -i -e "s/-specs=\/.+?\/redhat-hardened-ld//g" $RPM_BUILD_ROOT%{_bindir}/krb5-config
-
-if [[ "$(< $RPM_BUILD_ROOT%{_bindir}/krb5-config )" == *redhat-hardened-ld* ]] ; then
-    printf '# redhat-hardened-ld for krb5-config failed' 1>&2
-    exit 1
-fi
+# Workaround krb5-config reading too much from LDFLAGS.
+# https://bugzilla.redhat.com/show_bug.cgi?id=1997021
+sed -i -e "s/-specs=[^ ]*//g" $RPM_BUILD_ROOT%{_bindir}/krb5-config

With the mass rebuild, we get the following LD_FLAGS passed during the build in https://kojipkgs.fedoraproject.org//packages/krb5/1.19.2/4.fc36.1/data/logs/x86_64/build.log:

+ LDFLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -Wl,-dT,/builddir/build/BUILD/.package_note-krb5-1.19.2-4.fc36.1.x86_64.ld'
+ export LDFLAGS

in the previous build we had

+ LDFLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 '
+ export LDFLAGS

So I think the workaround for bug 1997021 needs to be enhanced to cut off everything after the specs? Or -Wl,-dT and -Wl,--build-id=*?

Re-assigning to Julien.

Comment 2 Fedora Update System 2022-02-03 11:15:22 UTC
FEDORA-2022-ba494d207e has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-ba494d207e

Comment 3 Fedora Update System 2022-02-03 11:19:05 UTC
FEDORA-2022-ba494d207e has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 4 Zbigniew Jędrzejewski-Szmek 2022-02-08 13:39:11 UTC
https://src.fedoraproject.org/rpms/krb5/pull-request/7 reenabled packages notes and fixes krb5-config instead. PTAL.

Comment 5 Fedora Update System 2022-02-09 10:31:30 UTC
FEDORA-2022-b3909bc19b has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-b3909bc19b

Comment 6 Fedora Update System 2022-02-09 10:32:38 UTC
FEDORA-2022-b3909bc19b has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Fedora Update System 2022-02-09 10:32:50 UTC
FEDORA-2022-54cade0290 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-54cade0290

Comment 8 Fedora Update System 2022-02-09 16:44:54 UTC
FEDORA-2022-54cade0290 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.