[Top][All Lists]

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

Re: [PATCH] cvs diff exit status

From: Noel L Yap
Subject: Re: [PATCH] cvs diff exit status
Date: Fri, 1 Dec 2000 11:04:15 -0500

I see.  Sorry, I had misread your email.

I agree with your comment that, ideally, cvs diff should exit with the same
statuses (stati :-) as diff.  I haven't delved into the code as you have to see
how feasible it is, though.


address@hidden on 2000.12.01 10:44:38

To:   address@hidden
cc:   address@hidden
Subject:  Re: [PATCH] cvs diff exit status

It's not.  cvs turns the return codes from the diff() function into
useless information:

from main.c( I'm adding in my comments ):
     /* call the diff() function */
     err = (*(cm->func)) (argc, argv);

     /* At this point err is 0 - for no diff, 1 for a diff, 2 for error */
    /* This is exit rather than return because apparently that keeps
       some tools which check for memory leaks happier.  */
     /* Here we exit the program, it turns 1 and 2 into program failures */
    exit (err ? EXIT_FAILURE : 0);


On Fri, Dec 01, 2000 at 10:36:06AM -0500, Noel L Yap wrote:
> The exit status of "cvs diff" is exactly the same as the exit status of "diff"
> (man diff for more info).  Why not test the exit status itself:
> cvs diff blah
> if [ $? -lt 2 ]
> then
>      echo success
> else
>      echo failure
> fi
> address@hidden on 2000.12.01 09:59:07
> To:   address@hidden
> cc:   (bcc: Noel L Yap)
> Subject:  [PATCH] cvs diff exit status
> When the cvs diff command is run it attempts to return one of
> three status codes to main:
> 0 - files same
> 1 - files different
> 2 - Some sort of error has occurred
> main interprets and return codes > 0 as a cvs program failure.
> I've changed diff.c to return only success or failure.  Success
> is either the '0' or '1' state outlined above.  Failure is the
> '2' state.
> The reason that I have done this is because the current cvs
> code returns EXIT_FAILURE for both '1' and '2' outlined above.
> When I run a cvs diff command and check the programs return code
> I have no way of telling whether cvs ran successfully or cvs found
> some diffs without parsing the output from cvs as well.
> Thanks!
> donald

This communication is for informational purposes only.  It is not intended as
an offer or solicitation for the purchase or sale of any financial instrument
or as an official confirmation of any transaction. All market prices, data
and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of J.P. Morgan & Co. Incorporated, its
subsidiaries and affiliates.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]