Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit4ba0ffa

Browse files
committed
pg_basebackup: Fix comparison handling of tablespace mappings on Windows
A candidate path needs to be canonicalized before being checked againstthe mappings, because the mappings are also canonicalized. This isespecially relevant on WindowsReported-by: nb <nbedxp@gmail.com>Author: Michael Paquier <michael.paquier@gmail.com>Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>
1 parente0ec1cb commit4ba0ffa

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

‎src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ tablespace_list_append(const char *arg)
201201
exit(1);
202202
}
203203

204+
/*
205+
* Comparisons done with these values should involve similarly
206+
* canonicalized path values. This is particularly sensitive on Windows
207+
* where path values may not necessarily use Unix slashes.
208+
*/
204209
canonicalize_path(cell->old_dir);
205210
canonicalize_path(cell->new_dir);
206211

@@ -1131,9 +1136,14 @@ static const char *
11311136
get_tablespace_mapping(constchar*dir)
11321137
{
11331138
TablespaceListCell*cell;
1139+
charcanon_dir[MAXPGPATH];
1140+
1141+
/* Canonicalize path for comparison consistency */
1142+
strlcpy(canon_dir,dir,sizeof(canon_dir));
1143+
canonicalize_path(canon_dir);
11341144

11351145
for (cell=tablespace_dirs.head;cell;cell=cell->next)
1136-
if (strcmp(dir,cell->old_dir)==0)
1146+
if (strcmp(canon_dir,cell->old_dir)==0)
11371147
returncell->new_dir;
11381148

11391149
returndir;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp