Re: %ENV warnings during builds

Lists: pgsql-hackers
From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: "Craig Ringer" <craig(at)postnewspapers(dot)com(dot)au>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: %ENV warnings during builds
Date: 2011-07-03 11:06:14
Message-ID: 53149.174.107.221.223.1309691174.squirrel@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: pgsql-hackers(at)postgresql(dot)org
Subject: %ENV warnings during builds
Date: 2011-07-03 12:14:27
Message-ID: 4E105D23.7010104@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: %ENV warnings during builds
Date: 2011-07-03 12:54:32
Message-ID: 1309697672.7252.0.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc: "Craig Ringer" <craig(at)postnewspapers(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: %ENV warnings during builds
Date: 2011-07-03 13:01:05
Message-ID: 53294.174.107.221.223.1309698065.squirrel@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: %ENV warnings during builds
Date: 2011-07-03 14:23:15
Message-ID: CABUevExadVK8tKfts4Re0Aus8LjJWdykww5HMiM1u_qhj+GmzQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Jul 3, 2011 at 13:06, Andrew Dunstan <andrew(at)dunslane(dot)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/


From: Brar Piening <brar(at)gmx(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: %ENV warnings during builds
Date: 2011-07-03 21:14:31
Message-ID: 4E10DBB7.4090601@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Brar Piening <brar(at)gmx(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: %ENV warnings during builds
Date: 2011-07-04 21:30:44
Message-ID: 4E123104.9020609@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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

Attachment Content-Type Size
pgflex.pl application/x-perl 1.4 KB
pgbison.pl application/x-perl 978 bytes

From: Brar Piening <brar(at)gmx(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: %ENV warnings during builds
Date: 2011-07-05 06:30:06
Message-ID: 4E12AF6E.6010600@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Brar Piening <brar(at)gmx(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: %ENV warnings during builds
Date: 2011-07-05 08:10:47
Message-ID: CABUevEzmHXT57rhC+QudYHVjCBYsptSE5=Mh=1+vxOei6JdTfg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Jul 4, 2011 at 23:30, Andrew Dunstan <andrew(at)dunslane(dot)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/


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Brar Piening <brar(at)gmx(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: %ENV warnings during builds
Date: 2011-07-05 15:25:46
Message-ID: 4E132CFA.6060604@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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

Attachment Content-Type Size
pgflex.pl application/x-perl 1.5 KB

From: Brar Piening <brar(at)gmx(dot)de>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: %ENV warnings during builds
Date: 2011-07-05 18:20:50
Message-ID: 4E135602.40705@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

-------- Original Message --------
Subject: Re: [HACKERS] %'ENV warnings during builds
From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Brar Piening <brar(at)gmx(dot)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