Index: src/bin/pg_ctl/pg_ctl.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_ctl/pg_ctl.c,v
retrieving revision 1.42
diff -c -c -r1.42 pg_ctl.c
*** src/bin/pg_ctl/pg_ctl.c	22 Oct 2004 00:24:18 -0000	1.42
--- src/bin/pg_ctl/pg_ctl.c	27 Oct 2004 17:10:58 -0000
***************
*** 1279,1297 ****
  			{
  				case 'D':
  					{
! 						int			len = strlen(optarg);
! 						char	   *env_var;
  
! 						env_var = xmalloc(len + 8);
! 						snprintf(env_var, len + 8, "PGDATA=%s", optarg);
  						putenv(env_var);
  
  						/*
! 						 * Show -D for easier postmaster 'ps'
! 						 * identification
  						 */
! 						pgdata_opt = xmalloc(len + 7);
! 						snprintf(pgdata_opt, len + 7, "-D \"%s\" ", optarg);
  						break;
  					}
  				case 'l':
--- 1279,1301 ----
  			{
  				case 'D':
  					{
! 						char	   *pgdata_D = xmalloc(strlen(optarg));
! 						char	   *env_var = xmalloc(strlen(optarg) + 8);
  
! 						strcpy(pgdata_D, optarg);
! 						canonicalize_path(pgdata_D);
! 						snprintf(env_var, strlen(pgdata_D) + 8, "PGDATA=%s",
! 								 pgdata_D);
  						putenv(env_var);
  
  						/*
! 						 *	We could pass PGDATA just in an environment
! 						 *	variable but we do -D too for clearer
! 						 *	postmaster 'ps' display
  						 */
! 						pgdata_opt = xmalloc(strlen(pgdata_D) + 7);
! 						snprintf(pgdata_opt, strlen(pgdata_D) + 7, "-D \"%s\" ",
! 								 pgdata_D);
  						break;
  					}
  				case 'l':
Index: src/port/path.c
===================================================================
RCS file: /cvsroot/pgsql/src/port/path.c,v
retrieving revision 1.37
diff -c -c -r1.37 path.c
*** src/port/path.c	24 Oct 2004 22:08:19 -0000	1.37
--- src/port/path.c	27 Oct 2004 17:11:01 -0000
***************
*** 115,121 ****
  
  
  /*
!  * Make all paths look like Unix
   */
  void
  canonicalize_path(char *path)
--- 115,126 ----
  
  
  /*
!  *	Clean up path by:
!  *		o  make Win32 path use Unix slashes
!  *		o  remove trailling quote on Win32
!  *		o  remove trailling slash
!  *		o  remove trailing '.'
!  *		o  process trailing '..' ourselves
   */
  void
  canonicalize_path(char *path)
***************
*** 145,157 ****
  
  	/*
  	 * Removing the trailing slash on a path means we never get ugly
! 	 * double slashes.	Also, Win32 can't stat() a directory with a
! 	 * trailing slash. Don't remove a leading slash, though.
  	 */
  	trim_trailing_separator(path);
  
  	/*
! 	 * Remove any trailing uses of "." or "..", too.
  	 */
  	for (;;)
  	{
--- 150,162 ----
  
  	/*
  	 * Removing the trailing slash on a path means we never get ugly
! 	 * double trailing slashes.	Also, Win32 can't stat() a directory
! 	 * with a trailing slash. Don't remove a leading slash, though.
  	 */
  	trim_trailing_separator(path);
  
  	/*
! 	 * Remove any trailing uses of "." and process ".." ourselves
  	 */
  	for (;;)
  	{
***************
*** 165,171 ****
  		else if (len >= 3 && strcmp(path + len - 3, "/..") == 0)
  		{
  			trim_directory(path);
! 			trim_directory(path);
  			trim_trailing_separator(path);
  		}
  		else
--- 170,176 ----
  		else if (len >= 3 && strcmp(path + len - 3, "/..") == 0)
  		{
  			trim_directory(path);
! 			trim_directory(path);	/* remove directory above */
  			trim_trailing_separator(path);
  		}
  		else
