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

:stdio + any other layer hangs #12146

Closed
p5pRT opened this issue May 29, 2012 · 2 comments
Closed

:stdio + any other layer hangs #12146

p5pRT opened this issue May 29, 2012 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented May 29, 2012

Migrated from rt.perl.org#113424 (status was 'new')

Searchable as RT113424$

@p5pRT
Copy link
Author

p5pRT commented May 29, 2012

From @Leont

This is a bug report for perl from fawaka@​gmail.com,
generated with the help of perlbug 1.39 running under perl 5.16.0.


The :stdio PerlIO layer doesn't function correctly when it's not the
topmost layer. Take this test​:

use Test​::More tests => 1;

pipe my $in, my $out;
binmode $in, '​:encoding(utf-8)';
syswrite $out, "...\n";
my $line = readline $in;
is( $line, "...\n", 'Reading utf8' );

It will work fine under normal circumstances, but if you run it with
the PERLIO environmental variable set to "stdio", it will hang. The
reason is that :encoding reads its buffer in blocks, but :stdio's read
method is implemented in terms of fread, which retries until it can
read N bytes. Our own readline is build on top of that, but can't take
its (while/getc) hack to solve this because encoding is inbetween.

I suspect fixing this will require a complete refactor of readline to
integrate it into PerlIO, and even then it looks rather tricky :-/



Flags​:
  category=core
  severity=medium


Site configuration information for perl 5.16.0​:

Configured by leon at Mon May 21 12​:51​:40 CEST 2012.

Summary of my perl5 (revision 5 version 16 subversion 0) configuration​:

  Platform​:
  osname=linux, osvers=3.0.0-19-generic, archname=x86_64-linux-thread-multi
  uname='linux leon-laptop 3.0.0-19-generic #33-ubuntu smp thu apr
19 19​:05​:14 utc 2012 x86_64 x86_64 x86_64 gnulinux '
  config_args='-de
-Dprefix=/home/leon/perl5/perlbrew/perls/perl-5.16.0 -Dusethreads
-Dusesphplib'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=define, usemultiplicity=define
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
  optimize='-O2',
  cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.6.1', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  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 -L/usr/local/lib'
  libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib
/usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
  libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
  perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
  libc=, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version='2.13'
  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'

Locally applied patches​:


@​INC for perl 5.16.0​:
  /home/leon/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/x86_64-linux-thread-multi
  /home/leon/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0
  /home/leon/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/x86_64-linux-thread-multi
  /home/leon/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0
  .


Environment for perl 5.16.0​:
  HOME=/home/leon
  LANG=en_US.utf8
  LANGUAGE=en_US​:en_GB​:en
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/home/leon/perl5/perlbrew/bin​:/home/leon/perl5/perlbrew/perls/perl-5.16.0/bin​:/home/leon/bin​:/usr/lib/lightdm/lightdm​:/usr/local/sbin​:/usr/local/bin​:/usr/sbin​:/usr/bin​:/sbin​:/bin​:/usr/games
  PERLBREW_HOME=/home/leon/.perlbrew
  PERLBREW_PATH=/home/leon/perl5/perlbrew/bin​:/home/leon/perl5/perlbrew/perls/perl-5.16.0/bin
  PERLBREW_PERL=perl-5.16.0
  PERLBREW_ROOT=/home/leon/perl5/perlbrew
  PERLBREW_VERSION=0.25
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@Leont
Copy link
Contributor

Leont commented Mar 9, 2020

This is a duplicate of #6924

@Leont Leont closed this as completed Mar 9, 2020
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