Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1fa25ce

Browse filesBrowse 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 3142a88 commit 1fa25ce
Copy full SHA for 1fa25ce

File tree

1 file changed

+15
-13
lines changed
Filter options

1 file changed

+15
-13
lines changed

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

Copy file name to clipboardExpand all lines: src/bin/pg_basebackup/t/010_pg_basebackup.pl
+15-13Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -310,21 +310,23 @@
310310
[ @pg_basebackup_defs, '-D', "$tempdir/backup_foo", '-Fp', "-Tfoo" ],
311311
'-T with invalid format fails');
312312

313-
# 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";
318313
my $superlongname = "superlongname_" . ("x" x 100);
319-
my $superlongpath = "$lftmp/pgdata/$superlongname";
314+
# Tar format doesn't support filenames longer than 100 bytes.
315+
SKIP:
316+
{
317+
my $superlongpath = "$pgdata/$superlongname";
320318

321-
open my $file, '>', "$superlongpath"
322-
or die "unable to create file $superlongpath";
323-
close $file;
324-
$node->command_fails(
325-
[ @pg_basebackup_defs, '-D', "$tempdir/tarbackup_l1", '-Ft' ],
326-
'pg_basebackup tar with long name fails');
327-
unlink "$superlongpath";
319+
skip "File path too long", 1
320+
if $windows_os && length($superlongpath) > 255;
321+
322+
open my $file, '>', "$superlongpath"
323+
or die "unable to create file $superlongpath";
324+
close $file;
325+
$node->command_fails(
326+
[ @pg_basebackup_defs, '-D', "$tempdir/tarbackup_l1", '-Ft' ],
327+
'pg_basebackup tar with long name fails');
328+
unlink "$superlongpath";
329+
}
328330

329331
# The following tests are for symlinks.
330332

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.