Skip site navigation (1) Skip section navigation (2)

More canonicalization fixes

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>,PostgreSQL Win32 port list <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: More canonicalization fixes
Date: 2004-07-12 19:26:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers-win32pgsql-patches
I just applied this new version of canonicalize_path():
	 * Make all paths look like Unix
	canonicalize_path(char *path)
	#ifdef WIN32
	     * The Windows command processor will accept suitably quoted paths
	     * with forward slashes, but barfs badly with mixed forward and back
	     * slashes.
	    char       *p;
	    for (p = path; *p; p++)
	        if (*p == '\\')
	            *p = '/';

	    /*  In Win32, if you do:
	     *      prog.exe "a b" "\c\d\"
	     *  the system will pass \c\d" as argv[2].
	    if (p > path && *(p-1) == '"')
	        *(p-1) = '/';
	     *  Removing the trailing slash on a path means we never get
	     *  ugly double slashes.  Don't remove a leading slash, though.
	     *  Also, Win32 can't stat() a directory with a trailing slash.

The new thing Magnus found was this in Win32:

	prog.exe "a b" "\c\d\"

returns \c\d" as argv[2]

Quite amazing. The fix on Win32 is to convert a trailing double-quote to
a slash.

  Bruce Momjian                        |
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-patches by date

Next:From: Alvaro HerreraDate: 2004-07-12 19:35:31
Subject: Re: nested xacts: update password file
Previous:From: Bruce MomjianDate: 2004-07-12 19:19:43
Subject: Re: nested xacts: update password file

pgsql-hackers-win32 by date

Next:From: Jason SheetsDate: 2004-07-12 21:21:47
Subject: Re: PostGre and Windows XP
Previous:From: Darko PrenosilDate: 2004-07-12 16:20:10
Subject: Re: PostGre and Windows XP

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group