Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9436535

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 a4cfeec commit 9436535

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
@@ -311,16 +311,20 @@
311311
'-T with invalid format fails');
312312

313313
# Tar format doesn't support filenames longer than 100 bytes.
314+
# Create the test file via a short name directory so it doesn't blow the
315+
# Windows path limit.
316+
my $lftmp = PostgreSQL::Test::Utils::tempdir_short;
317+
dir_symlink "$pgdata", "$lftmp/pgdata";
314318
my $superlongname = "superlongname_" . ("x" x 100);
315-
my $superlongpath = "$pgdata/$superlongname";
319+
my $superlongpath = "$lftmp/pgdata/$superlongname";
316320

317321
open my $file, '>', "$superlongpath"
318322
or die "unable to create file $superlongpath";
319323
close $file;
320324
$node->command_fails(
321325
[ @pg_basebackup_defs, '-D', "$tempdir/tarbackup_l1", '-Ft' ],
322326
'pg_basebackup tar with long name fails');
323-
unlink "$pgdata/$superlongname";
327+
unlink "$superlongpath";
324328

325329
# The following tests are for symlinks.
326330

0 commit comments

Comments
 (0)