open(my $fh, '>', $pathname) || die "open $pathname: $!";
print $fh "This is an extra file.\n";
close($fh);
+ return;
}
# Add a file into the root directory of the backup.
{
my ($backup_path) = @_;
create_extra_file($backup_path, "extra_file");
+ return;
}
# Add a file inside the user-defined tablespace.
slurp_dir("$backup_path/pg_tblspc/$tsoid/$catvdir");
create_extra_file($backup_path,
"pg_tblspc/$tsoid/$catvdir/$tsdboid/extra_ts_file");
+ return;
}
# Remove a file.
my ($backup_path) = @_;
my $pathname = "$backup_path/pg_xact/0000";
unlink($pathname) || die "$pathname: $!";
+ return;
}
# Remove the symlink to the user-defined tablespace.
{
unlink($pathname) || die "$pathname: $!";
}
+ return;
}
# Append an additional bytes to a file.
{
my ($backup_path) = @_;
append_to_file "$backup_path/global/pg_control", 'x';
+ return;
}
# Truncate a file to zero length.
my $pathname = "$backup_path/global/pg_control";
open(my $fh, '>', $pathname) || die "open $pathname: $!";
close($fh);
+ return;
}
# Replace a file's contents without changing the length of the file. This is
open(my $fh, '>', $pathname) || die "open $pathname: $!";
print $fh 'q' x length($contents);
close($fh);
+ return;
}
# Corrupt the backup manifest.
{
my ($backup_path) = @_;
append_to_file "$backup_path/backup_manifest", "\n";
+ return;
}
# Create a file that can't be opened. (This is skipped on Windows.)
my ($backup_path) = @_;
my $pathname = "$backup_path/PG_VERSION";
chmod(0, $pathname) || die "chmod $pathname: $!";
+ return;
}
# Create a directory that can't be opened. (This is skipped on Windows.)
my ($backup_path) = @_;
my $pathname = "$backup_path/pg_subtrans";
chmod(0, $pathname) || die "chmod $pathname: $!";
+ return;
}
# Create a directory that can't be searched. (This is skipped on Windows.)
my ($backup_path) = @_;
my $pathname = "$backup_path/base";
chmod(0400, $pathname) || die "chmod $pathname: $!";
+ return;
}
# rmtree can't cope with a mode 400 directory, so change back to 700.
my ($backup_path) = @_;
my $pathname = "$backup_path/base";
chmod(0700, $pathname) || die "chmod $pathname: $!";
+ return;
}