From a5990c69ff5a2e075d21e862033659707f2507a3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 31 Aug 2021 11:21:21 +0000 Subject: [PATCH] t/lei-watch: avoid race between glob + readlink Open file handles in lei-daemon may be unstable so we need to account for readlink() returning undef. --- t/lei-watch.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/lei-watch.t b/t/lei-watch.t index 86fa6649..a881fbb9 100644 --- a/t/lei-watch.t +++ b/t/lei-watch.t @@ -25,7 +25,7 @@ test_lei(sub { lei_ok 'daemon-pid'; chomp(my $pid = $lei_out); skip 'missing /proc/$PID/fd', 1 if !-d "/proc/$pid/fd"; my @ino = grep { - readlink($_) =~ /\binotify\b/ + (readlink($_) // '') =~ /\binotify\b/ } glob("/proc/$pid/fd/*"); is(scalar(@ino), 1, 'only one inotify FD'); my $ino_fd = (split('/', $ino[0]))[-1]; -- 2.48.1