From: Eric Wong Date: Tue, 31 Aug 2021 11:21:21 +0000 (+0000) Subject: t/lei-watch: avoid race between glob + readlink X-Git-Tag: v1.7.0~470 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=a5990c69ff5a2e075d21e862033659707f2507a3;p=public-inbox.git 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. --- 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];