Skip to content

Commit 088e395

Browse files
committed
Improve pg_basebackup long file name test Windows robustness
Creation of a file with a very long name can create problems on Windows due to its file path limits. Work around that by creating the file via a symlink with a shorter name. Error displayed by buildfarm animal fairywren.o Backpatch to all live branches
1 parent af36c13 commit 088e395

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/bin/pg_basebackup/t/010_pg_basebackup.pl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,20 @@
197197
'-T with invalid format fails');
198198

199199
# Tar format doesn't support filenames longer than 100 bytes.
200+
# Create the test file via a short name directory so it doesn't blow the
201+
# Windows path limit.
202+
my $lftmp = PostgreSQL::Test::Utils::tempdir_short;
203+
dir_symlink "$pgdata", "$lftmp/pgdata";
200204
my $superlongname = "superlongname_" . ("x" x 100);
201-
my $superlongpath = "$pgdata/$superlongname";
205+
my $superlongpath = "$lftmp/pgdata/$superlongname";
202206

203207
open my $file, '>', "$superlongpath"
204208
or die "unable to create file $superlongpath";
205209
close $file;
206210
$node->command_fails(
207211
[ 'pg_basebackup', '-D', "$tempdir/tarbackup_l1", '-Ft' ],
208212
'pg_basebackup tar with long name fails');
209-
unlink "$pgdata/$superlongname";
213+
unlink "$superlongpath";
210214

211215
# The following tests test symlinks. Windows doesn't have symlinks, so
212216
# skip on Windows.

0 commit comments

Comments
 (0)