Re: Fix broken Install.bat when target directory contains a space

From: Asif Naeem <anaeem(dot)it(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix broken Install.bat when target directory contains a space
Date: 2015-04-16 08:40:09
Message-ID: CAEB4t-PBHDKM+iiAuf-n2YC5ZEQGrPf1OSo0RX6O6PrkNDp+KA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Michael,

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

2.

> C:\PG\postgresql\src\tools\msvc>install
> Usage: install.pl <targetdir> [installtype]
> installtype: client
>

3.

> 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
<http://install.pl>* <targetdir> [installtype]' but (3) shows usage message
as 'Usage: "*install.bat* <path>"'. Thanks.

Regards,
Muhammad Asif Naeem

On Mon, Mar 2, 2015 at 9:27 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:

> Hi all,
>
> 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
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2015-04-16 09:17:57 Re: Turning off HOT/Cleanup sometimes
Previous Message Shigeru HANADA 2015-04-16 08:05:53 Re: Custom/Foreign-Join-APIs (Re: [v9.5] Custom Plan API)