Skip to content

Commit 08aaae4

Browse files
committed
pg_upgrade: quote directory names in delete_old_cluster script
This allows the delete script to properly function when special characters appear in directory paths, e.g. spaces. Backpatch through 9.0
1 parent 55179b0 commit 08aaae4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

contrib/pg_upgrade/check.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ create_script_for_old_cluster_deletion(
483483
#endif
484484

485485
/* delete old cluster's default tablespace */
486-
fprintf(script, RMDIR_CMD " %s\n", fix_path_separator(old_cluster.pgdata));
486+
fprintf(script, RMDIR_CMD " \"%s\"\n", fix_path_separator(old_cluster.pgdata));
487487

488488
/* delete old cluster's alternate tablespaces */
489489
for (tblnum = 0; tblnum < os_info.num_tablespaces; tblnum++)
@@ -507,7 +507,7 @@ create_script_for_old_cluster_deletion(
507507

508508
for (dbnum = 0; dbnum < new_cluster.dbarr.ndbs; dbnum++)
509509
{
510-
fprintf(script, RMDIR_CMD " %s%s%c%d\n",
510+
fprintf(script, RMDIR_CMD " \"%s%s%c%d\"\n",
511511
fix_path_separator(os_info.tablespaces[tblnum]),
512512
fix_path_separator(old_cluster.tablespace_suffix),
513513
PATH_SEPARATOR, old_cluster.dbarr.dbs[dbnum].db_oid);
@@ -519,7 +519,7 @@ create_script_for_old_cluster_deletion(
519519
* Simply delete the tablespace directory, which might be ".old"
520520
* or a version-specific subdirectory.
521521
*/
522-
fprintf(script, RMDIR_CMD " %s%s\n",
522+
fprintf(script, RMDIR_CMD " \"%s%s\"\n",
523523
fix_path_separator(os_info.tablespaces[tblnum]),
524524
fix_path_separator(old_cluster.tablespace_suffix));
525525
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy