Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 2015 06:41:59 +0000
From:      raviqqe <raviqqe@gmail.com>
To:        Craig Rodrigues <rodrigc@FreeBSD.org>
Cc:        freebsd-python@freebsd.org
Subject:   Re: Python curses module does not print any attributed space character on FreeBSD 11-current
Message-ID:  <564D6F37.7040804@gmail.com>
In-Reply-To: <CAG=rPVdLctDFzCm7K824tkPC1dDBK=mSqkicg0Fs%2BdJJK1Nh8w@mail.gmail.com>
References:  <564D4739.1090504@gmail.com> <CAG=rPVdLctDFzCm7K824tkPC1dDBK=mSqkicg0Fs%2BdJJK1Nh8w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On 11/19/15 04:58 AM, Craig Rodrigues wrote:
> On Wed, Nov 18, 2015 at 7:51 PM, raviqqe <raviqqe@gmail.com 
> <mailto:raviqqe@gmail.com>> wrote:
>
>     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.
>
> Hi,
>
> I have a:
>   * FreeBSD-CURRENT system: built from Subversion revision r290830
>   * python27-2.710_1  (installed with pkg install lang/python )
>   * python35-3.5.0        (installed with pkg install lang/python35 )
>
> I ran your test case, and did not encounter your problem.
> For me, a space is printed in the top left.
>
> Also, I see:
>
>
> # ldd /usr/local/lib/python2.7/lib-dynload/_curses.so
> /usr/local/lib/python2.7/lib-dynload/_curses.so:
>         libthr.so.3 => /lib/libthr.so.3 (0x801212000)
>         libncurses.so.8 => /lib/libncurses.so.8 (0x801437000)
>         libpython2.7.so.1 => /usr/local/lib/libpython2.7.so.1 
> (0x80168a000)
>         libc.so.7 => /lib/libc.so.7 (0x800822000)
>         libintl.so.8 => /usr/local/lib/libintl.so.8 (0x801a48000)
>         libutil.so.9 => /lib/libutil.so.9 (0x801c52000)
>         libm.so.5 => /lib/libm.so.5 (0x801e65000)
> # ldd /usr/local/lib/python3.5/lib-dynload/_curses.so
> /usr/local/lib/python3.5/lib-dynload/_curses.so:
>         libthr.so.3 => /lib/libthr.so.3 (0x801214000)
>         libncurses.so.8 => /lib/libncurses.so.8 (0x801439000)
>         libpython3.5m.so.1.0 => /usr/local/lib/libpython3.5m.so.1.0 
> (0x801800000)
>         libc.so.7 => /lib/libc.so.7 (0x800822000)
>         libintl.so.8 => /usr/local/lib/libintl.so.8 (0x801c9b000)
>         libutil.so.9 => /lib/libutil.so.9 (0x801ea5000)
>         libm.so.5 => /lib/libm.so.5 (0x8020b8000)
>
>  At least for me, the Python _curses.so is linking against ncurses.so.8.
>
> --
> Craig

I always build and install ports via the ports system using `portmaster` 
and never use `pkg`.
Just now, I rebuilt lang/python27 and lang/python35.
But, still on my machine,

```
% ldd /usr/local/lib/python2.7/lib-dynload/_curses.so
/usr/local/lib/python2.7/lib-dynload/_curses.so:
     libthr.so.3 => /lib/libthr.so.3 (0x801212000)
     libncurses.so.5 => /usr/lib/libncurses.so.5 (0x801437000)
     libtinfo.so.5 => /usr/local/lib/libtinfo.so.5 (0x80168a000)
     libpython2.7.so.1 => /usr/local/lib/libpython2.7.so.1 (0x8018c0000)
     libc.so.7 => /lib/libc.so.7 (0x800822000)
     libintl.so.8 => /usr/local/lib/libintl.so.8 (0x801c7c000)
     libutil.so.9 => /lib/libutil.so.9 (0x801e87000)
     libm.so.5 => /lib/libm.so.5 (0x80209a000)
% ldd /usr/local/lib/python3.5/lib-dynload/_curses.so
/usr/local/lib/python3.5/lib-dynload/_curses.so:
     libthr.so.3 => /lib/libthr.so.3 (0x80121c000)
     libncurses.so.5 => /usr/lib/libncurses.so.5 (0x801441000)
     libtinfo.so.5 => /usr/local/lib/libtinfo.so.5 (0x801694000)
     libpython3.5dm.so.1.0 => /usr/local/lib/libpython3.5dm.so.1.0 
(0x801a00000)
     libc.so.7 => /lib/libc.so.7 (0x800822000)
     libintl.so.8 => /usr/local/lib/libintl.so.8 (0x802057000)
     libutil.so.9 => /lib/libutil.so.9 (0x802262000)
     libm.so.5 => /lib/libm.so.5 (0x802475000)
```

And devel/ncurses is explicitly required by them.

```
% pkg info -r ncurses
ncurses-5.9.20150214_2:
     sterm-0.6
     python27-2.7.10_1
     sqlite3-3.9.2
     tmux-2.1
     python34-3.4.3_1
     python35-3.5.0_1
     zsh-5.1.1
% pkg info -d python27
python27-2.7.10_1:
     openssl-1.0.2_4
     readline-6.3.8
     libffi-3.2.1
     gettext-runtime-0.19.6
     ncurses-5.9.20150214_2
% pkg info -d python35
python35-3.5.0_1:
     openssl-1.0.2_4
     readline-6.3.8
     libffi-3.2.1
     gettext-runtime-0.19.6
     ncurses-5.9.20150214_2
```

What's happening on my machine?
My uname is here.

```
% uname -a
FreeBSD <my hostname> 11.0-CURRENT FreeBSD 11.0-CURRENT #10 r291009: Wed 
Nov 18 06:47:11 UTC 2015     root@<my 
hostname>:/usr/obj/usr/src/sys/GENERIC  amd64
```




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?564D6F37.7040804>