Skip to content

Commit f7d7453

Browse files
committed
Allow ENOENT in check_mode_recursive().
Buildfarm member tern failed src/bin/pg_ctl/t/001_start_stop.pl when a check_mode_recursive() call overlapped a server's startup-time deletion of pg_stat/global.stat. Just warn. Also, include errno in the message. Back-patch to v11, where check_mode_recursive() first appeared.
1 parent 475c1fb commit f7d7453

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/test/perl/TestLib.pm

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,6 @@ sub check_mode_recursive
261261
{
262262
follow_fast => 1,
263263
wanted => sub {
264-
my $file_stat = stat($File::Find::name);
265-
266264
# Is file in the ignore list?
267265
foreach my $ignore ($ignore_list ? @{$ignore_list} : [])
268266
{
@@ -272,8 +270,23 @@ sub check_mode_recursive
272270
}
273271
}
274272

275-
defined($file_stat)
276-
or die("unable to stat $File::Find::name");
273+
# Allow ENOENT. A running server can delete files, such as
274+
# those in pg_stat. Other stat() failures are fatal.
275+
my $file_stat = stat($File::Find::name);
276+
unless (defined($file_stat))
277+
{
278+
my $is_ENOENT = $!{ENOENT};
279+
my $msg = "unable to stat $File::Find::name: $!";
280+
if ($is_ENOENT)
281+
{
282+
warn $msg;
283+
return;
284+
}
285+
else
286+
{
287+
die $msg;
288+
}
289+
}
277290

278291
my $file_mode = S_IMODE($file_stat->mode);
279292

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy