[Scons-users] Crash in signal handling in Jobs.py

Bill Deegan bill at baddogconsulting.com
Thu Oct 7 10:50:12 EDT 2021


Please PR your solution.

Here's a wiki page with some hints on how to..
https://github.com/SCons/scons/wiki/GitWorkflows

Please consider joining our discord server, may be a bit easier to help you
through any bumps in the road to get a first PR through..
https://discord.gg/pejaFYrD9n

On Thu, Oct 7, 2021 at 3:38 AM Brian Quistorff <brian at quistorff.com> wrote:

> Hi Bill,
>
> Yes, that's the situation.
>
> Thanks, Brian
>
>
>
> On Wed, Oct 6, 2021 at 9:31 PM Bill Deegan <bill at baddogconsulting.com>
> wrote:
>
>> I see this
>> "None means that the previous signal handler was not installed from
>> Python."
>>
>> In the docs
>> https://docs.python.org/3/library/signal.html#signal.getsignal
>> -Bill
>>
>> On Wed, Oct 6, 2021 at 6:29 PM Bill Deegan <bill at baddogconsulting.com>
>> wrote:
>>
>>> Brian,
>>>
>>> O.k. so if I understand correctly you have a signal handler registerer
>>> outside SCons (in C code for example), and when this is the case python's
>>> signal.signal() will return None?
>>> And then when SCons tries to reset it back to it's original setting
>>> attempts to set it to None and that causes Python to crash?
>>>
>>> -Bill
>>> SCons Co-Manager
>>>
>>> On Wed, Oct 6, 2021 at 5:10 PM Brian Quistorff <brian at quistorff.com>
>>> wrote:
>>>
>>>> Hello,
>>>>
>>>> Thanks all for the wonderful tool.
>>>>
>>>> My scons crashes in situations where there is a signal handler
>>>> registered from "outside Python" (the phrase used in the Python docs for
>>>> signal.signal). This happens for me when I run scons from inside Stata (a
>>>> stats program), which embeds Python, and sets up a signal handler. I think
>>>> this could also happen if one runs scons from a Python environment where a
>>>> compiled plugin registered a signal handler. I tracked the problem to
>>>> Jobs.py, where _setup_sig_handler() retrieves the previous signal handler
>>>> (signal.signal() returns None in this case) and then in
>>>> _reset_sig_handler() it tries to the set the signal handler to this
>>>> previous (None) value. None is not allowed and this causes a crash.
>>>>
>>>> I've coded up a patch that resets the signal handler to signal.SIG_DFL
>>>> (the default handler) when the previous one was None and warns the user
>>>> that this is happening. I'm looking for feedback, to see if this is an
>>>> acceptable fix, and if/how I should proceed on GitHub.
>>>>
>>>> Thanks,
>>>> Brian
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-users at scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20211007/7344afa7/attachment.htm>


More information about the Scons-users mailing list