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

Поиск
Список
Период
Сортировка
От Asif Naeem
Тема Re: Fix broken Install.bat when target directory contains a space
Дата
Msg-id CAEB4t-PBHDKM+iiAuf-n2YC5ZEQGrPf1OSo0RX6O6PrkNDp+KA@mail.gmail.com
обсуждение исходный текст
Ответ на Fix broken Install.bat when target directory contains a space  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: Fix broken Install.bat when target directory contains a space  (Michael Paquier <michael.paquier@gmail.com>)
Список 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 <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.paquier@gmail.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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Shigeru HANADA
Дата:
Сообщение: Re: Custom/Foreign-Join-APIs (Re: [v9.5] Custom Plan API)
Следующее
От: Greg Stark
Дата:
Сообщение: Re: Turning off HOT/Cleanup sometimes