pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: toni.helenius@syncrontech.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #12755: pg_upgrage creates potentially dangerous delete_old_cluster.bat
Date: Tue, 10 Feb 2015 13:11:16 -0500
Message-ID: <20150210181116.GD18557@momjian.us> (raw)
In-Reply-To: <20150210104441.18791.41198@wrigleys.postgresql.org>
References: <20150210104441.18791.41198@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On Tue, Feb 10, 2015 at 10:44:41AM +0000, toni.helenius@syncrontech.com wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      12755
> Logged by:          Toni Helenius
> Email address:      toni.helenius@syncrontech.com
> PostgreSQL version: 9.4.1
> Operating system:   Windows 7
> Description:        
> 
> pg_upgrage creates potentially dangerous delete_old_cluster.bat. RMDIR
> without quotes.
> 
> RMDIR /s/q C:\Program Files\PostgreSQL\9.3\data
> 
> Executes as:
> RMDIR /s/q C:\Program
> 
> Needs quotes!!

Wow, very good point.  Not sure why this problem was not reported
before.  Patch attached.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachments:

pg_upgrade_rm.diff (text/x-diff, 2.0K) download diff --git a/contrib/pg_upgrade/check.c b/contrib/pg_upgrade/check.c new file mode 100644 index 87e9031..6a498c3 *** a/contrib/pg_upgrade/check.c --- b/contrib/pg_upgrade/check.c *************** create_script_for_old_cluster_deletion(c *** 528,534 **** #endif /* delete old cluster's default tablespace */ ! fprintf(script, RMDIR_CMD " %s\n", fix_path_separator(old_cluster.pgdata)); /* delete old cluster's alternate tablespaces */ for (tblnum = 0; tblnum < os_info.num_old_tablespaces; tblnum++) --- 528,534 ---- #endif /* delete old cluster's default tablespace */ ! fprintf(script, RMDIR_CMD " \"%s\"\n", fix_path_separator(old_cluster.pgdata)); /* delete old cluster's alternate tablespaces */ for (tblnum = 0; tblnum < os_info.num_old_tablespaces; tblnum++) *************** create_script_for_old_cluster_deletion(c *** 550,556 **** PATH_SEPARATOR); for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++) ! fprintf(script, RMDIR_CMD " %s%c%d\n", fix_path_separator(os_info.old_tablespaces[tblnum]), PATH_SEPARATOR, old_cluster.dbarr.dbs[dbnum].db_oid); } --- 550,556 ---- PATH_SEPARATOR); for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++) ! fprintf(script, RMDIR_CMD " \"%s%c%d\"\n", fix_path_separator(os_info.old_tablespaces[tblnum]), PATH_SEPARATOR, old_cluster.dbarr.dbs[dbnum].db_oid); } *************** create_script_for_old_cluster_deletion(c *** 562,568 **** * Simply delete the tablespace directory, which might be ".old" * or a version-specific subdirectory. */ ! fprintf(script, RMDIR_CMD " %s%s\n", fix_path_separator(os_info.old_tablespaces[tblnum]), fix_path_separator(suffix_path)); pfree(suffix_path); --- 562,568 ---- * Simply delete the tablespace directory, which might be ".old" * or a version-specific subdirectory. */ ! fprintf(script, RMDIR_CMD " \"%s%s\"\n", fix_path_separator(os_info.old_tablespaces[tblnum]), fix_path_separator(suffix_path)); pfree(suffix_path);

view thread (3+ messages)  latest in thread

Message-ID: <20150210181116.GD18557@momjian.us>
Permalink:  ../20150210181116.GD18557@momjian.us/
Also on:    postgresql.org/message-id/20150210181116.GD18557@momjian.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: bruce@momjian.us, toni.helenius@syncrontech.com
  Subject: Re: BUG #12755: pg_upgrage creates potentially dangerous delete_old_cluster.bat
  In-Reply-To: <20150210181116.GD18557@momjian.us>
  References: <20150210104441.18791.41198@wrigleys.postgresql.org> <20150210181116.GD18557@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox