I spend spend time look into the patch. Good catch, I am also surprised to see that current Windows install script don’t support spaces in the path. Please see my findings as following i.e.
Without the patch
1.
C:\PG\postgresql\src\tools\msvc>install "C:\PG\postgresql\inst with space without patch" with was unexpected at this time.
2.
C:\PG\postgresql\src\tools\msvc>install Invalid command line options. Usage: "install.bat <path>"
3.
C:\PG\postgresql\src\tools\msvc>install /? Installing version 9.5 for release in /? Copying build output files...Could not copy release\postgres\postgres.exe to /?\bin\postgres.exe at Install.pm line 40 Install::lcopy('release\postgres\postgres.exe', '/?\bin\postgres.exe') called at Install.pm line 324 Install::CopySolutionOutput('release', '/?') called at Install.pm line 93 Install::Install('/?', undef) called at install.pl line 13
With the patch
1.
C:\PG\postgresql\src\tools\msvc>install "C:\PG\postgresql\inst with space without patch" Works fine.
C:\PG\postgresql\src\tools\msvc>install /? Invalid command line options. Usage: "install.bat <path>"
Following change looks confusing to me i.e.
-if NOT "%1"=="" GOTO RUN_INSTALL +if NOT [%1]==[/?] GOTO RUN_INSTALL
Along with fixing the space in installation path, it is also changing the behavior of install script, why not just "if NOT [%1]==[] GOTO RUN_INSTALL", checking for "/?" seems good for help message but it seem not well handled in the script, it is still saying “Invalid command line options.”, along with this, option "/?" seems not handled by any other .bat build script. Other than this, with the patch applied, is it an acceptable behavior that (2) shows usage message as 'Usage:install.pl <targetdir> [installtype]' but (3) shows usage message as 'Usage: "install.bat <path>"'. Thanks.
When using install.bat with a path containing spaces, I got surprised by a couple of errors. 1) First with this path: $ install "c:\Program Files\pgsql" I am getting the following error: Files\pgsql""=="" was unexpected at this time. This is caused by an incorrect evaluation of the first parameter in install.bat. 2) After correcting the first error, the path is truncated to c:\Program because first argument value does not seem to be correctly parsed when used with install.pl.
Attached is a patch fixing both problems. I imagine that it would be good to get that backpatched. Regards, -- Michael