8000 Skip pg_baseback long filename test if path too long on Windows · postgres/postgres@2e99ce6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2e99ce6

Browse files
committed
Skip pg_baseback long filename test if path too long on Windows
On Windows, it's sometimes difficult to create a file with a path longer than 255 chars, and if it can be created it might not be seen by the archiver. This can be triggered by the test for tar backups with filenames greater than 100 bytes. So we skip that test if the path would exceed 255. Backpatch to all live branches. Reviewed by Daniel Gustafsson Discussion: https://postgr.es/m/666ac55b-3400-fb2c-2cea-0281bf36a53c@dunslane.net
1 parent 988719b commit 2e99ce6

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,23 @@
196196
[ 'pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', "-Tfoo" ],
197197
'-T with invalid format fails');
198198

199-
# Tar format doesn't support filenames longer than 100 bytes.
200199
my $superlongname = "superlongname_" . ("x" x 100);
201-
my $superlongpath = "$pgdata/$superlongname";
200+
# Tar format doesn't support filenames longer than 100 bytes.
201+
SKIP:
202+
{
203+
my $superlongpath = "$pgdata/$superlongname";
202204

203-
open my $file, '>', "$superlongpath"
204-
or die "unable to create file $superlongpath";
205-
close $file;
206-
$node->command_fails(
207-
[ 'pg_basebackup', '-D', "$tempdir/tarbackup_l1", '-Ft' ],
208-
'pg_basebackup tar with long name fails');
209-
unlink "$pgdata/$superlongname";
205+
skip "File path too long", 1
206+
if $windows_os && length($superlongpath) > 255;
207+
208+
open my $file, '>', "$superlongpath"
209+
or die "unable to create file $superlongpath";
210+
close $file;
211+
$node->command_fails(
212+
[ 'pg_basebackup', '-D', "$tempdir/tarbackup_l1", '-Ft' ],
213+
'pg_basebackup tar with long name fails');
214+
unlink "$superlongpath";
215+
}
210216

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

0 commit comments

Comments
 (0)
0