Re: CVS commit: src/external/bsd/kyua-atf-compat/dist

2013-02-25 Thread David Holland
On Mon, Feb 25, 2013 at 06:49:51PM +, Julio Merino wrote:
 > Log Message:
 > Cherry-pick upstream change d0daf9983f5a0e635f1127dbc827aa114daa90d8:
 > 
 > Fix broken variable parsing with NetBSD's /bin/sh
 > 
 > Quote the expansion of a $() command that was not properly surrounded
 > by quotes so that this runs properly with NetBSD's /bin/sh.

In what way was it broken? (And where's the PR?)

-- 
David A. Holland
dholl...@netbsd.org


Re: CVS commit: src/external/bsd/kyua-atf-compat/dist

2013-02-25 Thread Paul Goyette

On Mon, 25 Feb 2013, David Holland wrote:


On Mon, Feb 25, 2013 at 06:49:51PM +, Julio Merino wrote:
> Log Message:
> Cherry-pick upstream change d0daf9983f5a0e635f1127dbc827aa114daa90d8:
>
> Fix broken variable parsing with NetBSD's /bin/sh
>
> Quote the expansion of a $() command that was not properly surrounded
> by quotes so that this runs properly with NetBSD's /bin/sh.

In what way was it broken? (And where's the PR?)


And when do we get a regression test case to detect it?

:)



-
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:   |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com|
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |  | pgoyette at netbsd.org  |
-


Re: CVS commit: src/external/bsd/kyua-atf-compat/dist

2013-02-25 Thread Julio Merino
On Mon, Feb 25, 2013 at 1:54 PM, David Holland
 wrote:
> On Mon, Feb 25, 2013 at 06:49:51PM +, Julio Merino wrote:
>  > Log Message:
>  > Cherry-pick upstream change d0daf9983f5a0e635f1127dbc827aa114daa90d8:
>  >
>  > Fix broken variable parsing with NetBSD's /bin/sh
>  >
>  > Quote the expansion of a $() command that was not properly surrounded
>  > by quotes so that this runs properly with NetBSD's /bin/sh.
>
> In what way was it broken? (And where's the PR?)

I was assuming my code was broken, not sh.  But I can file a PR with
the observed difference between sh and bash.

-- 
Julio Merino / @jmmv


Re: CVS commit: src/external/bsd/kyua-atf-compat/dist

2013-02-25 Thread David Laight
On Mon, Feb 25, 2013 at 06:54:13PM +, David Holland wrote:
> On Mon, Feb 25, 2013 at 06:49:51PM +, Julio Merino wrote:
>  > Log Message:
>  > Cherry-pick upstream change d0daf9983f5a0e635f1127dbc827aa114daa90d8:
>  > 
>  > Fix broken variable parsing with NetBSD's /bin/sh
>  > 
>  > Quote the expansion of a $() command that was not properly surrounded
>  > by quotes so that this runs properly with NetBSD's /bin/sh.
> 
> In what way was it broken? (And where's the PR?)

I suspect that field splitting is applied to the RHS of assignments
when they are on local or export lines.

eg:
  (x="a b"; b=fubar; export y=$x; echo $y; (echo $b))
outputs a and fubar (on two lines).

David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/external/bsd/kyua-atf-compat/dist

2013-02-25 Thread David Laight
On Mon, Feb 25, 2013 at 08:43:51PM +, David Laight wrote:
> On Mon, Feb 25, 2013 at 06:54:13PM +, David Holland wrote:
> > On Mon, Feb 25, 2013 at 06:49:51PM +, Julio Merino wrote:
> >  > Log Message:
> >  > Cherry-pick upstream change d0daf9983f5a0e635f1127dbc827aa114daa90d8:
> >  > 
> >  > Fix broken variable parsing with NetBSD's /bin/sh
> >  > 
> >  > Quote the expansion of a $() command that was not properly surrounded
> >  > by quotes so that this runs properly with NetBSD's /bin/sh.
> > 
> > In what way was it broken? (And where's the PR?)
> 
> I suspect that field splitting is applied to the RHS of assignments
> when they are on local or export lines.
> 
> eg:
>   (x="a b"; b=fubar; export y=$x; echo $y; (echo $b))
> outputs a and fubar (on two lines).

Sorry - that doesn't do what I intended, try:
(x="a b"; b=fubar; export y=$x; echo $y; sh -c 'echo $b')

David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/external/bsd/kyua-atf-compat/dist

2013-02-25 Thread Valeriy E. Ushakov
On Mon, Feb 25, 2013 at 18:49:51 +, Julio Merino wrote:

> Module Name:  src
> Committed By: jmmv
> Date: Mon Feb 25 18:49:51 UTC 2013
> 
> Modified Files:
>   src/external/bsd/kyua-atf-compat/dist: atf-run.sh
> 
> Log Message:
> Cherry-pick upstream change d0daf9983f5a0e635f1127dbc827aa114daa90d8:
> 
> Fix broken variable parsing with NetBSD's /bin/sh
> 
> Quote the expansion of a $() command that was not properly surrounded
> by quotes so that this runs properly with NetBSD's /bin/sh.

grep|sed pipeline is ok on a command line where one is lazy, in a
script it should be just sed :)

Your $ws doesn't do what you expect it to do.  Try your command on a
line that actually has tabs.  This is because backslash has no special
meaning inside [], so your \t is not a tab, but either a backslash or
a letter 't'.

-uwe


Re: CVS commit: src/external/bsd/kyua-atf-compat/dist

2013-02-26 Thread Julio Merino

On Feb 25, 2013, at 13:54, David Holland  
wrote:

> On Mon, Feb 25, 2013 at 06:49:51PM +, Julio Merino wrote:
>> Log Message:
>> Cherry-pick upstream change d0daf9983f5a0e635f1127dbc827aa114daa90d8:
>> 
>> Fix broken variable parsing with NetBSD's /bin/sh
>> 
>> Quote the expansion of a $() command that was not properly surrounded
>> by quotes so that this runs properly with NetBSD's /bin/sh.
> 
> In what way was it broken? (And where's the PR?)

FTR: bin/47597



Re: CVS commit: src/external/bsd/kyua-atf-compat/dist

2013-02-26 Thread Julio Merino
On Feb 25, 2013, at 15:40, "Valeriy E. Ushakov"  wrote:

> On Mon, Feb 25, 2013 at 18:49:51 +, Julio Merino wrote:
> 
>> Module Name: src
>> Committed By:jmmv
>> Date:Mon Feb 25 18:49:51 UTC 2013
>> 
>> Modified Files:
>>  src/external/bsd/kyua-atf-compat/dist: atf-run.sh
>> 
>> Log Message:
>> Cherry-pick upstream change d0daf9983f5a0e635f1127dbc827aa114daa90d8:
>> 
>> Fix broken variable parsing with NetBSD's /bin/sh
>> 
>> Quote the expansion of a $() command that was not properly surrounded
>> by quotes so that this runs properly with NetBSD's /bin/sh.
> 
> grep|sed pipeline is ok on a command line where one is lazy, in a
> script it should be just sed :)

Heh, very true. I'll try to play with this a bit later.

> Your $ws doesn't do what you expect it to do.  Try your command on a
> line that actually has tabs.  This is because backslash has no special
> meaning inside [], so your \t is not a tab, but either a backslash or
> a letter 't'.

Thanks; this should be fixed now.


Re: CVS commit: src/external/bsd/kyua-atf-compat/dist

2013-02-26 Thread Julio Merino

On Feb 25, 2013, at 14:01, Paul Goyette  wrote:

> On Mon, 25 Feb 2013, David Holland wrote:
> 
>> On Mon, Feb 25, 2013 at 06:49:51PM +, Julio Merino wrote:
>> > Log Message:
>> > Cherry-pick upstream change d0daf9983f5a0e635f1127dbc827aa114daa90d8:
>> >
>> > Fix broken variable parsing with NetBSD's /bin/sh
>> >
>> > Quote the expansion of a $() command that was not properly surrounded
>> > by quotes so that this runs properly with NetBSD's /bin/sh.
>> 
>> In what way was it broken? (And where's the PR?)
> 
> And when do we get a regression test case to detect it?

Whenever we decide what the behavior should be! See the discussion that the PR 
started.

Re: CVS commit: src/external/bsd/kyua-atf-compat/dist

2013-02-26 Thread Alistair Crooks
On Tue, Feb 26, 2013 at 03:23:19PM +, Julio Merino wrote:
> Module Name:  src
> Committed By: jmmv
> Date: Tue Feb 26 15:23:19 UTC 2013
> 
> Modified Files:
>   src/external/bsd/kyua-atf-compat/dist: atf-run.sh atf-run_test.sh
> 
> Log Message:
> Cherry-pick upstream change 70aefdbe5b843d6b24b5a9b816e47f2fb026dde2:
> 
> Properly handle tabs when parsing config files
> 
> Backslashes within [] in a regexp don't have any meaning, so [ \t]
> did not have the intended effect of being evaluated to a space and
> a tab.  Fix this by writing an actual tab in the regexp.
> 
> Problem found by Valeriy E. Ushakov.

It may be better to use the POSIX character class "[[:space:]]" rather
than embedded spaces and tabs (which may not cut and paste well), and
which make it more obvious what actually is wanted.

Best,
Alistair