Skip Menu |

This queue is for tickets about the PDL-Graphics-PLplot CPAN distribution.

Report information
The Basics
Id: 104424
Status: open
Priority: 0/
Queue: PDL-Graphics-PLplot

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.67
Fixed in: (no value)

Attachments
PDL-Graphics-PLplot-0.67-Postpone-setting-CHARSIZE-after-initializing-plplot.patch
PDL-Graphics-PLplot-0.67-Search-for-plplotd-before-plplot-library.patch



Subject: Does not work with PLplot 5.11.0
PLplot 5.11.0 renamed plplotd library to plplot, thus the Makefile.PL fails to detect the plplot library. After correcting the name, the t/plplot.t test segfaults just on the first object creation: $pl = PDL::Graphics::PLplot->new (DEV => $dev, FILE => "test2.$dev", BACKGROUND => [255,255,255]); Also this simple invocation segfaults: $ perl -Iblib/{arch,lib} -MPDL -MPDL::Graphics::PLplot -e 'PDL::Graphics::PLplot->new()' Program received signal SIGSEGV, Segmentation fault. 0x00007fffecb286fa in plP_state () from /lib64/libplplot.so.13 (gdb) bt #0 0x00007fffecb286fa in plP_state () from /lib64/libplplot.so.13 #1 0x00007fffece33ab2 in pdl_plschr_readdata (__tr=0x1395200) at PLplot.xs:11154 #2 0x00007fffef0f8194 in pdl.ensure_trans () from /usr/lib64/perl5/vendor_perl/auto/PDL/Core/Core.so #3 0x00007fffef0f7150 in pdl_make_trans_mutual () from /usr/lib64/perl5/vendor_perl/auto/PDL/Core/Core.so #4 0x00007fffecdfdabf in XS_PDL_plschr (my_perl=<optimized out>, cv=<optimized out>) at PLplot.xs:50441 #5 0x00007ffff7ae96ab in Perl_pp_entersub () from /lib64/libperl.so.5.20 #6 0x00007ffff7ae1f36 in Perl_runops_standard () from /lib64/libperl.so.5.20 #7 0x00007ffff7a719c0 in perl_run () from /lib64/libperl.so.5.20 #8 0x0000000000400d79 in main () This could be bug in the PLplot itself. I have plplot-5.11.0, PDL-2.7.0, perl-5.20.2, gcc-5.1.1.
From: ppisar [...] redhat.com
Dne Čt 14.Květen.2015 04:59:15, ppisar napsal(a): Show quoted text
> Also this simple invocation segfaults: > > $ perl -Iblib/{arch,lib} -MPDL -MPDL::Graphics::PLplot -e > 'PDL::Graphics::PLplot->new()' > Program received signal SIGSEGV, Segmentation fault. > 0x00007fffecb286fa in plP_state () from /lib64/libplplot.so.13 > (gdb) bt > #0 0x00007fffecb286fa in plP_state () from /lib64/libplplot.so.13 > #1 0x00007fffece33ab2 in pdl_plschr_readdata (__tr=0x1395200) at > PLplot.xs:11154 > #2 0x00007fffef0f8194 in pdl.ensure_trans () from > /usr/lib64/perl5/vendor_perl/auto/PDL/Core/Core.so > #3 0x00007fffef0f7150 in pdl_make_trans_mutual () from > /usr/lib64/perl5/vendor_perl/auto/PDL/Core/Core.so > #4 0x00007fffecdfdabf in XS_PDL_plschr (my_perl=<optimized out>, > cv=<optimized out>) at PLplot.xs:50441 > #5 0x00007ffff7ae96ab in Perl_pp_entersub () from > /lib64/libperl.so.5.20 > #6 0x00007ffff7ae1f36 in Perl_runops_standard () from > /lib64/libperl.so.5.20 > #7 0x00007ffff7a719c0 in perl_run () from /lib64/libperl.so.5.20 > #8 0x0000000000400d79 in main () > > This could be bug in the PLplot itself. > > I have plplot-5.11.0, PDL-2.7.0, perl-5.20.2, gcc-5.1.1.
If I downgrade plplot to 5.10.0, it does not segfault. Something has changed in the plplot. So far I isolated the crash to the place when new() sets CHARSIZE option. If I comment the default CHARSIZE=>1 option out, all tests pass.
From: ppisar [...] redhat.com
Dne Čt 14.Květen.2015 06:24:37, ppisar napsal(a): Show quoted text
> Dne Čt 14.Květen.2015 04:59:15, ppisar napsal(a):
> > Also this simple invocation segfaults: > > > > $ perl -Iblib/{arch,lib} -MPDL -MPDL::Graphics::PLplot -e > > 'PDL::Graphics::PLplot->new()' > > Program received signal SIGSEGV, Segmentation fault. > > 0x00007fffecb286fa in plP_state () from /lib64/libplplot.so.13 > > (gdb) bt > > #0 0x00007fffecb286fa in plP_state () from /lib64/libplplot.so.13 > > #1 0x00007fffece33ab2 in pdl_plschr_readdata (__tr=0x1395200) at > > PLplot.xs:11154 > > #2 0x00007fffef0f8194 in pdl.ensure_trans () from > > /usr/lib64/perl5/vendor_perl/auto/PDL/Core/Core.so > > #3 0x00007fffef0f7150 in pdl_make_trans_mutual () from > > /usr/lib64/perl5/vendor_perl/auto/PDL/Core/Core.so > > #4 0x00007fffecdfdabf in XS_PDL_plschr (my_perl=<optimized out>, > > cv=<optimized out>) at PLplot.xs:50441 > > #5 0x00007ffff7ae96ab in Perl_pp_entersub () from > > /lib64/libperl.so.5.20 > > #6 0x00007ffff7ae1f36 in Perl_runops_standard () from > > /lib64/libperl.so.5.20 > > #7 0x00007ffff7a719c0 in perl_run () from /lib64/libperl.so.5.20 > > #8 0x0000000000400d79 in main () > > > > This could be bug in the PLplot itself. > > > > I have plplot-5.11.0, PDL-2.7.0, perl-5.20.2, gcc-5.1.1.
> > If I downgrade plplot to 5.10.0, it does not segfault. Something has > changed in the plplot. > > So far I isolated the crash to the place when new() sets CHARSIZE > option. If I comment the default CHARSIZE=>1 option out, all tests > pass.
It crashes inside XS_PDL_plschr() when calling PDL->make_trans_mutual((pdl_trans *)__privtrans). plplot addeded plP_state( PLSTATE_CHR ) call at the end of c_plschr(). After reading plplot-5.11.0/examples/perl/x02.pl example which itself uses this Perl module, I think the bug is that the CHARSIZE option invokes plschr() before calling plinit() in the new().
From: ppisar [...] redhat.com
Dne Čt 14.Květen.2015 07:19:14, ppisar napsal(a): Show quoted text
> After reading plplot-5.11.0/examples/perl/x02.pl example which itself > uses this Perl module, I think the bug is that the CHARSIZE option > invokes plschr() before calling plinit() in the new().
I can reproduce the crash with simple C code using the PLplot. I filed PLplot bug report <https://sourceforge.net/p/plplot/bugs/162/>.
Subject: Re: [rt.cpan.org #104424] Does not work with PLplot 5.11.0
Date: Thu, 14 May 2015 13:28:10 -0600
To: bug-PDL-Graphics-PLplot [...] rt.cpan.org
From: Doug Hunt <dhunt [...] ucar.edu>
Hi all: I'm trying to find time to look at this. Sorry for the delay, Doug Hunt On 05/14/15 06:10, Petr Pisar via RT wrote: Show quoted text
> Queue: PDL-Graphics-PLplot > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=104424 > > > Dne Čt 14.Květen.2015 07:19:14, ppisar napsal(a):
>> After reading plplot-5.11.0/examples/perl/x02.pl example which itself >> uses this Perl module, I think the bug is that the CHARSIZE option >> invokes plschr() before calling plinit() in the new().
> I can reproduce the crash with simple C code using the PLplot. I filed PLplot bug report <https://sourceforge.net/p/plplot/bugs/162/>. >
Subject: Re: [rt.cpan.org #104424] Does not work with PLplot 5.11.0
Date: Fri, 15 May 2015 09:35:07 +0200
To: Douglas Hunt via RT <bug-PDL-Graphics-PLplot [...] rt.cpan.org>
From: Petr Pisar <ppisar [...] redhat.com>
On Thu, May 14, 2015 at 03:28:33PM -0400, Douglas Hunt via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=104424 > > > Hi all: I'm trying to find time to look at this. >
Here is proper backward-compatible patch adding support for linking against plplot-5.11.0. I verified it with plplot-5.10.0 too. The patch solves only the plplotd to plplot rename. It does not solve the crash. -- Petr
From fb95787f2bcaff936e961665782c90becdf69963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Thu, 14 May 2015 10:31:28 +0200 Subject: [PATCH] Search for plplotd before plplot library MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PLplot 5.11.0 renamed the library from plplotd to plplot. This patch checks first for plplotd and then for plplot library because older PLplot versions could deliver both of them while only the plplotd supported double precision. This patch also corrects check for double precission support to use discoverd linker flags. Signed-off-by: Petr Písař <ppisar@redhat.com> --- Makefile.PL | 125 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 70 insertions(+), 55 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 8e0938e..6072b29 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -28,56 +28,68 @@ if (!$pdl_installed) { exit; } -# -## Search for plplot library and include file -# -print "\nChecking PDL::Graphics::PLplot...\n"; - -unlink ("OPTIONS!"); # remove file used to communicate with plplot.pd - -# on OS-X the library is called libplplotd.dylib, so we -# use $Config{"so"} to get the extension name -# -my $libname = "libplplotd." . $Config{"so"}; -my $libname_static = "libplplotd.a"; -my $incname = "plplot.h"; -my $devnull = File::Spec->devnull(); # Portable null device. - # require bad value support. D. Hunt 10/20/2008 unless ($PDL::Config{WITH_BADVAL}) { buildDummy ("Bad value support required! (Turn on WITH_BADVAL in perldl.conf)"); return if (caller); exit; } +# +## Search for plplot library and include file +# +print "\nChecking PDL::Graphics::PLplot...\n"; -foreach my $libdir ( - $ENV{PLPLOT_LIBDIR}, - $PDL::Config{WHERE_PLPLOT_LIBS}, - '/usr/local/plplot/lib64', - '/usr/local/plplot/lib', - '/usr/local/lib64', - '/usr/local/lib', - '/opt/local/lib', - '/usr/lib64', - '/usr/lib', - '/opt/lib64', - '/opt/lib', - '/ops/tools/lib', - '/sw/lib/', # default FINK installation - # Add new library paths here!! - ) { +unlink ("OPTIONS!"); # remove file used to communicate with plplot.pd + +my $libbasename; +my $libname; +my $plplot_lib_path; + +# PLplot 5.11.0 renamed the library from plplotd to plplot. Search for both of +# them. +foreach ('plplotd', 'plplot') { + # on OS-X the library is called libplplot.dylib, so we + # use $Config{"so"} to get the extension name + # + $libbasename = $_; + $libname = "lib${libbasename}." . $Config{"so"}; + my $libname_static = "lib{$libbasename}.a"; + print "Searching for ${libname} library.\n"; + + foreach my $libdir ( + $ENV{PLPLOT_LIBDIR}, + $PDL::Config{WHERE_PLPLOT_LIBS}, + '/usr/local/plplot/lib64', + '/usr/local/plplot/lib', + '/usr/local/lib64', + '/usr/local/lib', + '/opt/local/lib', + '/usr/lib64', + '/usr/lib', + '/opt/lib64', + '/opt/lib', + '/ops/tools/lib', + '/sw/lib/', # default FINK installation + # Add new library paths here!! + ) { + + if (-e "$libdir/$libname") { + $plplot_lib_path = $libdir; + $ENV{LD_LIBRARY_PATH} .= ":$libdir"; + last; + } elsif (-e "$libdir/$libname_static") { + $plplot_lib_path = $libdir; + $ENV{LD_LIBRARY_PATH} .= ":$libdir"; + $libname = $libname_static; + last; + } - if (-e "$libdir/$libname") { - $plplot_lib_path = $libdir; - $ENV{LD_LIBRARY_PATH} .= ":$libdir"; - last; - } elsif (-e "$libdir/$libname_static") { - $plplot_lib_path = $libdir; - $ENV{LD_LIBRARY_PATH} .= ":$libdir"; - $libname = $libname_static; - last; } + if (defined $plplot_lib_path) { + print "Found in ${plplot_lib_path}.\n"; + last; + } } unless (defined ($plplot_lib_path)) { @@ -85,6 +97,9 @@ unless (defined ($plplot_lib_path)) { return if (caller); exit; } +my $incname = "plplot.h"; +my $devnull = File::Spec->devnull(); # Portable null device. + foreach my $incdir ( $ENV{PLPLOT_INCDIR}, $PDL::Config{WHERE_PLPLOT_INCLUDE}, @@ -118,24 +133,12 @@ unless (defined ($plplot_include_path)) { return if (caller); exit; } -# Test that PLplot was compiled --with-double (IE, a PLFLT is a double) -my $size = compileAndRun ("$plplot_include_path", 1, <<'EOC'); -#include <plplot.h> -main () { printf ("%d", sizeof (PLFLT)); } -EOC - -unless ($size == 8) { - print " Sizeof(PLFLT) must be 8. PLplot must be compiled --with-double (IE ./configure --with-double)\n"; - buildDummy ("Cannot find good set of libraries for linking PLplot, try fiddling perldl.conf\n"); - return if (caller); exit; -} - # Try linking with library. New if blocks should be added if necessary my $libs; foreach my $l ( - "-L$plplot_lib_path -lplplotd -lX11", - "-L$plplot_lib_path -lplplotd", - "-L$plplot_lib_path -lplplotd -lqsastime -lcsirocsa -lgdi32 -lcomdlg32", + "-L$plplot_lib_path -l${libbasename} -lX11", + "-L$plplot_lib_path -l${libbasename}", + "-L$plplot_lib_path -l${libbasename} -lqsastime -lcsirocsa -lgdi32 -lcomdlg32", # New lib combinations should be added here! ) { if (trylink( '', '#include <plplot.h>', 'plinit();', "$l $plplot_include_path")) { @@ -150,6 +153,18 @@ unless (defined($libs)) { return if (caller); exit; } +# Test that PLplot was compiled --with-double (IE, a PLFLT is a double) +my $size = compileAndRun ("$plplot_include_path $libs", 1, <<'EOC'); +#include <plplot.h> +main () { printf ("%d", sizeof (PLFLT)); } +EOC + +unless ($size == 8) { + print " Sizeof(PLFLT) must be 8. PLplot must be compiled --with-double (IE ./configure --with-double)\n"; + buildDummy ("PLplot was not compiled --with-double, try fiddling perldl.conf\n"); + return if (caller); exit; +} + # ## Tests for various PLplot features, present in different versions of PLplot # -- 2.1.0
Download (untitled)
application/pgp-signature 213b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #104424] Does not work with PLplot 5.11.0
Date: Fri, 15 May 2015 11:18:31 +0200
To: Douglas Hunt via RT <bug-PDL-Graphics-PLplot [...] rt.cpan.org>
From: Petr Pisar <ppisar [...] redhat.com>
On Thu, May 14, 2015 at 03:28:33PM -0400, Douglas Hunt via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=104424 > > > Hi all: I'm trying to find time to look at this. >
And here is a workaround for the crash. I tried differnt orderings of calls, but it looks like some needs to be called before plinit(), so I applied the least change. -- Petr
From 85865109e9b2455bfe2cec8c947dcbab4942f0e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Fri, 15 May 2015 09:38:15 +0200 Subject: [PATCH] Postpone setting CHARSIZE after initializing plplot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since PLplot 5.11.0, calling plschr() before plinit() leads to crash. Reproducer: $ perl -MPDL -MPDL::Graphics::PLplot -e 'PDL::Graphics::PLplot->new()' This patch moves setting CHARSIZE after calling plinit(). <https://rt.cpan.org/Public/Bug/Display.html?id=104424> <https://sourceforge.net/p/plplot/bugs/162/> Signed-off-by: Petr Písař <ppisar@redhat.com> --- plplot.pd | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plplot.pd b/plplot.pd index 4410604..c3b74e1 100644 --- a/plplot.pd +++ b/plplot.pd @@ -1516,6 +1516,14 @@ sub new { CHARSIZE => 1, @_); + # Since PLplot 5.11.0, calling plschr() before plinit() cases a crash + # (CPAN RT#104424). Postpone setting CHARSIZE after plinit(). + my %postinit_opts; + for my $option ('CHARSIZE') { + if (exists $opts{$option}) { + $postinit_opts{$option} = delete $opts{$option}; + } + } # apply options $self->setparm(%opts); @@ -1528,6 +1536,9 @@ sub new { plscmap1n (128); # set map 1 to 128 colors (should work for devices with 256 colors) plinit (); + # apply post-plinit options + $self->setparm(%postinit_opts); + # set page orientation plsdiori ($self->{ORIENTATION}); -- 2.1.0
Download (untitled)
application/pgp-signature 213b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #104424] Does not work with PLplot 5.11.0
Date: Fri, 15 May 2015 08:55:42 -0600
To: bug-PDL-Graphics-PLplot [...] rt.cpan.org
From: Doug Hunt <dhunt [...] ucar.edu>
Thanks! --Doug On 05/15/15 01:35, Petr Pisar via RT wrote: Show quoted text
> Queue: PDL-Graphics-PLplot > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=104424 > > > On Thu, May 14, 2015 at 03:28:33PM -0400, Douglas Hunt via RT wrote:
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=104424 > >> >> Hi all: I'm trying to find time to look at this. >>
> Here is proper backward-compatible patch adding support for linking against > plplot-5.11.0. I verified it with plplot-5.10.0 too. The patch solves only the > plplotd to plplot rename. It does not solve the crash. > > -- Petr >
Subject: Re: [rt.cpan.org #104424] Does not work with PLplot 5.11.0
Date: Fri, 15 May 2015 15:10:47 -0600
To: bug-PDL-Graphics-PLplot [...] rt.cpan.org
From: Doug Hunt <dhunt [...] ucar.edu>
Hi Petr: I've uploaded a new version of PDL-Graphics-PLplot to PAUSE: PDL-Graphics-PLplot-0.71.tar.gz which incorporates your patch and also defers calling plscrh() until after the call to plinit(). I've tested this with your combination: plplot-5.11.0, PDL-2.7.0, perl-5.20.2 on Linux CentOS 6. I've also tested with perl 5.16.1, PDL 2.4.11 and plplot 5.9.10 on CentOS 6. Now all tests under PDL-Graphics-PLplot pass. Best Regards, Doug Hunt On 05/15/15 01:35, Petr Pisar via RT wrote: Show quoted text
> Queue: PDL-Graphics-PLplot > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=104424 > > > On Thu, May 14, 2015 at 03:28:33PM -0400, Douglas Hunt via RT wrote:
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=104424 > >> >> Hi all: I'm trying to find time to look at this. >>
> Here is proper backward-compatible patch adding support for linking against > plplot-5.11.0. I verified it with plplot-5.10.0 too. The patch solves only the > plplotd to plplot rename. It does not solve the crash. > > -- Petr >
There is a typo in the patch: "lib{$libbasename}.a" vs. "lib${libbasename}.a"

I have included a fix in my patch attached to https://rt.cpan.org/Ticket/Display.html?id=105024