Merge lp:~spiv/bzr/sigwinch-without-signalmodule-583941 into lp:bzr/2.1
Status: | Rejected |
---|---|
Rejected by: | Andrew Bennetts |
Proposed branch: | lp:~spiv/bzr/sigwinch-without-signalmodule-583941 |
Merge into: | lp:bzr/2.1 |
Diff against target: |
220 lines (+143/-13) 4 files modified
NEWS (+4/-5) bzrlib/_sigwinch_handler_c.c (+112/-0) bzrlib/osutils.py (+22/-7) setup.py (+5/-1) |
To merge this branch: | bzr merge lp:~spiv/bzr/sigwinch-without-signalmodule-583941 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrew Bennetts | Disapprove | ||
Martin Packman (community) | Abstain | ||
Review via email: mp+25870@code.launchpad.net |
Commit message
Implement pure C SIGWINCH signal handler to avoid EINTR bugs (#583941)
Description of the change
EINTR, round 99. I believe that this should fix most if not all occurrences of EINTR with the 'bzr' command.
Basically, we cannot catch SIGWINCH in CPython <= 2.6.5 (i.e. any currently released version of Python) without causing EINTR in many places, many of which are in the standard library and hence impossible to fix in bzrlib.
However, we want to get notified when the terminal size changes, which means either asking the OS every time we want to know the terminal size (perhaps not so bad?), or side-stepping the 'signal' module in Python. This patch takes the latter route. It implements a very simple C module that can install a SIGWINCH handler with the SA_RESTART flag (thus avoiding EINTR from the majority of syscalls). That handler simply sets a boolean flag. The module also provides a function to check and reset that flag. If the module isn't available bzrlib.
The has_function check in setup.py is a bit unfortunate, because it will be triggered on every setup.py invocation (even those that don't try to build extensions), and it can produce some noise on stderr. It would be possible to fix this by pushing the check into a custom Extension subclass or perhaps the overridden build_ext command, but that would be more complex. We can do something about that if it causes trouble, but for now I'm hoping simple is good enough.
Unmerged revisions
- 4847. By Andrew Bennetts
-
Cosmetic tweaks.
- 4846. By Andrew Bennetts
-
Add some docstrings, and only reset _terminal_
size_changed if it was set. - 4845. By Andrew Bennetts
-
Use consistent whitespace .c file.
- 4844. By Andrew Bennetts
-
Add pure C signal handler for SIGWINCH, avoiding bugs in CPython 2.6.[0-5] (and the absence of signal.siginterrupt in CPython < 2.6).
Why does the has_function cause spew?
Also, why do we override COLUMNS when we get sigwinch, thats non obvious to me.
I would needs info but no gpg for me in gmail!