Skip Menu |

This queue is for tickets about the Image-Scale CPAN distribution.

Report information
The Basics
Id: 119094
Status: open
Priority: 0/
Queue: Image-Scale

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in:
  • 0.13
  • 0.14
Fixed in: (no value)



Subject: Assertion failure in t/stringify.t
If perl was compiled with assertions enabled (i.e. with -DDEBUGGING) then t/stringify.t fails: ... perl5.18.1: src/image.c:48: image_init: Assertion `PL_valid_types_PVX[((svtype)((_svpvx)->sv_flags & 0xff)) & 0xf]' failed. t/stringify.t ...... Failed 3/3 subtests ... There are a couple of similar fail reports on CPAN Testers, e.g. http://www.cpantesters.org/cpan/report/1399d026-b221-11e6-9448-78cc4a3cd12f
Still true for 0.14. Sample fail report http://www.cpantesters.org/cpan/report/97534467 It's a SEGV. Stack trace: [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `/home/sand/src/perl/repoperls/installed-perls/host/k93msid/v5.28.0/29fb/bin/per'. Program terminated with signal SIGABRT, Aborted. #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00007f856f9402f1 in __GI_abort () at abort.c:79 #2 0x00007f856f937a8a in __assert_fail_base ( fmt=0x7f856fa8bec8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f856f201028 "PL_valid_types_PVX[SvTYPE(_svpvx) & SVt_MASK]", file=file@entry=0x7f856f202079 "src/image.c", line=line@entry=48, function=function@entry=0x7f856f202788 <__PRETTY_FUNCTION__.23106> "image_init") at assert.c:92 #3 0x00007f856f937b02 in __GI___assert_fail ( assertion=assertion@entry=0x7f856f201028 "PL_valid_types_PVX[SvTYPE(_svpvx) & SVt_MASK]", file=file@entry=0x7f856f202079 "src/image.c", line=line@entry=48, function=function@entry=0x7f856f202788 <__PRETTY_FUNCTION__.23106> "image_init") at assert.c:101 #4 0x00007f856f1fcb08 in image_init (self=self@entry=0x561ca58e2b18, im=0x561ca57eec38) at src/image.c:48 #5 0x00007f856f1fcd5d in XS_Image__Scale___init (my_perl=<optimized out>, cv=<optimized out>) at Scale.xs:33 #6 0x0000561ca35a4916 in Perl_pp_entersub (my_perl=0x561ca4fed260) at pp_hot.c:5232 #7 0x0000561ca355d6ea in Perl_runops_debug (my_perl=0x561ca4fed260) at dump.c:2535 #8 0x0000561ca34c168e in S_run_body (oldscope=1, my_perl=0x561ca4fed260) at perl.c:2694 #9 perl_run (my_perl=0x561ca4fed260) at perl.c:2617 #10 0x0000561ca348632e in main (argc=<optimized out>, argv=<optimized out>, env=<optimized out>) at perlmain.c:122
src/image.c image_init has this code: --8<--- if (my_hv_exists(self, "file")) { // Input from file SV *path = *(my_hv_fetch(self, "file")); file = SvPVX(path); im->fh = IoIFP(sv_2io(*(my_hv_fetch(self, "_fh")))); im->path = newSVsv(path); } -->8--- If I sv_dump (path) after the my_hv_fetch, I see --8<--- SV = IV(0x1102e90) at 0x1102ea0 REFCNT = 1 FLAGS = (ROK) RV = 0x136ccf0 SV = PVAV(0x1317ce0) at 0x136ccf0 REFCNT = 3 FLAGS = (OBJECT) STASH = 0xa0fb70 "Path::Tiny" ARRAY = 0x13837d0 FILL = 1 MAX = 1 FLAGS = (REAL) Elt No. 0 SV = PV(0x9d8380) at 0x1399b38 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0x135b2e0 "/data/home/merijn/.cpan/build/Image-Scale-0.14-0/t/images/jpg/rgb.jpg"\0 CUR = 69 LEN = 71 COW_REFCNT = 1 Elt No. 1 SV = PV(0x9d83d0) at 0x1399ec8 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0x135b2e0 "/data/home/merijn/.cpan/build/Image-Scale-0.14-0/t/images/jpg/rgb.jpg"\0 CUR = 69 LEN = 71 COW_REFCNT = 1 -->8--- So stringification of Path::Tiny::path doesn't happen in XS (anymore Changing the invocations in t/stringify.t to my $im = Image::Scale->new( Path::Tiny::path( _f("jpg/rgb.jpg") )->stringify ); $im->save_jpeg( Path::Tiny::path($outjpg)->stringify ); $im->save_png( Path::Tiny::path($outpng)->stringify ); causes a PASS
On Mon Dec 10 04:43:53 2018, HMBRAND wrote: Show quoted text
> src/image.c image_init has this code: > --8<--- > if (my_hv_exists(self, "file")) { > // Input from file > SV *path = *(my_hv_fetch(self, "file")); > file = SvPVX(path);
Changing this line to: file = SvPV_nolen(path); will fix the problem. SvPVX() in the Path::Tiny case ends up being the RV - not a string pointer, and since file is only used in error reporting and the test case doesn't test error reporting, it isn't obvious that the value of file is broken on non-DEBUGGING builds. Tony