SIGWINCH may not exist, even on non-Win32 platforms

Bug #535015 reported by Matt Nordhoff
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Low
Martin Packman

Bug Description

bzrlib.osutils.watch_sigwinch() assumes that SIGWINCH exists on all non-Win32 platforms, even though this may not be the case.

Specifically, a user in #bzr had issues because an old MacPorts build of Python 2.4.6 lacks SIGWINCH. Switching to OS X's 2.6.1 build fixed the problem.

It should be simple enough to just use getattr to check if it's available instead of checking the platform, unless signal does something bizarre?

Tags: easy trivial

Related branches

description: updated
Martin Pool (mbp)
tags: added: easy
Revision history for this message
Martin Packman (gz) wrote : Re: 'module' object has no attribute 'SIGWINCH' error on Bazaar-2.1.0-2 for OSX snow leopard

I've a branch with a fix for this, but the code has been moved more
than once since it landed so repeated conflicts have got in the way of
getting it landed.

The change started as the below, but any similar alteration to the
conditional should work:

=== modified file 'bzrlib/osutils.py'
--- old/bzrlib/osutils.py 2009-12-17 22:16:59 +0000
+++ new/bzrlib/osutils.py 2009-12-17 22:17:42 +0000
@@ -1477,11 +1477,7 @@
     if width is not None:
         os.environ['COLUMNS'] = str(width)

-if sys.platform == 'win32':
- # Martin (gz) mentioned WINDOW_BUFFER_SIZE_RECORD from ReadConsoleInput but
- # I've no idea how to plug that in the current design -- vila 20091216
- pass
-else:
+if os.name == "posix" and getattr(signal, "SIGWINCH", None) is not None:
     signal.signal(signal.SIGWINCH, _terminal_size_changed)

Revision history for this message
Martin Packman (gz) wrote :

Should be resolved in r5180.

Changed in bzr:
assignee: nobody → Martin [gz] (gz)
status: Confirmed → Fix Committed
Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 2.2b3
Revision history for this message
Vincent Ladeuil (vila) wrote :

@gz: we don't use fix committed anymore, we wait for the fix to land in either a stable branch or bzr.dev and set the milestone accordingly.

In retrospect, it's too bad we didn't put a NEWS entry to refer to this bug...

Changed in bzr:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.