info-cvs
[Top][All Lists]
Advanced

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

Re: cvs exit status


From: Paul Sander
Subject: Re: cvs exit status
Date: Thu, 11 Oct 2001 15:48:53 -0700

>--- Forwarded mail from Greg Woods:

>[ On Wednesday, October 10, 2001 at 14:43:14 (-0700), Paul Sander wrote: ]
>> Subject: Re: cvs exit status
>>
>> What happens on a Unix system when the exit status exceeds 127?  It 
>> overflows.

>Well, actually it'll depend on a number of factors.  I suspect the
>result is literally "undefined" from the standards point of view.  In
>many systems I suspect it will be confused with a signal having been
>delivered.  In all cases I suspect there's only one chance in 127 of the
>overflow resulting in an apparent success.  I'm too lazy to write the
>trivial test case though....   :-)

>> An incremented exit status can (and does) report success in the presence of
>> failures.

>What a bogus worry!  Do you have an example of an actual code path in
>CVS which can easily cause such an overflow?

Sure:

# Create a test module
cvs checkout CVSROOT
echo foo foo > CVSROOT/modules
mkdir $CVSROOT/foo
( cd CVSROOT && cvs commit -m "Added test module" modules )

# Populate the test module
cvs checkout foo
cd foo
x=1
while [ $x -le 258 ]
do
        fn="foo$x"
        echo "this is $fn" > $fn
        cvs add $fn
        x=`expr $x + 1`
done
cvs commit -m "initial checkin"
cd ..

# Checkout concurrent copy
cvs checkout -d foo2 foo

# Modify and commit the original checked-out copy
cd foo
x=1
while [ $x -le 258 ]
do
        fn="foo$x"
        echo "appended" >> $fn
        x=`expr $x + 1`
done
cvs commit -m "made a change"
cd ..

# Make a different change to the 2nd copy
cd foo2
x=1
while [ $x -le 258 ]
do
        fn="foo$x"
        echo "different change" >> $fn
        x=`expr $x + 1`
done

# Overflow occurs here; an exit status less than 258 indicates an overflow.
cvs update
echo "exit status is $?"



And if you don't like having 258 files in a single directory, feel free
to partition the test module into a tree of smaller directories.  It will
not affect the outcome in any significant way.

(Actually, the number of files that trips the overflow is much smaller;
error codes are usually incremented more than once in CVS' error paths.)

>--- End of forwarded message from address@hidden




reply via email to

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