Skip Menu |

This queue is for tickets about the Variable-Magic CPAN distribution.

Report information
The Basics
Id: 107294
Status: resolved
Priority: 0/
Queue: Variable-Magic

People
Owner: Nobody in particular
Requestors: peter [...] dadeos.co.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 0.59



Subject: Crash during install of Variable-Magic-0.58 running "t\18-opinfo.t"
Date: Thu, 24 Sep 2015 12:24:34 +0100 (BST)
To: bug-Variable-Magic [...] rt.cpan.org
From: Peter Stokes <peter [...] dadeos.co.uk>
Hi, I am experiencing an access violation crash in Perl 5.22.0 whilst attempting running the "t\18-opinfo.t" test during installation of Variable-Magic-0.58 on Windows. The issue that I am encountering would appear to be similar to that reported in http://www.cpantesters.org/cpan/report/cbda218a-6c4a-1014-b9c5-a00a324d4f1e, which might suggest that http://git.profvince.com/?p=perl/modules/Variable-Magic.git;a=commit;h=47305776af757964b20c9739d4d44ad35a3dfb90 may not have resolved the issue? I’m afraid that the code contained within Magic.xs is somewhat beyond my current understanding. My testing thus far appears to indicate that the crash is 100% reproducible with Perl 5.22.0, yet does not occur with Perl 5.20.3. I have also noticed that the warning: 'Can't coerce GLOB to integer in transliteration (tr///) at (eval 117) line 1. also only appears to have been introduced when using Perl 5.22.0. As far as I can tell the crash occurs within Perl during the shutdown phase performed at the end of running the "t\18-opinfo.t" script. The crash may be avoided by not performing the transliteration test described on line 44 of "t\18-opinfo.t"; more specifically the variant associated with the ‘VMG_OP_INFO_NAME’ verification, with the ‘VMG_OP_INFO_OBJECT’ variant being the one that generates the 'Can't coerce GLOB to integer...' warning. I have discovered that removing all tests except those defined by lines 37, 39, and 44 appears to represent the minimal processing that still results in the crash. Removing any of these remaining tests does not trigger the crash. My suspicion is that this may be the result of changes to code associated with the “B” module between Perl 5.20.3 and 5.22.0, having merely inspected the contents of "Magic.xs" and observed some differences between the sources for "ext\B\B.xs" within the Perl sources and the corresponding extracts of that code contained within "Magic.xs". But I’m afraid my knowledge of any of the code involved in insufficient for me to diagnose the issue further. Would you be able to provide any thoughts on potential changes that I might experiment with in order to avoid this crash? Thanks Peter
Hello, and thank you for your very detailed report. Show quoted text
> I am experiencing an access violation crash in Perl 5.22.0 whilst > attempting > running the "t\18-opinfo.t" test during installation of Variable- > Magic-0.58 on > Windows. > > The issue that I am encountering would appear to be similar to that > reported in > http://www.cpantesters.org/cpan/report/cbda218a-6c4a-1014-b9c5- > a00a324d4f1e, > which might suggest that > http://git.profvince.com/?p=perl/modules/Variable- > Magic.git;a=commit;h=47305776af757964b20c9739d4d44ad35a3dfb90 > may not have resolved the issue? > > I’m afraid that the code contained within Magic.xs is somewhat beyond > my > current understanding. > > My testing thus far appears to indicate that the crash is 100% > reproducible > with Perl 5.22.0, yet does not occur with Perl 5.20.3. I have also > noticed that > the warning: > > 'Can't coerce GLOB to integer in transliteration (tr///) at (eval 117) > line 1. > > also only appears to have been introduced when using Perl 5.22.0.
Unfortunately, I am unable to reproduce this crash on the sole Win32 machine I have access to. Which version of Windows are you running ? What is the output of your perl -V ? Show quoted text
> > As far as I can tell the crash occurs within Perl during the shutdown > phase > performed at the end of running the "t\18-opinfo.t" script. The crash > may be > avoided by not performing the transliteration test described on line > 44 of > "t\18-opinfo.t"; more specifically the variant associated with the > ‘VMG_OP_INFO_NAME’ verification, with the ‘VMG_OP_INFO_OBJECT’ variant > being > the one that generates the 'Can't coerce GLOB to integer...' warning. > > I have discovered that removing all tests except those defined by > lines 37, 39, > and 44 appears to represent the minimal processing that still results > in the > crash. Removing any of these remaining tests does not trigger the > crash. > > My suspicion is that this may be the result of changes to code > associated with > the “B” module between Perl 5.20.3 and 5.22.0, having merely inspected > the > contents of "Magic.xs" and observed some differences between the > sources for > "ext\B\B.xs" within the Perl sources and the corresponding extracts of > that > code contained within "Magic.xs". But I’m afraid my knowledge of any > of the > code involved in insufficient for me to diagnose the issue further.
Thank you for bringing this to my attention. I have pushed an handful of changes that brought the internal copy of B.xs in line with the core version. If you are in position to try out this snapshot : http://git.profvince.com/?p=perl/modules/Variable-Magic.git;a=snapshot;h=670e590caf3db942b5e7feddc1e86669f9f46294;sf=tgz then you can check whether this was actually the cause of the issue. However, from the look of the changes, I'd be quite (happily) surprised if this were the case. Show quoted text
> > Would you be able to provide any thoughts on potential changes that I > might > experiment with in order to avoid this crash? > > Thanks > > Peter
Vincent
Subject: Re: [rt.cpan.org #107294] Crash during install of Variable-Magic-0.58 running "t\18-opinfo.t"
Date: Sun, 27 Sep 2015 17:35:53 +0100 (BST)
To: Vincent Pit via RT <bug-Variable-Magic [...] rt.cpan.org>
From: Peter Stokes <peter [...] dadeos.co.uk>
Hi Vincent, Thank you for taking the time to look into this for me; it is greatly appreciated! I’m afraid that the changes contained within Variable-Magic-670e590 do not appear to have significantly altered the results I am experiencing. I build Perl from source using the Microsoft Visual Studio 2013 toolchain, from the free community edition. I have a batch script to achieve this, a slightly modified version of which I have made available at: http://www.dadeos.co.uk/vmtest/build.bat If you place a copy of the perl-5.22.0.tar.gz source archive adjacent to the build.bat script and then invoke: build.bat "<path_to_perl_install_directory>" where "<path_to_perl_install_directory>" is replaced by the directory into which you wish to install the resultant build of perl NB: The script assumes that there is a copy of 7-zip (see: http://7-zip.org) available in the system path in order to extract the source archives. Thanks Peter
I managed to build a perl 5.22 with MSVC 10, and I could reproduce the failure. It most likely appeared with the core commit 6442877a, which turned a PUSHi(do_trans(sv)) into a mPUSHi(do_trans(sv)), and this expands to : sv_setiv(PUSHmortal, do_trans(sv)) where the magic is processed inside do_trans(). This causes an undefined behaviour because both PUSHmortal and Variable::Magic modify the argument stack. Most compilers resolve this by calling do_trans(sv) first, but cl.exe prefers to process the PUSHmortal first (probably because he defaults to use the Windows calling convention), hence the arguments passed to the magic callback linger on the stack and sv_setiv() gets confused. This should be fixed by switching the stacks for the magic calls. You can try out the fix in this snapshot : http://git.profvince.com/?p=perl/modules/Variable-Magic.git;a=snapshot;h=3dac6abb6d4dfdbfe07b780d8b856b1d74eac970;sf=tgz It's a wonder this issue has never caused any harm to anyone (or at least not enough harm to warrant writing a bug report) in eight years. Vincent
Subject: Re: [rt.cpan.org #107294] Crash during install of Variable-Magic-0.58 running "t\18-opinfo.t"
Date: Thu, 1 Oct 2015 17:27:59 +0100 (BST)
To: Vincent Pit via RT <bug-Variable-Magic [...] rt.cpan.org>
From: Peter Stokes <peter [...] dadeos.co.uk>
Hi Vincent, I can confirm that the changes contained with Variable-Magic-3dac6ab resolve both the crash and the 'Can't coerce GLOB to integer...' warning. Thank you for making the time and effort to fix this issue! Peter
Thanks. This has been fixed in version 0.59. Vincent