Bug 1685594

Summary: libselinux: FTBFS in Fedora rawhide
Product: [Fedora] Fedora Reporter: Jitka Plesnikova <jplesnik>
Component: libselinuxAssignee: Petr Lautrbach <plautrba>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dwalsh, fweimer, mgrepl, plautrba, vmojzis
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: http://apps.fedoraproject.org/koschei/package/libselinux
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-03-18 12:50:48 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 Jitka Plesnikova 2019-03-05 15:20:19 UTC
Description of problem:
Package libselinux fails to build from source in Fedora rawhide. 

BUILDSTDERR: procattr.c:27:14: error: static declaration of 'gettid' follows non-static declaration
BUILDSTDERR:    27 | static pid_t gettid(void)
BUILDSTDERR:       |              ^~~~~~
BUILDSTDERR: In file included from /usr/include/unistd.h:1170,
BUILDSTDERR:                  from procattr.c:2:
BUILDSTDERR: /usr/include/bits/unistd_ext.h:34:16: note: previous declaration of 'gettid' was here
BUILDSTDERR:    34 | extern __pid_t gettid (void) __THROW;
BUILDSTDERR:       |                ^~~~~~
BUILDSTDERR: make[1]: *** [Makefile:171: procattr.o] Error 1
BUILDSTDERR: make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/builddir/build/BUILD/libselinux-2.9-rc1/src'
BUILDSTDERR: make: *** [Makefile:44: all] Error 1

Steps to Reproduce:
koji build --scratch f31 libselinux-2.9-0.rc1.1.fc30.1.src.rpm

Additional info:
This package is tracked by Koschei. See:
http://apps.fedoraproject.org/koschei/package/libselinux

Dependency changes from last successful build can be found here:
https://apps.fedoraproject.org/koschei/build/6164337

Comment 1 Petr Lautrbach 2019-03-08 13:02:58 UTC
glibc-2.29.9000-1 added gettid system call wrapper (swbz#6399) which is supposed to be in glibc-2.30. I'd use __GLIBC_PREREQ(2,30) but features.h still defines

#define	__GLIBC__	2
#define	__GLIBC_MINOR__	29

How can I fix it now? Do I need to wait for glibc-2.30 ?

Comment 2 Florian Weimer 2019-03-08 13:26:32 UTC
Just call your implementation something else, not gettid.  Then you won't need any preprocessor check at all.

Does this answer your question?  Thanks.

Comment 3 Petr Lautrbach 2019-03-08 13:59:22 UTC
I'm not sure.

There's an upstrem code:
https://github.com/SELinuxProject/selinux/blob/5e33a44c666b966de50121b2e93198d6da65d696/libselinux/src/procattr.c#L25

It works with glibc < 2.29.9000-1. It could work with 2.30 with a correct usage of __GLIBC_PREREQ(2,30). But now we have 2.29 with gettid() wrapper.

Do I get it right that you suggest to use something else than gettid() syscall, resp the new gettid() glibc wrapper?

Comment 4 Florian Weimer 2019-03-08 14:17:44 UTC
There is no reason to call this function in libselinux “gettid”.  If you use any other name, the name conflict goes away.

Comment 5 Petr Lautrbach 2019-03-08 15:33:09 UTC
Given that the shared library is already built with "gettid@@GLIBC_2.30" could be possibly glibc version updated to something like glibc-2.30-0.X [1] with "__GLIBC_MINOR__ 30"?

[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/#_prerelease_versions