bug#80336: PATCH: coreutils 9.10 will not build on UNIX systems that lack SELinux support

Pádraig Brady <[email protected]> Thu, 5 Feb 2026 16:42:44 +0000
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <[email protected]>
On 05/02/2026 11:50, Richard Lloyd via GNU coreutils Bug Reports wrote:
> I am building coreutils 9.10 on HP-UX 11.31 (Itanium) and that system doesn't
> have SELinux support. While some code in coreutils 9.10 is surrounded by
> a check for SELinux support, two source files in particular make multiple
> SELinux calls without any such check: src/copy.c and src/mkfifo.c.
> 
> Even the inclusion of <selinux/selinux.h> or <selinux/label.h> is done
> unconditionally in both src/copy.c and src/mkfifo.c, despite lib/config.h
> being generated with a definitions (or not) of HAVE_SELINUX_SELINUX_H and
> HAVE_SELINUX_LABEL_H. To get the code to compile on
> HP-UX, I added a #if HAVE_SELINUX_SELINUX_H...#endif or
> #if HAVE_SELINUX_LABEL_H...#endif around any SELinux-related
> code. I've included the patch to do this below.

Hi Richard.

I'm a bit confused at the build failure as gnulib
is supposed to provide stub selinux headers and libs when not available.
For example 9.10 compiles fine for v9.10 on Solaris.
There I have this configuration:

solaris11$ grep SELINUX lib/config.h
/* #undef HAVE_SELINUX_CONTEXT_H */
/* #undef HAVE_SELINUX_FLASK_H */
/* #undef HAVE_SELINUX_LABEL_H */
/* #undef HAVE_SELINUX_SELINUX_H */
#define USE_SELINUX_SELINUX_H 0


Also I'm wondering why you're not seeing the same issue with
id.c, install.c, mkdir.c, mknod.c, stat.c

thanks,
Padraig