Title: test_curses is failing on Ubuntu 13.10
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: larry Nosy List: larry, nadeem.vawda, python-dev, serhiy.storchaka, zach.ware
Priority: high Keywords:

Created on 2014-01-23 09:00 by larry, last changed 2014-01-26 06:22 by larry. This issue is now closed.

Messages (6)
msg208887 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-23 09:00
If I build current trunk on my workstation (Linux 64-bit, Ubuntu 13.10) then run

  % ./python -m test -u all test_curses

I get a traceback.  Here's the interesting part:

      File "/home/larry/src/python/buildtrunk/Lib/test/",
        line 118, in window_funcs

        win2.overlay(win, 1, 2, 3, 3, 2, 1)

      _curses.error: copywin() returned ERR

Zach: I just saw you had a patch specifically against, can you take a look?
msg208955 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-01-23 15:15
I'm on Windows until this evening; I'll see what I can see when I'm on a machine that can actually build _curses.

I don't see any failures on any of the buildbots, so I'm not sure how likely it is I'll be able to reproduce your failure.

(And btw, that patch I have against test_curses is just a mechanical conversion to unittest, the only curses I'm an expert at are ones directed at problems...)
msg209000 - (view) Author: Nadeem Vawda (nadeem.vawda) * (Python committer) Date: 2014-01-23 21:37
I can reproduce this (also on Ubuntu 13.10 64-bit). Maybe there's a bug
in the version of curses distributed with the latest Ubuntu release? It
looks like our only Ubuntu buildbot is using 8.04 (almost 6 years old!).

Also note that you won't be able to reproduce this with "make test" or
"make testall" (see issue 12669). "make buildbottest" does catch the bug,
though (which also rules out the possibility that the buildbots are just
skipping the test).
msg209256 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-01-25 23:51
Ok, I've tracked down where the error is happening, but I don't know enough about curses to suggest where it should go from here.  It does appear to be the version of ncurses that Ubuntu 13.10 uses that's causing problems, version 5.9+20130608.  The issue stems from a change in ncurses/base/lib_overlay.c, here's the relevant part of the diff to copywin (left is vanilla ncurses-5.9 from, right is ncurses-5.9+20130608 obtained by 'sudo apt-get source ncurses'):

--- ncurses-5.9/ncurses/base/lib_overlay.c      2009-10-24 18:21:31.000000000 -0500
+++ ncurses-5.9+20130608/ncurses/base/lib_overlay.c     2014-01-25 17:13:08.461548012 -0600
@@ -151,7 +151,10 @@
        dminrow, dmincol,
        dmaxrow, dmaxcol, over));
-    if (src && dst) {
+    if (src != 0
+       && dst != 0
+       && dmaxrow >= dminrow
+       && dmaxcol >= dmincol) {
        bk = AttrOf(dst->_nc_bkgd);

The failing test passes 1, 2, 3, 3, 2, 1 for sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, which fails the dmaxrow >= dminrow check and copywin returns -1 (ERR).  Changing the test to call with 1, 1, 2, 2, 3, 3 prevents the failure, but does ugly things to the tty when the process ends.
msg209280 - (view) Author: Roundup Robot (python-dev) Date: 2014-01-26 06:20
New changeset 0ae768637a07 by Larry Hastings in branch 'default':
Issue #20358: Tests for curses.window.overlay and curses.window.overwrite
msg209281 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-26 06:22
I changed the unit test so it doesn't specify a minium row/column greater than the maximum row/column.  The tests now pass.  So I'm calling this good.  Thanks for looking in to it, Zachary and Nadeem!
Date User Action Args
2014-01-26 06:22:34larrysetstatus: open -> closed
messages: + msg209281

assignee: larry
resolution: fixed
stage: needs patch -> resolved
2014-01-26 06:20:17python-devsetnosy: + python-dev
messages: + msg209280
2014-01-25 23:51:29zach.waresetmessages: + msg209256
title: test_curses is failing -> test_curses is failing on Ubuntu 13.10
2014-01-23 21:37:24nadeem.vawdasetmessages: + msg209000
2014-01-23 15:15:13zach.waresetmessages: + msg208955
2014-01-23 09:12:55serhiy.storchakasetnosy: + serhiy.storchaka
2014-01-23 09:10:33nadeem.vawdasetnosy: + nadeem.vawda
2014-01-23 09:00:18larrycreate