From owner-freebsd-python@freebsd.org Thu Nov 19 03:57:16 2015 Return-Path: Delivered-To: freebsd-python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96744A313F1 for ; Thu, 19 Nov 2015 03:57:16 +0000 (UTC) (envelope-from raviqqe@gmail.com) Received: from mail-pa0-x234.google.com (mail-pa0-x234.google.com [IPv6:2607:f8b0:400e:c03::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 780F61E2C for ; Thu, 19 Nov 2015 03:57:16 +0000 (UTC) (envelope-from raviqqe@gmail.com) Received: by padhx2 with SMTP id hx2so66584354pad.1 for ; Wed, 18 Nov 2015 19:57:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:from:subject:message-id:date:user-agent:mime-version :content-type:content-transfer-encoding; bh=tPtTzQho1Ydk0vhma0Dx5+FQdxmJ/Ey4aTIalNIxFwA=; b=R2FJHR3n6pebX7mu1psiV2z6oi744cZct44ewXPszFydkz733Ac4RS3/qO8uZIU7sf yl5eS9xMVUF9Nk1mWyJ7lcPRTZtAGmJ6MLT8WLci3KGXAsTw2oe20GwuuAUgRph/tPhv I5kZDoo/3VQrdYV8bQXwW2m29O+oZQXJgUtCZkWbKkUDLZc3ZTZjGeBonSx3P+6WqnLv 2n3neyxacdS8BJb6qiblFiBLJMxM2m2NNt3SPTDRGwZ/z4vDMSFivpeXt3O6pgSMlUho wFQRuAxkiz4GWxaCEs4E5/53aZVYvUamZEwGGr8cE8Quo/nDfbAbtXVCMv8jdaCPvihB dxpQ== X-Received: by 10.68.195.129 with SMTP id ie1mr7392503pbc.100.1447905435933; Wed, 18 Nov 2015 19:57:15 -0800 (PST) Received: from coronoides.lostwoods ([133.21.225.184]) by smtp.googlemail.com with ESMTPSA id kj3sm6994746pbc.59.2015.11.18.19.57.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Nov 2015 19:57:15 -0800 (PST) To: freebsd-python@freebsd.org From: raviqqe Subject: Python curses module does not print any attributed space character on FreeBSD 11-current Message-ID: <564D4739.1090504@gmail.com> Date: Thu, 19 Nov 2015 03:51:21 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2015 03:57:16 -0000 Hello, TL;DR I encountered a bug-like behavior of a Python built-in module. Could you reproduce it in C? While working with Python and its curses module on FreeBSD 11-current (x86_64), I found a weird behavior of the module. The code below doesn't print any character although it should print a space on the upper-left corner. ``` # test.py import curses window = curses.initscr() window.attrset(curses.A_NORMAL) window.addch(" ") window.getch() curses.endwin() ``` The cause is `window.attrset()` and when I removed the line it works just fine. And, with the visible characters (such as 'A' and '?' except for ' ' and '\t'), it works fine even if window.attrset() is there. I found out Python's _curses.so links with /usr/local/lib/libncurses.so.5 dynamically. When I links it with the new /lib/libncurses.so.8 shipped with FreeBSD 11-current base as follows, the code above (test.py in the command line below) works fine. ``` $ ln -s /lib/libncurses.so.8 /usr/lib/libncurses.so.5 $ LD_LIBRARY_PATH=/usr/lib python3.5 test.py ``` Then, I tried to reproduce it in C with the code below. ``` // test.c #include int main() { WINDOW *win = initscr(); wattrset(win, A_NORMAL); waddch(win, ' '); getch(); endwin(); } ``` Compiled and run it (test.c). ``` $ cc /usr/local/lib/libncurses.so.5 /usr/local/lib/libtinfo.so.5 test.c $ ./a.out ``` It WORKS FINE as printing a space in place. I explored Modules/_cursesmodule.c in Python source tree and found that Python's curses.initscr() calls setupterm() in too. And, I checked the TERM environment variable. But, the real problem could not be revealed eventually. Could someone help me to reproduce the bug in C? Am I missing something? Or, do I misunderstand the problem? Thank you, all.