From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <86wrijennb.fsf@cmarib.ramside> <20110424171741.D5865B827@mail.bitblocks.com> Date: Sun, 24 Apr 2011 20:03:25 -0600 Message-ID: From: andrey mirtchovski To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] Different results for the same rc script when using listen1 Topicbox-Message-UUID: d4449b62-ead6-11e9-9d60-3106f5b1d025 > =C2=A0 #!/usr/local/plan9/bin/9 rc > =C2=A0 echo first at path: $path(1) > =C2=A0 for (i in `{seq 1 5}){ > =C2=A0 =C2=A0 =C2=A0 if (test $i -eq 3) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 echo $i equals 3 > =C2=A0 =C2=A0 =C2=A0 } > =C2=A0 =C2=A0 =C2=A0 if not echo $i is different from 3 > =C2=A0 } NB: in general, you don't need 'test'. use "if (~ $i 3) {}". that said, now I'm convinced there's a bug somewhere. I got your code to fail under the condition that rc is started via the '9' environment (9 rc). the type of 'test' binary doesn't matter -- both /bin/test and $PLAN9/bin/test break under '9', but don't break without it. the '9' script is pretty simple, but there appear do be some side-effects (probably due to \r being transmitted over the network?). here's the simplest version of your script: $ cat t.rc #!/usr/bin/env rc exec rc $ dial and test: $ dial -e 'tcp!localhost!8080' ######## no breakage /bin/test 1 -eq 2 ; echo $status 1 /bin/test 1 -eq 1; echo $status /Users/andrey/plan9/bin/test 1 -eq 2; echo $status 1 /Users/andrey/plan9/bin/test 1 -eq 1; echo $status ######## now see it break 9 rc /bin/test 1 -eq 2 ; echo $status /bin/test 1 -eq 1; echo $status /Users/andrey/plan9/bin/test 1 -eq 2; echo $status /Users/andrey/plan9/bin/test 1 -eq 1; echo $status ls | wc > /dev/null; echo $status | ls | wc > /dev/null; echo $status ||| ls | wc > /dev/null; echo $status ||||||| ls | wc > /dev/null; echo $status ||||||||||||||| ls | wc > /dev/null; echo $status ||||||||||||||||||||||||||||||| #####back to non-breaking rc: exit echo $status ls | wc > /dev/null; echo $status | ls | wc > /dev/null; echo $status | ls | wc > /dev/null; echo $status | ls | wc > /dev/null; echo $status | ls | wc > /dev/null; echo $status |