Bug 2121153

Summary: uname -i/-p broken in mock chroots
Product: [Fedora] Fedora Reporter: Jerry James <loganjerry>
Component: fltkAssignee: Richard Shaw <hobbes1069>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: admiller, hobbes1069, itsme_410, jamartis, jarodwilson, kdudka, kzak, ooprala, ovasik, p, phracek, rdieter, sebastian.kisela, svashisht
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-30 03:09:12 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 Jerry James 2022-08-24 15:55:02 UTC
Description of problem:
Koschei tells me that the pari package has started failing to build.  The problem is that it is no longer including -lfltk on the link line, leading to unresolved symbols.  Pari finds the link command to use by running "fltk-config --post".  In Rawhide mock, this is what happens:

$ fltk-config --post
/usr/bin/fltk-config: line 3: exec: fltk-config-unknown: not found
$ cat /usr/bin/fltk-config
#!/usr/bin/bash

exec fltk-config-$(uname -i) "$@"
$ ls /usr/bin/fltk-config*
/usr/bin/fltk-config  /usr/bin/fltk-config-x86_64
$ uname -i
unknown
$ uname -p
unknown

I see that there was a new coreutils build yesterday with this changelog entry:
* Tue Aug 23 2022 Kamil Dudka <kdudka> - 9.1-7
- remove non-upstream patch for uname -i/-p (#548834)

It appears that that non-upstream patch is needed for sane handling of uname -i/-p in mock. 

Version-Release number of selected component (if applicable):
coreutils-9.1-7.fc38

How reproducible:
Always

Steps to Reproduce:
1. mock -r fedora-rawhide-x86_64 --init
2. mock -r fedora-rawhide-x86_64 --shell
3. uname -i

Actual results:
"unknown"

Expected results:
"x86_64"

Additional info:

Comment 1 Kamil Dudka 2022-08-24 16:18:20 UTC
Thank you for pointing it out!  This seems to be a bug in the Fedora packaging of fltk.  It should use `uname -m` rather than `uname -i`, which has been documented as non-portable since 2015: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.24-7-g6d67649

This could be trivially fixed in the packaging of fltk:

diff --git a/fltk-config.sh b/fltk-config.sh
index c70522d..499c34b 100644
--- a/fltk-config.sh
+++ b/fltk-config.sh
@@ -1,3 +1,3 @@
 #!/bin/bash

-exec fltk-config-$(uname -i) "$@"
+exec fltk-config-$(uname -m) "$@"
diff --git a/fltk.spec b/fltk.spec
index bd2053a..48a4e68 100644
--- a/fltk.spec
+++ b/fltk.spec
@@ -101,7 +101,7 @@ make docs -C %{_vpath_builddir}

 # we only apply this hack to multilib arch's
 %ifarch x86_64 %{ix86} ppc64 ppc s390x s390 sparc64 sparc
-%global arch %(uname -i 2>/dev/null || echo undefined)
+%global arch %(uname -m 2>/dev/null || echo undefined)
 mv $RPM_BUILD_ROOT%{_bindir}/fltk-config \
    $RPM_BUILD_ROOT%{_bindir}/fltk-config-%{arch}
 install -p -m755 -D %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/fltk-config

Comment 2 Fedora Admin user for bugzilla script actions 2022-08-30 00:30:26 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 3 Richard Shaw 2022-08-30 03:09:12 UTC
I wasn't aware of this bug but I noticed it separately and have already fixed and rebuilt the package for rawhide/f38.