On Android, in the Termux environment, I initially saw link errors.
After fixing these in Gnulib (commit fe762f82eac67c9af699c90e0eeeb07a1ba67dfd),
the coreutils build succeeds, but several unit tests report that they
get SKIPped because of lack of SELinux support.

The cause is the require_selinux_ function: It checks only if
/proc/filesystems lists an selinuxfs file system. But on Android,
/proc/filesystems is not readable to a normal user ("Permission denied").
Therefore an alternative way is needed, to detect that the system
has SELinux support: looking at the output of the 'mount' program.
The attached proposed patch does this, and the said unit tests then
PASS.

"make check" then shows 15 ERROR and 60 FAIL (the same number as without
the patch). Find the log attached.

ERROR: tests/ls/ls-time
ERROR: tests/cp/attr-existing
ERROR: tests/cp/link-preserve
ERROR: tests/cp/preserve-link
ERROR: tests/dd/misc
ERROR: tests/du/hard-link
ERROR: tests/du/inodes
ERROR: tests/ln/misc
ERROR: tests/mv/force
ERROR: tests/mv/hard-2
ERROR: tests/mv/hard-3
ERROR: tests/mv/hard-4
ERROR: tests/mv/i-link-no
ERROR: tests/mv/symlink-onto-hardlink
ERROR: tests/mv/symlink-onto-hardlink-to-self

FAIL: tests/help/help-version
FAIL: link
FAIL: ln
FAIL: tests/fmt/base
FAIL: tests/env/env
FAIL: tests/env/env-signal-handler
FAIL: tests/test/test
FAIL: tests/seq/seq
FAIL: tests/ls/ls-misc
FAIL: tests/date/date
FAIL: tests/misc/xstrtol
FAIL: tests/mktemp/mktemp
FAIL: tests/pr/pr-tests
FAIL: tests/misc/basename
FAIL: tests/basenc/base64
FAIL: tests/basenc/basenc
FAIL: tests/misc/close-stdout
FAIL: tests/chroot/chroot-fail
FAIL: tests/misc/comm
FAIL: tests/csplit/csplit
FAIL: tests/date/date-debug
FAIL: tests/env/env-S
FAIL: tests/expand/expand
FAIL: tests/expr/expr
FAIL: tests/factor/factor
FAIL: tests/groups/groups-dash
FAIL: tests/cksum/b2sum
FAIL: tests/join/join
FAIL: tests/numfmt/numfmt
FAIL: tests/printf/printf
FAIL: tests/printf/printf-cov
FAIL: tests/printf/printf-indexed
FAIL: tests/cksum/cksum-sha3
FAIL: tests/shred/shred-size
FAIL: tests/sort/sort
FAIL: tests/sort/sort-debug-warn
FAIL: tests/sort/sort-merge
FAIL: tests/sort/sort-merge-fdlimit
FAIL: tests/split/l-chunk
FAIL: tests/stat/stat-fmt
FAIL: tests/stat/stat-printf
FAIL: tests/tac/tac-2-nonseekable
FAIL: tests/tail/tail
FAIL: tests/test/test-diag
FAIL: tests/timeout/timeout
FAIL: tests/tr/tr
FAIL: tests/misc/tsort
FAIL: tests/uniq/uniq
FAIL: tests/cp/link
FAIL: tests/cp/link-deref
FAIL: tests/cp/link-symlink
FAIL: tests/cp/same-file
FAIL: tests/df/df-output
FAIL: tests/du/files0-from
FAIL: tests/install/basic-1
FAIL: tests/ln/backup-1
FAIL: tests/ln/hard-to-sym
FAIL: tests/ls/time-style-diag
FAIL: tests/mv/childproof
FAIL: tests/mv/dup-source
FAIL: tests/mv/i-4
FAIL: tests/tail/follow-stdin

>From 43644532f5d19c673dba306b7a704082d7b48fa7 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sat, 24 Jan 2026 07:42:33 +0100
Subject: [PATCH] tests: recognize SELinux support on Android

* init.cfg (require_selinux_): Also try to see if 'mount' lists the
selinuxfs.
---
 init.cfg | 1 +
 1 file changed, 1 insertion(+)

diff --git a/init.cfg b/init.cfg
index 9224c5df0..ae02adcfd 100644
--- a/init.cfg
+++ b/init.cfg
@@ -112,6 +112,7 @@ require_selinux_()
   # When in a chroot of an SELinux-enabled system, but with a mock-simulated
   # SELinux-*disabled* system, recognize that SELinux is disabled system wide:
   grep 'selinuxfs$' /proc/filesystems > /dev/null \
+    || { mount | grep ' type selinuxfs ' > /dev/null; } \
     || skip_ "this system lacks SELinux support"
 
   # Independent of whether SELinux is enabled system-wide,
-- 
2.52.0

Attachment: test-suite.log.xz
Description: application/xz

Reply via email to