pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #12755: pg_upgrage creates potentially dangerous delete_old_cluster.bat
3+ messages / 2 participants
[nested] [flat]

* BUG #12755: pg_upgrage creates potentially dangerous delete_old_cluster.bat
@ 2015-02-10 10:44  toni.helenius@syncrontech.com
  0 siblings, 1 reply; 3+ messages in thread

From: toni.helenius@syncrontech.com @ 2015-02-10 10:44 UTC (permalink / raw)
  To: pgsql-bugs

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!!


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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #12755: pg_upgrage creates potentially dangerous delete_old_cluster.bat
@ 2015-02-10 18:11  Bruce Momjian <bruce@momjian.us>
  parent: toni.helenius@syncrontech.com
  0 siblings, 1 reply; 3+ messages in thread

From: Bruce Momjian @ 2015-02-10 18:11 UTC (permalink / raw)
  To: toni.helenius@syncrontech.com; +Cc: pgsql-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);
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: BUG #12755: pg_upgrage creates potentially dangerous delete_old_cluster.bat
@ 2015-02-12 03:07  Bruce Momjian <bruce@momjian.us>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2015-02-12 03:07 UTC (permalink / raw)
  To: toni.helenius@syncrontech.com; +Cc: pgsql-bugs

On Tue, Feb 10, 2015 at 01:11:16PM -0500, Bruce Momjian wrote:
> > Executes as:
> > RMDIR /s/q C:\Program
> > 
> > Needs quotes!!
> 
> Wow, very good point.  Not sure why this problem was not reported
> before.  Patch attached.

Patch applied and backpatched through 9.0.  Thanks for the report.

-- 
  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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2015-02-12 03:07 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-02-10 10:44 BUG #12755: pg_upgrage creates potentially dangerous delete_old_cluster.bat toni.helenius@syncrontech.com
2015-02-10 18:11 ` Bruce Momjian <bruce@momjian.us>
2015-02-12 03:07   ` Bruce Momjian <bruce@momjian.us>

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