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

SelectSaver(IO::Scalar) - cannot call PRINT on an undefined value #13573

Open
p5pRT opened this issue Feb 3, 2014 · 3 comments
Open

SelectSaver(IO::Scalar) - cannot call PRINT on an undefined value #13573

p5pRT opened this issue Feb 3, 2014 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 3, 2014

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

Searchable as RT121158$

@p5pRT
Copy link
Author

p5pRT commented Feb 3, 2014

From wesley.spikes@dreamhost.com

Created by wesley.spikes@dreamhost.com

Using SelectSaver+IO​::Scalar in one line causes perl to error with​:

  Can't call method "PRINT" on an undefined value at
  p5p-XJJCDNvk.pl line 11.

The below test case WORKS on 5.10.1, and FAILS on both Perl 5.16.3
and Perl 5.18.2. Other versions have not been tried.

This is boiled down from a real world use case where this change in
behavior is breaking a production application.

We have a workaround where we store the IO​::Scalar object and the
SelectSaver object in a stash in a wrapper object.

Test case​:

----
# http​://pastebin.com/XJJCDNvk
use strict;
use warnings;

use IO​::Scalar;
use SelectSaver;

print "Before\n";
my $out = '';
{
  my $Saver = SelectSaver->new(IO​::Scalar->new(\$out));
  print "Middle\n";
};
print "After\n";
print "out is $out\n";
----

Perl Info

Flags:
    category=library
    severity=medium
    module=SelectSaver

Site configuration information for perl 5.16.3:

Configured by cgranum at Wed Jan 22 09:22:45 PST 2014.

Summary of my perl5 (revision 5 version 16 subversion 3) configuration:
   
  Platform:
    osname=linux, osvers=2.6.32.8-grsec-2.1.14-modsign-xeon-64, archname=x86_64-linux
    uname='linux fubar 2.6.32.8-grsec-2.1.14-modsign-xeon-64 #2 smp sat mar 13 00:42:43 pst 2010 x86_64 gnulinux '
    config_args='-de -Dprefix=/opt/plack/perl -Accflags=-fPIC'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fPIC -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fPIC -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.3.2', 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/../lib /usr/lib/../lib /lib /usr/lib /lib64 /usr/lib64
    libs=-lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.7.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.7'
  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.3:
    /opt/plack/perl/lib/site_perl/5.16.3/x86_64-linux
    /opt/plack/perl/lib/site_perl/5.16.3
    /opt/plack/perl/lib/5.16.3/x86_64-linux
    /opt/plack/perl/lib/5.16.3
    .


Environment for perl 5.16.3:
    HOME=/home/wesleys
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LC_COLLATE=C
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/wesleys/local/bin:/dh/bin:/home/wesleys/local/bin:/home/wesleys/bin:/home/wesleys/.gems/bin:/usr/lib/ruby/gems/1.8/bin/:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Feb 4, 2014

From @iabyn

On Mon, Feb 03, 2014 at 03​:08​:12PM -0800, via RT wrote​:

# New Ticket Created by
# Please include the string​: [perl #121158]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=121158 >

This is a bug report for perl from wesley.spikes@​dreamhost.com,
generated with the help of perlbug 1.39 running under perl 5.16.3.

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

Using SelectSaver+IO​::Scalar in one line causes perl to error with​:

Can't call method "PRINT" on an undefined value at
p5p\-XJJCDNvk\.pl line 11\.

The below test case WORKS on 5.10.1, and FAILS on both Perl 5.16.3
and Perl 5.18.2. Other versions have not been tried.

This is boiled down from a real world use case where this change in
behavior is breaking a production application.

We have a workaround where we store the IO​::Scalar object and the
SelectSaver object in a stash in a wrapper object.

Test case​:

----
# http​://pastebin.com/XJJCDNvk
use strict;
use warnings;

use IO​::Scalar;
use SelectSaver;

print "Before\n";
my $out = '';
{
my $Saver = SelectSaver->new(IO​::Scalar->new(\$out));
print "Middle\n";
};
print "After\n";
print "out is $out\n";

It bisects to the following change. I don't know whether it's perl or one
of the modules at fault.

commit 2acc331
Author​: Father Chrysostomos <sprout@​cpan.org>
Date​: Sun Oct 24 15​:50​:23 2010 -0700

  [perl #77810] Scalars vs globs
 
  Stop *{} from returning globs with the SVf_FAKE flag on.
 
  It removes three tests from t/op/gv.t (that I added) that test buggy
  edge cases that can no longer occur.
 
  It also modifies tests in t/io/defout.t to keep them passing. I am not
  sure that test script serves any purpose any more.

--
I before E. Except when it isn't.

@p5pRT
Copy link
Author

p5pRT commented Feb 4, 2014

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