]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
ts/kill/decode: compare decoded output in an architecture-independent way
authorMasatake YAMATO <yamato@redhat.com>
Fri, 10 Oct 2025 21:51:51 +0000 (06:51 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Fri, 10 Oct 2025 21:54:47 +0000 (06:54 +0900)
Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Fixed: https://github.com/util-linux/util-linux/issues/3774
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
tests/expected/kill/decode
tests/ts/kill/decode

index 421037772b0469acd6b68e222e729a45bb8f1249..16f4a36610830af8734c460d31eefc3df3fc3f1b 100644 (file)
@@ -13,8 +13,25 @@ PIPE
 ALRM
 encode-decode round-trip "USR1":
 USR1
-Pending (thread): INT ILL 
-Pending (process): USR1 
-Blocked: INT ILL ABRT FPE USR1 SEGV TERM 
-Ignored: HUP QUIT TRAP PIPE ALRM 
-Caught: ILL USR1 
+Pending (thread):
+ILL
+INT
+Pending (process):
+USR1
+Blocked:
+ABRT
+FPE
+ILL
+INT
+SEGV
+TERM
+USR1
+Ignored:
+ALRM
+HUP
+PIPE
+QUIT
+TRAP
+Caught:
+ILL
+USR1
index 3b0d4506dbc4150210e9cac368980d3126adf775..ace98ecfd191c7d5b4806cd8f2b5a15887484b5a 100755 (executable)
@@ -29,6 +29,8 @@ ts_check_test_command "$TS_CMD_KILL"
 ts_check_test_command "$TS_HELPER_SIGSTATE"
 
 ts_check_prog "sed"
+ts_check_prog "sort"
+ts_check_prog "tr"
 
 . "$TS_SELF/kill_functions.sh"
 
@@ -72,6 +74,17 @@ encode()
     printf "0x%0.16x\n" "$bits"
 }
 
+sort_signals_by_name()
+{
+    local field
+    local siglist
+
+    while IFS=: read field siglist; do
+       echo "${field}:"
+       echo $siglist | tr ' ' '\n' | sort
+    done
+}
+
 PID=
 ACK=
 {
@@ -107,7 +120,7 @@ ACK=
                else
                    cat
                fi
-           }
+           } | sort_signals_by_name
        fi
        echo DONE >&"${SIGSTATE[1]}"
     fi