On 17/01/2025 16:00, Bruno Haible wrote:
On
- OpenBSD 6.0,
- NetBSD 7.1
I see a test failure:
FAIL tests/ls/selinux-segfault.sh (exit status: 1)
Log is attached.
The cause is a crash that is easy to reproduce interactively:
$ src/ls -Z .
In gdb, I get this stack trace (same on both platforms):
#0 strlen
#1 gobble_file (name = ".", type=arg_directory, inode=0,
command_line_arg=true, dirname=0x0)
at ls.c:3627
#2 main () at ls.c:1812
The problem is that file_has_aclinfo_cache (called from ls.c:3526)
has returned
ai = { size = 0, scontext = 0x0, scontext_err = 0, ... }
Hmm. So these platforms must not set an error,
but also return no context. I suppose something like
this untested gnulib patch would help:
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.cindex
c02cfee842..cda7012408 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -253,7 +253,7 @@ get_aclinfo (char const *name, struct aclinfo *ai, int
flags)
}
}
ai->scontext_err = scontext_err;
- if (scontext_err)
+ if (scontext_err || !ai->scontext)
ai->scontext = (char *) UNKNOWN_SECURITY_CONTEXT;
}
Given the issue seems restricted to these platforms,
the impact on just released coreutils 9.6 should be minimal.
cheers,
Pádraig