aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2018-09-08 18:26:10 -0700
committerNoah Misch <noah@leadboat.com>2018-09-08 18:26:17 -0700
commitf7d745318b180634e8bb1734867caaf71b00b305 (patch)
tree4624952a1e14a23c58b8576725b89122fcc69902
parent475c1fb5a765da70a77f9f24454977a873d96dc4 (diff)
downloadpostgresql-f7d745318b180634e8bb1734867caaf71b00b305.tar.gz
postgresql-f7d745318b180634e8bb1734867caaf71b00b305.zip
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.
-rw-r--r--src/test/perl/TestLib.pm21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index fda6760226d..8a29740743e 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -261,8 +261,6 @@ sub check_mode_recursive
{
follow_fast => 1,
wanted => sub {
- my $file_stat = stat($File::Find::name);
-
# Is file in the ignore list?
foreach my $ignore ($ignore_list ? @{$ignore_list} : [])
{
@@ -272,8 +270,23 @@ sub check_mode_recursive
}
}
- defined($file_stat)
- or die("unable to stat $File::Find::name");
+ # Allow ENOENT. A running server can delete files, such as
+ # those in pg_stat. Other stat() failures are fatal.
+ my $file_stat = stat($File::Find::name);
+ unless (defined($file_stat))
+ {
+ my $is_ENOENT = $!{ENOENT};
+ my $msg = "unable to stat $File::Find::name: $!";
+ if ($is_ENOENT)
+ {
+ warn $msg;
+ return;
+ }
+ else
+ {
+ die $msg;
+ }
+ }
my $file_mode = S_IMODE($file_stat->mode);