Bug#547231: libterm-readline-gnu-perl: clobbers binmode layers on filehandles

Andrew Pimlott andrew at pimlott.net
Thu Sep 17 20:31:24 UTC 2009


Package: libterm-readline-gnu-perl
Version: 1.19-1
Severity: normal

If I call

    Term::ReadLine->new('test', \*IN, \*OUT);

any encoding layers I have set on OUT seem to be removed.  I tracked it
down to the line in the perl source that sets $Attribs{outstream}.  I
looked briefly at the .xs source for _rl_store_iostream, but I can't see
what's causing this.  I hope someone who knows perl internals can figure
it out.

Here's a complete test program.  I run it on a utf-8 terminal.  The
first print works correctly (the correct utf-8 byte sequence is output),
and the second shows a unicode unknown character (U+fffd), because perl
outputs the byte \xf3.

    use Term::ReadLine;
    binmode(STDOUT, ':encoding(utf-8)');
    print STDOUT ">", chr(0xf3), "<\n";
    $Term::ReadLine::Gnu::Attribs{outstream} = \*STDOUT;
    print STDOUT ">", chr(0xf3), "<\n";

Andrew

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libterm-readline-gnu-perl depends on:
ii  libc6                     2.9-26         GNU C Library: Shared libraries
ii  libncurses5               5.7+20090803-2 shared libraries for terminal hand
ii  libreadline5              5.2-6          GNU readline and history libraries
ii  perl                      5.10.0-25      Larry Wall's Practical Extraction 
ii  perl-base [perlapi-5.10.0 5.10.0-25      minimal Perl system

libterm-readline-gnu-perl recommends no packages.

libterm-readline-gnu-perl suggests no packages.

-- no debconf information





More information about the pkg-perl-maintainers mailing list