Skip Menu |
Report information
Id: 131221
Status: new
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: exodist7 [at] gmail.com
Cc:
AdminCc:

Operating System: Linux
PatchStatus: (no value)
Severity: medium
Type: core
Perl Version: 5.24.1
Fixed In: (no value)



To: perlbug [...] perl.org
Subject: Cannot clone handle with 'via' layer
From: Chad Granum <exodist7 [...] gmail.com>
Date: Thu, 27 Apr 2017 21:11:08 -0700
Download (untitled) / with headers
text/plain 4.2k
This is a bug report for perl from exodist7@gmail.com,
generated with the help of perlbug 1.40 running under perl 5.24.1.


-----------------------------------------------------------------
[Please describe your issue here]

You cannot clone a filehandle that has a 'via' perlio layer applied to it. 

Example script:

    use strict;
    use warnings;

    binmode(STDOUT, ':via(XXX)');
    open(my $fh, '>&STDOUT') or die "Could not clone STDOUT: $!";

    package PerlIO::via::XXX;

    sub PUSHED {
        my $class = shift;
        bless {}, $class;
    }   

    sub WRITE {
        my ($self, $buffer, $handle) = @_; 

        print $handle $buffer;
        return length($buffer);
    }   

Output:

    No package specified at test.pl line 5.
    Could not clone STDOUT: Invalid argument at test.pl line 5.



From what I can tell when poking around it looks like it is trying to apply all 
the same layers to the new handle, but when it gets to via it passes it as
':via' without the (XXX) argument.



[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl 5.24.1:

Configured by exodist at Fri Mar 31 18:01:00 PDT 2017.

Summary of my perl5 (revision 5 version 24 subversion 1) configuration:
___
  Platform:
    osname=linux, osvers=4.10.6-1-arch, archname=x86_64-linux-thread-multi
    uname='linux abydos 4.10.6-1-arch #1 smp preempt mon mar 27 08:28:22 cest 2017 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',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion='', gccversion='6.3.1 20170306', 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-pc-linux-gnu/6.3.1/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.25.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.25'
  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.46

---
@INC for perl 5.24.1:
    /home/exodist/perl5/perlbrew/perls/main/lib/site_perl/5.24.1/x86_64-linux-thread-multi
    /home/exodist/perl5/perlbrew/perls/main/lib/site_perl/5.24.1
    /home/exodist/perl5/perlbrew/perls/main/lib/5.24.1/x86_64-linux-thread-multi
    /home/exodist/perl5/perlbrew/perls/main/lib/5.24.1

---
Environment for perl 5.24.1:
    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/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
    PERLBREW_BASHRC_VERSION=0.78
    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.78
    PERL_BADLANG (unset)
    SHELL=/usr/bin/zsh



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org