Re: /bzr/squid3/trunk/ r10399: Back out the tweak on rev10398.

2010-04-22 Thread Henrik Nordstrom
tor 2010-04-22 klockan 17:13 +1200 skrev Amos Jeffries:

> What hudson was showing was build always exiting at the first of these 
> files. Even in the "awk ok -> SUCCESS" case. That needs to be figured 
> out before "&& exit 1" can go back on.

right. The sequence of || && is a bit ambiguous. Needs to be explicitly
grouped as in my first variant to get the desired result.

awk || (rm && exit)

alternatively

awk || (rm ; exit)

or using explicit flow control

if ! awk ; then rm ; exit; fi


Regards
Henrik



Re: /bzr/squid3/trunk/ r10399: Back out the tweak on rev10398.

2010-04-21 Thread Amos Jeffries

Henrik Nordstrom wrote:

mån 2010-04-19 klockan 23:25 + skrev Amos Jeffries:


-   $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ ||
$(RM) -f $@ && exit 1
+   $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ ||
$(RM) -f $@

Why?


I had bound the exit(1) to success of the rm command, not failure of the
awk. When we get time to sort out the shell nesting of automake it needs to
be added back in to ensure the make runs exit on awk failure.


Sure you had.

awk ok -> SUCCESS
awk fail -> rm
   rm fail -> FAILURE
   rm ok -> exit 1 == FAILURE

exit in this context is just to make the shell command return an error
so make stops. rm failing is in itself an error and no explicit exit
with an error is needed in that case. If you absolutely want exit to be
called in both cases then group rm & exit

$(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ || 
($(RM) -f $@ ;exit 1)

but I prefer your original

$(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ || $(RM) -f $@ 
&& exit 1

the effect of both is the same, and your original is both clearer and more 
efficient.

Regards
Henrik



Thanks for confirming my initial logic.

What hudson was showing was build always exiting at the first of these 
files. Even in the "awk ok -> SUCCESS" case. That needs to be figured 
out before "&& exit 1" can go back on.


Amos
--
Please be using
  Current Stable Squid 2.7.STABLE9 or 3.1.1


Re: /bzr/squid3/trunk/ r10399: Back out the tweak on rev10398.

2010-04-21 Thread Henrik Nordstrom
mån 2010-04-19 klockan 23:25 + skrev Amos Jeffries:

> >> -  $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ ||
> >> $(RM) -f $@ && exit 1
> >> +  $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ ||
> >> $(RM) -f $@
> > 
> > Why?
> > 
> 
> I had bound the exit(1) to success of the rm command, not failure of the
> awk. When we get time to sort out the shell nesting of automake it needs to
> be added back in to ensure the make runs exit on awk failure.

Sure you had.

awk ok -> SUCCESS
awk fail -> rm
   rm fail -> FAILURE
   rm ok -> exit 1 == FAILURE

exit in this context is just to make the shell command return an error
so make stops. rm failing is in itself an error and no explicit exit
with an error is needed in that case. If you absolutely want exit to be
called in both cases then group rm & exit

$(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ || 
($(RM) -f $@ ;exit 1)

but I prefer your original

$(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ || 
$(RM) -f $@ && exit 1

the effect of both is the same, and your original is both clearer and more 
efficient.

Regards
Henrik



Re: /bzr/squid3/trunk/ r10399: Back out the tweak on rev10398.

2010-04-19 Thread Amos Jeffries
On Mon, 19 Apr 2010 22:33:37 +0200, Henrik Nordstrom
 wrote:
> tor 2010-04-15 klockan 22:19 +1200 skrev Amos Jeffries:
>> 
>> revno: 10399
>> committer: Amos Jeffries 
>> branch nick: trunk
>> timestamp: Thu 2010-04-15 22:19:26 +1200
>> message:
>>   Back out the tweak on rev10398.
> 
> 
>>  globals.cc: globals.h mk-globals-c.awk
>> -$(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ ||
>> $(RM) -f $@ && exit 1
>> +$(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ ||
>> $(RM) -f $@
> 
> Why?
> 

I had bound the exit(1) to success of the rm command, not failure of the
awk. When we get time to sort out the shell nesting of automake it needs to
be added back in to ensure the make runs exit on awk failure.

For now it still fails later anyway as a linkage failure. So the build
will still abort. Just not in the best place.

Amos


Re: /bzr/squid3/trunk/ r10399: Back out the tweak on rev10398.

2010-04-19 Thread Henrik Nordstrom
tor 2010-04-15 klockan 22:19 +1200 skrev Amos Jeffries:
> 
> revno: 10399
> committer: Amos Jeffries 
> branch nick: trunk
> timestamp: Thu 2010-04-15 22:19:26 +1200
> message:
>   Back out the tweak on rev10398.


>  globals.cc: globals.h mk-globals-c.awk
> - $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ || 
> $(RM) -f $@ && exit 1
> + $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ || 
> $(RM) -f $@

Why?

Regards
Henrik