Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloning STDOUT looses encoding #15419

Open
p5pRT opened this issue Jul 3, 2016 · 3 comments
Open

Cloning STDOUT looses encoding #15419

p5pRT opened this issue Jul 3, 2016 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 3, 2016

Migrated from rt.perl.org#128530 (status was 'open')

Searchable as RT128530$

@p5pRT
Copy link
Author

p5pRT commented Jul 3, 2016

From @exodist

Created by @exodist

The following script can demonstrate this issue​:

use strict;
use warnings;

binmode *STDOUT, "​:encoding(utf8)";

open(my $copy, '>&', STDOUT);
print $copy "\x{11e}\n";

Normal STDOUT​:

$ perl test.pl
Wide character in print at test.pl line 7.
Ğ

Redirect STDOUT to file​:

$ perl test.pl > temp
cat temp
Ğ

When STDOUT is a filehandle it behaves differently...

This was found because of a Test​::More unit test which passes when run under
any harness, but fails when run directly with perl. This can have lots of
implications for testing in general, there are probably a lot of unit tests
that check encodings and such. These is also no good way to write a test for
this specific problem, the very fact that tests run in a harness could
prevent
issues from being seen.

Perl Info

Flags:
    category=core
    severity=low

Site configuration information for perl 5.22.2:

Configured by exodist at Mon May  2 14:25:44 PDT 2016.

Summary of my perl5 (revision 5 version 22 subversion 2) configuration:

  Platform:
    osname=linux, osvers=4.5.1-1-arch, archname=x86_64-linux-thread-multi
    uname='linux abydos 4.5.1-1-arch #1 smp preempt thu apr 14 19:19:32
cest 2016 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/exodist/perl5/perlbrew/perls/main
-Dusethreads -Aeval:scriptdir=/home/exodist/perl5/perlbrew/perls/main/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv
-fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe
-fstack-protector-strong -I/usr/local/include'
    ccversion='', gccversion='5.3.0', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678,
doublekind=3
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16,
longdblkind=3
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/include-fixed /usr/lib
/lib/../lib /usr/lib/../lib /lib /lib64 /usr/lib64
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
-lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.23.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.23'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib
-fstack-protector-strong'

Locally applied patches:
    Devel::PatchPerl 1.38


@INC for perl 5.22.2:

/home/exodist/perl5/perlbrew/perls/main/lib/site_perl/5.22.2/x86_64-linux-thread-multi
    /home/exodist/perl5/perlbrew/perls/main/lib/site_perl/5.22.2

/home/exodist/perl5/perlbrew/perls/main/lib/5.22.2/x86_64-linux-thread-multi
    /home/exodist/perl5/perlbrew/perls/main/lib/5.22.2
    .


Environment for perl 5.22.2:
    HOME=/home/exodist
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)

PATH=/home/exodist/perl5/perlbrew/bin:/home/exodist/perl5/perlbrew/perls/main/bin:/home/exodist/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
    PERLBREW_BASHRC_VERSION=0.73
    PERLBREW_HOME=/home/exodist/.perlbrew
    PERLBREW_MANPATH=/home/exodist/perl5/perlbrew/perls/main/man

PERLBREW_PATH=/home/exodist/perl5/perlbrew/bin:/home/exodist/perl5/perlbrew/perls/main/bin
    PERLBREW_PERL=main
    PERLBREW_ROOT=/home/exodist/perl5/perlbrew
    PERLBREW_VERSION=0.75
    PERL_BADLANG (unset)
    SHELL=/usr/bin/zsh

@p5pRT
Copy link
Author

p5pRT commented Jul 15, 2016

From @cpansprout

Is this a duplicate of #123173

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 15, 2016

The RT System itself - Status changed from 'new' to 'open'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants