As the title suggests, for some reason when I run the "wc -l" command that belongs to GNU coreutils, I get a core dump because of a SIGILL (illegal instruction). All other options seem to be fine except for "-l":
$ 0: for option in c m l L w; do echo -n "-$option: "; dd if=/dev/urandom count=5 2>/dev/null | wc -$option; done
-c: 2560
-m: 1367
-l: Illegal instruction (core dumped)
-L: 143
-w: 54
What is weirder is that in combination with other options, it works as expected:
$ 0: dd if=/dev/urandom count=5 2>/dev/null | wc -c -m -l -L -w
8 52 1366 2560 145
Here is strace output for GNU "wc -l": https://paste.artixlinux.org/view/c4f6bd60
I've also installed busybox from Arch repos and "wc -l" works fine, so right now I am using it as my main wc command.
I've also tried searching the forums about my problem, but nothing came up.
What I really want to know is if anybody else has this problem, or is it just me?
i noticed this:
in the Slackware current changelog : http://ftp.slackware.com/pub/slackware/slackware64-current/ChangeLog.txt
this is the patch used:
--- ./src/wc.c.orig 2023-04-10 05:14:08.000000000 -0500
+++ ./src/wc.c 2023-08-26 14:22:10.058092456 -0500
@@ -174,14 +174,7 @@
if (avx_enabled)
{
- eax = ebx = ecx = edx = 0;
- if (! __get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx))
- getcpuid_ok = false;
- else
- {
- if (! (ebx & bit_AVX2))
- avx_enabled = false; /* Hardware doesn't support it. */
- }
+ avx_enabled = false; /* Never use AVX2. */
}
i also see that arch have removed all their patches, while the artix package still retains them..
fwiw, on obarun atm, which uses arch's coreutils, it seems to work fine:
for option in c m l L w; do echo -n "-$option: "; dd if=/dev/urandom count=5 2>/dev/null | wc -$option; done
-c: 2560
-m: 1379
-l: 7
-L: 151
-w: 60
EDIT: now checked in artix, and wc -l works fine.. looking again at the slackware thing, i guess it may require a specific hardware/microcode/kernel combination, that i don't have.
Problem is fixed now, GNU coreutils "wc -l" no longer core dumps.
Special thanks to Artix team, marking as solved.