You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Blair Zajac <bl...@orcaware.com> on 2010/12/15 05:17:12 UTC

Re: svn commit: r1049414 - /subversion/trunk/subversion/tests/svn_test_main.c

On 12/14/10 8:21 PM, hwright@apache.org wrote:
> Author: hwright
> Date: Wed Dec 15 04:21:23 2010
> New Revision: 1049414
>
> URL: http://svn.apache.org/viewvc?rev=1049414&view=rev
> Log:
> Allow tests which cause segfaults to not disrupt the other tests in the C
> testsuite.  This becomes useful when committing an XFailing test of a
> segfault (which I will shortly do), or when a test starts segfaulting of
> it's own accord.
>
> This behavior is enabled by default, but can be disabled by passing
> --allow-segfaults to the test, which should make for better debugging
> of the cause of the segfault.
>
> This patch uses setjmp() / longjmp() to accomplish the recovery from a SIGSEGV.
> While I'd highly frown upon those function in general purpose use, I believe
> this is an understandable exception.  Because it is so rare to use them,
> my personal experience is limited, so review and corrections are of course
> welcomed.

I've never seen setjmp/longjump used for this, but it's interesting.

One question, could you use sigsetjmp/siglongjmp instead of manually putting 
back disposition the to default with apr_signal?  I guess you would use 
apr_signal after the sigsetjump in that case.

Blair

Re: svn commit: r1049414 - /subversion/trunk/subversion/tests/svn_test_main.c

Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
On Wed, Dec 15, 2010 at 3:32 AM, Branko Čibej <br...@apache.org> wrote:
> On 15.12.2010 06:17, Blair Zajac wrote:
>> On 12/14/10 8:21 PM, hwright@apache.org wrote:
>>> Author: hwright
>>> Date: Wed Dec 15 04:21:23 2010
>>> New Revision: 1049414
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1049414&view=rev
>>> Log:
>>> Allow tests which cause segfaults to not disrupt the other tests in
>>> the C
>>> testsuite.  This becomes useful when committing an XFailing test of a
>>> segfault (which I will shortly do), or when a test starts segfaulting of
>>> it's own accord.
>>>
>>> This behavior is enabled by default, but can be disabled by passing
>>> --allow-segfaults to the test, which should make for better debugging
>>> of the cause of the segfault.
>>>
>>> This patch uses setjmp() / longjmp() to accomplish the recovery from
>>> a SIGSEGV.
>>> While I'd highly frown upon those function in general purpose use, I
>>> believe
>>> this is an understandable exception.  Because it is so rare to use them,
>>> my personal experience is limited, so review and corrections are of
>>> course
>>> welcomed.
>>
>> I've never seen setjmp/longjump used for this, but it's interesting.
>>
>> One question, could you use sigsetjmp/siglongjmp instead of manually
>> putting back disposition the to default with apr_signal?  I guess you
>> would use apr_signal after the sigsetjump in that case.
>
> Are the sig* variants available on all platforms? I don't recall seeing
> them in the C90 stdlib.

Re: svn commit: r1049414 - /subversion/trunk/subversion/tests/svn_test_main.c

Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
On Wed, Dec 15, 2010 at 3:32 AM, Branko Čibej <br...@apache.org> wrote:
> On 15.12.2010 06:17, Blair Zajac wrote:
>> On 12/14/10 8:21 PM, hwright@apache.org wrote:
>>> Author: hwright
>>> Date: Wed Dec 15 04:21:23 2010
>>> New Revision: 1049414
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1049414&view=rev
>>> Log:
>>> Allow tests which cause segfaults to not disrupt the other tests in
>>> the C
>>> testsuite.  This becomes useful when committing an XFailing test of a
>>> segfault (which I will shortly do), or when a test starts segfaulting of
>>> it's own accord.
>>>
>>> This behavior is enabled by default, but can be disabled by passing
>>> --allow-segfaults to the test, which should make for better debugging
>>> of the cause of the segfault.
>>>
>>> This patch uses setjmp() / longjmp() to accomplish the recovery from
>>> a SIGSEGV.
>>> While I'd highly frown upon those function in general purpose use, I
>>> believe
>>> this is an understandable exception.  Because it is so rare to use them,
>>> my personal experience is limited, so review and corrections are of
>>> course
>>> welcomed.
>>
>> I've never seen setjmp/longjump used for this, but it's interesting.
>>
>> One question, could you use sigsetjmp/siglongjmp instead of manually
>> putting back disposition the to default with apr_signal?  I guess you
>> would use apr_signal after the sigsetjump in that case.
>
> Are the sig* variants available on all platforms? I don't recall seeing
> them in the C90 stdlib.

>From my manpage:

The setjmp() and longjmp() functions conform to ISO/IEC 9899:1990
     (``ISO C90'').  The sigsetjmp() and siglongjmp() functions conform to
     IEEE Std 1003.1-1988 (``POSIX.1'').

So it would appear that the sig* variants are not part of the C90 standard.

-Hyrum

Re: svn commit: r1049414 - /subversion/trunk/subversion/tests/svn_test_main.c

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 12/15/2010 04:32 AM, Branko Čibej wrote:
> Are the sig* variants available on all platforms? I don't recall seeing
> them in the C90 stdlib.

`man setjmp` tells me:

C89, C99, and POSIX.1-2001 specify setjmp().  POSIX.1-2001 specifies
sigsetjmp().

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand


Re: svn commit: r1049414 - /subversion/trunk/subversion/tests/svn_test_main.c

Posted by Branko Čibej <br...@apache.org>.
On 15.12.2010 06:17, Blair Zajac wrote:
> On 12/14/10 8:21 PM, hwright@apache.org wrote:
>> Author: hwright
>> Date: Wed Dec 15 04:21:23 2010
>> New Revision: 1049414
>>
>> URL: http://svn.apache.org/viewvc?rev=1049414&view=rev
>> Log:
>> Allow tests which cause segfaults to not disrupt the other tests in
>> the C
>> testsuite.  This becomes useful when committing an XFailing test of a
>> segfault (which I will shortly do), or when a test starts segfaulting of
>> it's own accord.
>>
>> This behavior is enabled by default, but can be disabled by passing
>> --allow-segfaults to the test, which should make for better debugging
>> of the cause of the segfault.
>>
>> This patch uses setjmp() / longjmp() to accomplish the recovery from
>> a SIGSEGV.
>> While I'd highly frown upon those function in general purpose use, I
>> believe
>> this is an understandable exception.  Because it is so rare to use them,
>> my personal experience is limited, so review and corrections are of
>> course
>> welcomed.
>
> I've never seen setjmp/longjump used for this, but it's interesting.
>
> One question, could you use sigsetjmp/siglongjmp instead of manually
> putting back disposition the to default with apr_signal?  I guess you
> would use apr_signal after the sigsetjump in that case.

Are the sig* variants available on all platforms? I don't recall seeing
them in the C90 stdlib.

-- Brane