On Tue, Jun 27, 2017 at 7:46 PM, Ashutosh Sharma <ashu.coe...@gmail.com> wrote: > I am still seeing the issue with the attached patch. I had a quick > look into the patch. It seems to me like you have canonicalized the > tablespace path to convert win32 slashes to unix type of slashes but > that is not being passed to strcmp() function and probably that could > be the reason why the issue is still existing. Thanks. > > for (cell = tablespace_dirs.head; cell; cell = cell->next) > - if (strcmp(dir, cell->old_dir) == 0) > + if (strcmp(canon_dir, cell->old_dir) == 0)
Thanks. I had the correct version on my Windows box actually, just messed up the attachment. -- Michael
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index 3ad06995ec..f7c1cc826a 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -295,6 +295,11 @@ tablespace_list_append(const char *arg) exit(1); } + /* + * Comparisons done with those values should involve similarly + * canonicalized path values. This is particularly sensitive on + * Windows where path values may not necessarily use Unix slashes. + */ canonicalize_path(cell->old_dir); canonicalize_path(cell->new_dir); @@ -1279,9 +1284,14 @@ static const char * get_tablespace_mapping(const char *dir) { TablespaceListCell *cell; + char canon_dir[MAXPGPATH]; + + /* Canonicalize path for comparison consistency */ + strcpy(canon_dir, dir); + canonicalize_path(canon_dir); for (cell = tablespace_dirs.head; cell; cell = cell->next) - if (strcmp(dir, cell->old_dir) == 0) + if (strcmp(canon_dir, cell->old_dir) == 0) return cell->new_dir; return dir;
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers