#353 imag2d not 'use warnings' safe and no way to disable twiddle

feature_request
pending-fixed
None
7
4 days ago
2014-03-31
Chris Marshall
No

The current PDL::Graphics2D is not 'use warnings' safe and there
is no way to disable the twiddle() process when you call imag2d().
This means that you always have to deal with keyboard input in
the first display window---even if you don't want or need it....

On Sun, 30 Mar 2014 21:20:19 +0200, Chris Marshall devel.chm.01@gmail.com wrote:

Hi Roland-

Could you please send me a small sample code that
generates the GLUquad warnings as well as your perl -V
output? I think the problem is related to recent perl and
some modules automatically enabling warnings. I need to
see the exact string so I can try to reproduce.

Hi Chris,

the following code issues the warnings (which I currently
disable by commenting out "use warnings"):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl

use strict;
use warnings;
use PDL;
use PDL::Parallel::threads;
use PDL::Graphics2D;

sub PDL::Graphics2D::twiddle {};

my $img = zeroes(3,400,400);
my $win = imag2d($img, "Test");

threads->new(sub { print "In non-grafix thread...\n"; });

for my $thr (threads->list) {
    $thr->join;
}

Note I actually took the dirty route of overriding the
twiddle() function as there appears to be no way to disable
it! Of course that triggers another warning.

Running under Perl 5.10 with PDL 2.007 I get the following
output:


Subroutine PDL::CLONE_SKIP redefined at /usr/local/lib/perl/5.10.1/PDL/Parallel/threads.pm line 39.
Subroutine PDL::Graphics2D::twiddle redefined at GLUquad.pl line 9.
Can't locate package GLUquadricObjPtr for @OpenGL::Quad::ISA at GLUquad.pl line 14.
Can't locate package GLUquadricObjPtr for @OpenGL::Quad::ISA at GLUquad.pl line 14.
In non-grafix thread...


Note that the GLUquadric warnings disappear when I comment
out the thread. The CLONE_SKIP warning is always present,
even when I disable warnings.

See perl -V output below. (Note I didn't CC this to the list
as I considered it too verbose; feel free to forward).


Summary of my perl5 (revision 5 version 10 subversion 1) configuration:

Platform:
osname=linux, osvers=2.6.32-5-amd64, archname=i486-linux-gnu-thread-multi
uname='linux biber 2.6.32-5-amd64 #1 smp mon feb 25 00:26:11 utc 2013
i686 gnulinux '
config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i486-linux-gnu -Dprefix=/usr
-Dprivlib=/usr/share/perl/5.10 -Darchlib=/usr/lib/perl/5.10 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5
-Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local
-Dsitelib=/usr/local/share/perl/5.10.1
-Dsitearch=/usr/local/lib/perl/5.10.1 -Dman1dir=/usr/share/man/man1
-Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1
-Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -Dlibperl=libperl.so.5.10.1 -Dd_dosuid -des'
hint=recommended, useposix=true, d_sigaction=define
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='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -g',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.4.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='cc', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/lib64
libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt
perllibs=-ldl -lm -lpthread -lc -lcrypt
libc=/lib/libc-2.11.3.so, so=so, useshrplib=true,
libperl=libperl.so.5.10.1
gnulibc_version='2.11.3'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector'

Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS
USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
Locally applied patches:

 ...snip...

Built under linux
Compiled at Mar 6 2013 17:09:51
@INC:
/etc/perl
/usr/local/lib/perl/5.10.1
/usr/local/share/perl/5.10.1
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.10
/usr/share/perl/5.10
/usr/local/lib/site_perl
.


Thanks & best regards,

--Roland

Discussion

  • Chris Marshall
    Chris Marshall
    2014-03-31

    Hi Chris,

    I might add that the same code SEGFAULTs on my laptop under
    Perl 5.14, even when I disable threads:


    Subroutine PDL::CLONE_SKIP redefined at /usr/local/lib/perl/5.14.2/PDL/Parallel/threads.pm line 39.
    Subroutine PDL::Graphics2D::twiddle redefined at ./GLUquadric.pl line 9.
    Can't locate package GLUquadricObjPtr for @OpenGL::Quad::ISA at ./GLUquadric.pl line 14.
    Can't locate package GLUquadricObjPtr for @OpenGL::Quad::ISA at ./GLUquadric.pl line 14.
    In non-grafix thread...
    Segmentation fault (core dumped)


    See attachment for perl -V.

    Best regards,

    --Roland

     
  • Chris Marshall
    Chris Marshall
    2014-04-01

    Fixed in git via a new (experimental) interface to set the default twiddle action.

     
  • Chris Marshall
    Chris Marshall
    2014-04-12

    The commit was to the core-cleanup branch and will be available
    for the next PDL release. The new interface should be considered
    to be experimental to the extent that the API might change based
    on user feedback or other requirements.

     
  • Chris Marshall
    Chris Marshall
    2014-04-12

    • status: open --> pending-fixed
     
  • Chris Marshall
    Chris Marshall
    4 days ago

    • Priority: 5 --> 7
     
  • Chris Marshall
    Chris Marshall
    4 days ago

    Need to port this fix for PDL-2.008