From 3171c5a44f09b239df2679c2682a230d08d32005 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 3 May 2022 22:04:11 -0400 Subject: [PATCH 1/2] =?UTF-8?q?Make=20t/op/magic.t=20pass=20on=20AlmaLinux?= =?UTF-8?q?=208=E2=80=99s=20kernel.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue #19690 --- t/op/magic.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/t/op/magic.t b/t/op/magic.t index d879406f580d..9af1cef44c39 100644 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -469,7 +469,11 @@ EOP open my $rfh, '<', "/proc/$$/cmdline" or skip "failed to read '/proc/$$/cmdline': $!", $skip; my $got = do { local $/; <$rfh> }; - $got=~s/\0\z//; + + # Some kernels leave a trailing NUL on. Some add a bunch of spaces + # after that NUL. We want neither. + $got=~s/\0\s*\z//; + return $got; }; From 6fb48597ec41b399987a22b37d5e1870eeb53d2c Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Thu, 5 May 2022 13:23:15 -0400 Subject: [PATCH 2/2] =?UTF-8?q?fixup!=20Make=20t/op/magic.t=20pass=20on=20?= =?UTF-8?q?AlmaLinux=208=E2=80=99s=20kernel.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- t/op/magic.t | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/t/op/magic.t b/t/op/magic.t index 9af1cef44c39..3b1d95fc3b6e 100644 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -472,6 +472,16 @@ EOP # Some kernels leave a trailing NUL on. Some add a bunch of spaces # after that NUL. We want neither. + # + # A selection of kernels/distros tested: + # + # 4.18.0-348.20.1.el8_5.x86_64 (AlmaLinux 8.5): NUL then spaces + # 3.10.0-1160.62.1.el7.x86_64 (CentOS 7.9.2009): no NUL nor spaces + # 2.6.32-954.3.5.lve1.4.87.el6.x86_64 (CloudLinux 6.10): ^^ ditto + # + # 5.13.0-1025-raspi (Ubuntu 21.10): NUL only + # 5.10.103-v7+ (RaspiOS 10): NUL only + # $got=~s/\0\s*\z//; return $got;