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

perl 5.8.0 non-blocking PerlIO issue #6062

Closed
p5pRT opened this issue Nov 7, 2002 · 6 comments
Closed

perl 5.8.0 non-blocking PerlIO issue #6062

p5pRT opened this issue Nov 7, 2002 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 7, 2002

Migrated from rt.perl.org#18265 (status was 'resolved')

Searchable as RT18265$

@p5pRT
Copy link
Author

p5pRT commented Nov 7, 2002

From cturner@redhat.com

Created by cturner@redhat.com

The following script functions inappropriately when PERLIO=perlio is
set, but correctly when PERLIO=stdio is set. It seems that, for
nonblocking descriptors, read() can return undef without setting errno
(which should be set to EAGAIN). This bug originated from the
dvd​::rip people, who filed it in our Bugzilla against 5.8.0 in RHL 8.0
(url below). A quick look through bleedperl doesn't show anything
that would fix this, but I've not tested bleedperl itself.

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=75264

use strict;
use POSIX qw(​:errno_h mkfifo);
use Fcntl;

# to test this, run 'mkfifo test-fifo' and then 'cat > test-fifo' in a
# different terminal. the open() call will block until a writer to
# the fifo exists.

open FH, "< test-fifo"
  or die "open​: $!";

print "FIFO opened.\n";

my $flags = 0;
fcntl(FH, F_GETFL, $flags)
  or die "Can't get flags​: $!\n";
$flags |= O_NONBLOCK;
fcntl(FH, F_SETFL, $flags)
  or die "Can't set flags​: $!\n";

while (1) {
  my $data;
  my $nread = read FH, $data, 64;
  if (defined $nread) {
  print "Received data $data";
  }
  else {
  print "read returned undefined, errno $!\n";
  if ($! != EAGAIN) {
  print "read​: $!\n";
  last;
  }
  }
}

Perl Info

Flags:
    category=core
    severity=high

Site configuration information for perl v5.8.0:

Configured by bhcompile at Sun Sep  1 23:55:07 EDT 2002.

Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.18-11smp, archname=i386-linux-thread-multi
    uname='linux daffy.perf.redhat.com 2.4.18-11smp #1 smp thu aug 15 06:41:59 edt 2002 i686 i686 i386 gnulinux '
    config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O2 -march=i386 -mcpu=i686',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -I/usr/include/gdbm'
    ccversion='', gccversion='3.2 20020822 (Red Hat Linux Rawhide 3.2-5)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
    libc=/lib/libc-2.2.92.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.2.92'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.8.0:
    /usr/lib/perl5/5.8.0/i386-linux-thread-multi
    /usr/lib/perl5/5.8.0
    /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.0
    /usr/lib/perl5/site_perl/5.6.1
    /usr/lib/perl5/site_perl
    /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.0
    /usr/lib/perl5/vendor_perl
    .


Environment for perl v5.8.0:
    HOME=/home/devel/cturner
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/opt/oracle/bin:/opt/oracle/bin:/usr/kerberos/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/devel/cturner/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jan 12, 2003

nick@ing-simmons.net - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jan 12, 2003

From nick@ing-simmons.net

I can reproduce the problem.
Root cause is :perlio just not considering non-blocking IO at all.
So EAGAIN is just annother error condition and causes an EOF.

Requires some thought.

@p5pRT
Copy link
Author

p5pRT commented May 18, 2003

From nick@ing-simmons.net

Fixed by change 19556.
(Patch attached)

@p5pRT
Copy link
Author

p5pRT commented May 18, 2003

From nick@ing-simmons.net

patch

@p5pRT
Copy link
Author

p5pRT commented May 18, 2003

nick@ing-simmons.net - Status changed from 'open' to 'resolved'

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

1 participant