Re: [PATCH 1/3] rt-migrate-test: fix return code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, 22 Mar 2016, Luiz Capitulino wrote:

> On Tue, 22 Mar 2016 15:59:50 +0100 (CET)
> John Kacur <jkacur@xxxxxxxxxx> wrote:
> 
> > 
> > 
> > On Tue, 22 Mar 2016, Luiz Capitulino wrote:
> > 
> > > On Tue, 22 Mar 2016 15:22:57 +0100 (CET)
> > > John Kacur <jkacur@xxxxxxxxxx> wrote:
> > > 
> > > > 
> > > > 
> > > > On Thu, 17 Mar 2016, Luiz Capitulino wrote:
> > > > 
> > > > > Change both return codes for the stop == true case:
> > > > > 
> > > > >  * For failures, use exit(1) as exit(-1) is wrong
> > > > >    (it actually becomes 255 in the shell)
> > > > > 
> > > > >  * For success, use exit(2) instead of exit(1) as
> > > > >    exit(1) is usually used for errors
> > > > > 
> > > > > This should preserve the requirement of allowing
> > > > > shell script while loops to break when Ctrl-C is hit.
> > > > > 
> > > > > Signed-off-by: Luiz Capitulino <lcapitulino@xxxxxxxxxx>
> > > > > ---
> > > > >  src/rt-migrate-test/rt-migrate-test.c | 4 ++--
> > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
> > > > > index d7b68dd..1362404 100644
> > > > > --- a/src/rt-migrate-test/rt-migrate-test.c
> > > > > +++ b/src/rt-migrate-test/rt-migrate-test.c
> > > > > @@ -599,9 +599,9 @@ int main (int argc, char **argv)
> > > > >  		 * loop know to break.
> > > > >  		 */
> > > > >  		if (check < 0)
> > > > > -			exit(-1);
> > > > > -		else
> > > > >  			exit(1);
> > > > > +		else
> > > > > +			exit(2);
> > > > >  	}
> > > > >  	if (check < 0)
> > > > >  		exit(-1);
> > > > > -- 
> > > > > 2.1.0
> > > > > 
> > > > > --
> > > > 
> > > > NAK - I've already told you this is wrong
> > > 
> > > Right and wrong can be subjective concepts :)
> > > 
> > > > 0 is the normal value for exit_success, not 2
> > > > you can change the failure from -1 to 1 if you wish
> > > 
> > > rt-migrate-test uses a different protocol as documented
> > > in the code. If we change success to 0, we'll break this
> > > protocol. Does it matter? I don't know, but I chose to
> > > keep it.
> > > 
> > > Now, if this is a complicated matter, we can just skip this
> > > patch.
> > > --
> > 
> > Really not sure what you're talking about
> > update your git repo and read the code again.
> 
> I'm looking at a638701a1899. Unless I grabbed the wrong branch
> again, the code looks the same.
> 
> This is the block I'm referring to:
> 
>     if (stop) {
>         /*
>          * We use this test in bash while loops
>          * So if we hit Ctrl-C then let the while
>          * loop know to break.
>          */
>         if (check < 0)
>             exit(-1);
>         else
>             exit(1);
>     }
> 
> So, when Ctrl-C is hit by the user, stop=1 and we get here. Then,
> two things may happen:
> 
>  1. check < 0: my understanding is that, this is the failure
>     case. We do exit(-1). On Linux (and maybe most Unixes), this
>     actually becomes 255 in the shell
> 
>  2. check >= 0: we do exit(1). This is the success case. According
>     to the protocol, we return 1 to the shell to allow shell loops
>     from breaking free
> --

I assume you are now working with
Repo: git://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git
Branch: devel/v0.97

Yes, that looks like the right code. I was talking to Steve Rostedt
about how a bash script would consume the values, and it looks like we do 
need tri-state exit codes. I'm going to revert the hunk on this program 
that changes the exit(-1) to exit(0), and we'll leave this program alone 
for now, it's a bit of an exception as to how it works compared to the 
other rt-tests programs

Thanks

John
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux