Обсуждение: %ENV warnings during builds

Поиск
Список
Период
Сортировка

%ENV warnings during builds

От
Craig Ringer
Дата:
Hi folks

It looks like pgflex.bat and pgbison.bat in the win32 build files would 
benefit from a tweak to eliminate a complaint from Perl.

Perl emits the error:
  Hash %ENV missing the % in argument 1 of each() at -e line 1

on the lines that process buildenv.pl. This is because % in batch files 
is processed differently to on the command line. (Yes, that's stupid). 
Quoting doesn't affect this. Percent signs in batch files that are 
intended to be literals should be doubled, so %ENV should be written %%ENV.

http://support.microsoft.com/kb/75634

I. Hate. Batch. Files.

--
Craig Ringer


Re: %ENV warnings during builds

От
"Andrew Dunstan"
Дата:
On Sun, July 3, 2011 8:14 am, Craig Ringer wrote:
> Hi folks
>
> It looks like pgflex.bat and pgbison.bat in the win32 build files would
> benefit from a tweak to eliminate a complaint from Perl.
>
> Perl emits the error:
>
>    Hash %ENV missing the % in argument 1 of each() at -e line 1
>
> on the lines that process buildenv.pl. This is because % in batch files
> is processed differently to on the command line. (Yes, that's stupid).
> Quoting doesn't affect this. Percent signs in batch files that are
> intended to be literals should be doubled, so %ENV should be written
> %%ENV.
>
> http://support.microsoft.com/kb/75634
>
> I. Hate. Batch. Files.
>


I think you've stumbled on just about all the bits of the MSVC build
system we haven't perlized. Maybe we should complete that task, and turn
clean.bat, pgbison.bat and pgflex.bat into pure one-line wrappers. (It was
done for builddoc just a few weeks ago).

cheers

andrew



Re: %ENV warnings during builds

От
Peter Eisentraut
Дата:
On sön, 2011-07-03 at 20:14 +0800, Craig Ringer wrote:
> It looks like pgflex.bat and pgbison.bat in the win32 build files would 
> benefit from a tweak to eliminate a complaint from Perl.
> 
> Perl emits the error:
> 
>    Hash %ENV missing the % in argument 1 of each() at -e line 1
> 
> on the lines that process buildenv.pl. This is because % in batch files 
> is processed differently to on the command line. (Yes, that's stupid). 
> Quoting doesn't affect this. Percent signs in batch files that are 
> intended to be literals should be doubled, so %ENV should be written %%ENV.

Previously reported:
http://archives.postgresql.org/message-id/1301949704.21336.6.camel@vanquo.pezone.net




Re: %ENV warnings during builds

От
Magnus Hagander
Дата:
On Sun, Jul 3, 2011 at 13:06, Andrew Dunstan <andrew@dunslane.net> wrote:
> On Sun, July 3, 2011 8:14 am, Craig Ringer wrote:
>> Hi folks
>>
>> It looks like pgflex.bat and pgbison.bat in the win32 build files would
>> benefit from a tweak to eliminate a complaint from Perl.
>>
>> Perl emits the error:
>>
>>    Hash %ENV missing the % in argument 1 of each() at -e line 1
>>
>> on the lines that process buildenv.pl. This is because % in batch files
>> is processed differently to on the command line. (Yes, that's stupid).
>> Quoting doesn't affect this. Percent signs in batch files that are
>> intended to be literals should be doubled, so %ENV should be written
>> %%ENV.
>>
>> http://support.microsoft.com/kb/75634
>>
>> I. Hate. Batch. Files.
>>
>
>
> I think you've stumbled on just about all the bits of the MSVC build
> system we haven't perlized. Maybe we should complete that task, and turn
> clean.bat, pgbison.bat and pgflex.bat into pure one-line wrappers. (It was
> done for builddoc just a few weeks ago).

Yeah, give nthat you can't get anything useful done without perl
anyway, I don't see any argument for keeping them at this point.


--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


Re: %ENV warnings during builds

От
"Andrew Dunstan"
Дата:
On Sun, July 3, 2011 8:54 am, Peter Eisentraut wrote:
> On sön, 2011-07-03 at 20:14 +0800, Craig Ringer wrote:
>> It looks like pgflex.bat and pgbison.bat in the win32 build files would
>> benefit from a tweak to eliminate a complaint from Perl.
>>
>> Perl emits the error:
>>
>>    Hash %ENV missing the % in argument 1 of each() at -e line 1
>>
>> on the lines that process buildenv.pl. This is because % in batch files
>> is processed differently to on the command line. (Yes, that's stupid).
>> Quoting doesn't affect this. Percent signs in batch files that are
>> intended to be literals should be doubled, so %ENV should be written
>> %%ENV.
>
> Previously reported:
> http://archives.postgresql.org/message-id/1301949704.21336.6.camel@vanquo.pezone.net
>
>

I knew this sounded familiar. Now I look a bit more closely at it, the
reason we don't see this on the buildfarm is that it doesn't write
buildenv.pl, so the code doesn't get called there.

I've committed this change in the three places it occurs.

cheers

andrew



Re: %ENV warnings during builds

От
Brar Piening
Дата:
schrieb Magnus Hagander:
> I think you've stumbled on just about all the bits of the MSVC build
> system we haven't perlized. Maybe we should complete that task, and turn
> clean.bat, pgbison.bat and pgflex.bat into pure one-line wrappers. (It was
> done for builddoc just a few weeks ago).
> Yeah, give nthat you can't get anything useful done without perl
> anyway, I don't see any argument for keeping them at this point.
>
I've already stumbled into this while preparing the VS2010 support and 
came to the same conclusion.
In my VS2010 support patch I've already created perl replacements for 
those two and removed the batch files completely.
Certainly those two could also stay around as mere wrappers but in my 
opinion they only mess up the directory without adding any relevant benefit.

Typing "perl pgbison.pl" has no significant disadvantage over typing 
pgbison[.bat].
In my opinion it even makes clearer what really happens and leaves the 
beginner one step to recognize that the .bat files are mere wrappers.
In addition the default ActiveState installations register themselves in 
a way that even let you type pgbison.pl

Anyway - I don't have much passion for one way or the other and the 
wrappers should be easy to create by copy-pasting from one oft the 
wrappers already lying around.

Regards,

Brar


Re: %ENV warnings during builds

От
Andrew Dunstan
Дата:

On 07/03/2011 05:14 PM, Brar Piening wrote:
> schrieb Magnus Hagander:
>> I think you've stumbled on just about all the bits of the MSVC build
>> system we haven't perlized. Maybe we should complete that task, and turn
>> clean.bat, pgbison.bat and pgflex.bat into pure one-line wrappers.
>> (It was
>> done for builddoc just a few weeks ago).
>> Yeah, give nthat you can't get anything useful done without perl
>> anyway, I don't see any argument for keeping them at this point.
>>
> I've already stumbled into this while preparing the VS2010 support and
> came to the same conclusion.
> In my VS2010 support patch I've already created perl replacements for
> those two and removed the batch files completely.
> Certainly those two could also stay around as mere wrappers but in my
> opinion they only mess up the directory without adding any relevant
> benefit.


Hmm, I missed that you had done this. Here are two replacement perl
scripts I knocked up, but haven't yet tested. One of the things about
them is that they remove knowledge of particular .l and .y files. and
instead get the required invocation options from the relevant Makefiles.
I think that's a lot better than the horrid hackery we have in the batch
files.

cheers

andrew



Вложения

Re: %ENV warnings during builds

От
Brar Piening
Дата:
schrieb Andrew Dunstan:
> Hmm, I missed that you had done this. Here are two replacement perl 
> scripts I knocked up, but haven't yet tested. One of the things about 
> them is that they remove knowledge of particular .l and .y files. and 
> instead get the required invocation options from the relevant 
> Makefiles. I think that's a lot better than the horrid hackery we have 
> in the batch files.

Yep - they certainly look ways less messy than what I've created as a 
simple perl version of the batch files.

But I get "Undefined subroutine &main::dirname called at 
src\tools\msvc\pgflex.pl line 36." if I try to build with them.

I'll update my patch to remove my versions once they are fixed and commited.

Meanwhile you might need to create (at least temporarily) .bat wrappers 
as the unpatched msvc build sytem expects them to be in place.
I could also extract those parts from my patch but we should probably go 
the wohle way now to get it in shape and get it commited.

Regards,

Brar



Re: %ENV warnings during builds

От
Magnus Hagander
Дата:
On Mon, Jul 4, 2011 at 23:30, Andrew Dunstan <andrew@dunslane.net> wrote:
>
>
> On 07/03/2011 05:14 PM, Brar Piening wrote:
>>
>> schrieb Magnus Hagander:
>>>
>>> I think you've stumbled on just about all the bits of the MSVC build
>>> system we haven't perlized. Maybe we should complete that task, and turn
>>> clean.bat, pgbison.bat and pgflex.bat into pure one-line wrappers. (It
>>> was
>>> done for builddoc just a few weeks ago).
>>> Yeah, give nthat you can't get anything useful done without perl
>>> anyway, I don't see any argument for keeping them at this point.
>>>
>> I've already stumbled into this while preparing the VS2010 support and
>> came to the same conclusion.
>> In my VS2010 support patch I've already created perl replacements for
>> those two and removed the batch files completely.
>> Certainly those two could also stay around as mere wrappers but in my
>> opinion they only mess up the directory without adding any relevant benefit.
>
>
> Hmm, I missed that you had done this. Here are two replacement perl scripts
> I knocked up, but haven't yet tested. One of the things about them is that
> they remove knowledge of particular .l and .y files. and instead get the
> required invocation options from the relevant Makefiles. I think that's a
> lot better than the horrid hackery we have in the batch files.

Definitely agreed. Those were ugly hacks that were supposed to be
temporary, but yeah, we all know what happens to temporary things :O


--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


Re: %ENV warnings during builds

От
Andrew Dunstan
Дата:

On 07/05/2011 02:30 AM, Brar Piening wrote:
> schrieb Andrew Dunstan:
>> Hmm, I missed that you had done this. Here are two replacement perl
>> scripts I knocked up, but haven't yet tested. One of the things about
>> them is that they remove knowledge of particular .l and .y files. and
>> instead get the required invocation options from the relevant
>> Makefiles. I think that's a lot better than the horrid hackery we
>> have in the batch files.
>
> Yep - they certainly look ways less messy than what I've created as a
> simple perl version of the batch files.
>
> But I get "Undefined subroutine &main::dirname called at
> src\tools\msvc\pgflex.pl line 36." if I try to build with them.
>
> I'll update my patch to remove my versions once they are fixed and
> commited.


Try attached instead.

The bat wrappers just need to read:

    @echo off
    @perl src/tools/msvc/pgflex.pl %*

and

    @echo off
    @perl src/tools/msvc/pgbison.pl %*

cheers

andrew




Вложения

Re: %ENV warnings during builds

От
Brar Piening
Дата:
-------- Original Message  --------
Subject: Re: [HACKERS] %'ENV warnings during builds
From: Andrew Dunstan <andrew@dunslane.net>
To: Brar Piening <brar@gmx.de>
Date: 05.07.2011 17:25

> Try attached instead.
>

I can confirm that this version of pgflex.pl works as expected in my 
environment.

Regards,

Brar