DX Unified Infrastructure Management

  • 1.  Perl SDK on Windows 32-bit Fails

    Posted Jan 23, 2018 11:31 PM

    Hello.

     

    I have a custom probe that runs across multiple OS's and variants, but Windows 32-bit is giving trouble.

    I am using Strawberryperl Portable for maximum not-breaking-other-things.

     

    However, whenever the script tries to use one of the SDK modules, Perl dies. (silently).

    Trying to run in debug shows a SEGV (see below for the exact message)

     

    I only see this fault on Windows 32 bit, not x64.

    I have tried Perl 5.14.2, 5.14.3 and 5.14.4

    Each with SDK_Perl 5.06 and 5.10, and always with the same failure.

     

    I can't use a non-portable, so ActivePerl is out.

     

    Any help?

     

    Details of fault:

    E:\>ver 

    Microsoft Windows [Version 5.2.3790] 

    E:\>perl -e"print $^V"
    v5.14.4
    E:\>perl -MNimbus::API -e "print $^V" 


    E:\>perl -MNimbus::API -de "print $^V" 

    Loading DB routines from perl5db.pl version 1.33
    Editor support available. 

    Enter h or `h h' for help, or `perldoc perldebug' for more help. 

    Signal SEGV at E:\Nimsoft\perllib/Nimbus/API.pm line 247. 
            require Nimbus/API.pm called at -e line 0 
            main::BEGIN() called at E:\Nimsoft\perllib/Nimbus/API.pm line 0 
            eval {...} called at E:\Nimsoft\perllib/Nimbus/API.pm line 0 
    E:\>


  • 2.  Re: Perl SDK on Windows 32-bit Fails

    Posted Feb 14, 2018 01:41 AM

    I have isolated the fault, so in case someone else is searching for it, here is my findings:

    There is no fault using ActiveState Perl or StrawberryPerl (msi version) if you don't use debug.

     

    The root cause is that when using Portable Perl there is an 'open' command in a module that is loaded automatically before Nimbus::API

    (Specifically, the Portable.pm module uses Parse::CPAN:YAML::Meta to read the portable.perl file in the root of the portable installation.)

    It is this opening a file that somehow causes Nimbus::API to Segfault when it calls the bootstrap XS function in API.dll

    My tests show that any call to 'open' in any module loaded before Nimbus::API will cause a segfault. This includes the debugger (which indirectly calls Portable.pm). It is not specific to the module, file or anything else. I expect this means that you may find this fault on an installed version of Perl if you have some includes that open files.

     

    Solution:

    I moved the content of portable.perl into a __DATA__ section of Portable.pm (which lives in vendor/lib) and replace the call to

    Parse:CPAN::YAML::Meta::LoadFile ( $config )

    on line 207 of Portable.pm with

    Parse:CPAN::YAML::Meta::Load (join('',<DATA>))

    This seems to be a CPAN requirement, so in my use case it's not even needed.

     

    My Perl code is now running unmodified on many variants of Windows in both 32 and 64 bit environments .