In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/fe60b4f6e4367b11d22c0327627cc6955086aee0?hp=79cb50bfab82345a6fa2dd3199418fdd62b4fec2>

- Log -----------------------------------------------------------------
commit fe60b4f6e4367b11d22c0327627cc6955086aee0
Author: David Mitchell <[email protected]>
Date:   Wed Dec 17 17:29:42 2014 +0000

    improve xs_handshake() diag message
    
    The important part of the error message is that the binaries are
    mismatched; the details of the handshake keys are an implementation
    detail.
    
    Or to put it another way, when someone mixes up their paths, getting
    something like
    
        Fcntl.c: Invalid handshake key got 0xcf80000 needed 0xd700000, binaries 
are mismatched
    
    Is a bit scary and confusing. This is hopefully (slightly) less scary:
    
        Fcntl.c: loadable library and perl binaries are mismatched (got 
handshake key 0xcf80000, needed 0xd700000)

M       pod/perldiag.pod
M       util.c

commit 5ec05c961abef5db9f7c75a1593247c0737c8fcb
Author: David Mitchell <[email protected]>
Date:   Wed Dec 17 17:13:26 2014 +0000

    xs_handshake(() clean up desciption
    
    Clean up the description of this function; in particular, say at the top
    what the function is for; fix typos; and generally improve the readability
    of the text.

M       util.c
-----------------------------------------------------------------------

Summary of changes:
 pod/perldiag.pod |  2 +-
 util.c           | 63 +++++++++++++++++++++++++++++++++++---------------------
 2 files changed, 40 insertions(+), 25 deletions(-)

diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index d0da57d..4efc7d3 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -2728,7 +2728,7 @@ instead, except within S<C<(?[   ])>>, where it is a 
fatal error.
 The S<<-- HERE> shows whereabouts in the regular expression the
 escape was discovered.
 
-=item %s: Invalid handshake key got %p needed %p, binaries are mismatched
+=item %s: loadable library and perl binaries are mismatched (got handshake key 
%p, needed %p)
 
 (P) A dynamic loading library C<.so> or C<.dll> was being loaded into the
 process that was built against a different build of perl than the
diff --git a/util.c b/util.c
index 6012c0c..3737a01 100644
--- a/util.c
+++ b/util.c
@@ -5343,28 +5343,42 @@ Perl_my_cxt_init(pTHX_ const char *my_cxt_key, size_t 
size)
 #endif /* PERL_IMPLICIT_CONTEXT */
 
 
-/* The meaning of the varargs is determined U32 key arg. This is not a format
-   string. The U32 key is assembled with HS_KEY.
-
-   v_my_perl arg is "PerlInterpreter * my_perl" if PERL_IMPLICIT_CONTEXT and
-   otherwise "CV * cv" (boot xsub's CV *). v_my_perl will catch where a 
threaded
-   future perl526.dll calling IO.dll for example, and IO.dll was linked with
-   threaded perl524.dll, and both perl526.dll and perl524.dll are in %PATH and
-   the Win32 DLL loader sucessfully can load IO.dll into the process but
-   simultaniously it loaded a interp of a different version into the process,
-   and XS code will naturally pass SV*s created by perl524.dll for perl526.dll
-   to use through perl526.dll's my_perl->Istack_base.
-
-   v_my_perl (v=void) can not be the first arg since then key will be out of
-   place in a threaded vs non-threaded mixup and analyzing the key number's
-   bitfields won't reveal the problem since it will be a valid key
-   (unthreaded perl) on interp side, but croak reports the XS mod's key as
-   gibberish (it is really my_perl ptr) (threaded XS mod), or if threaded perl
-   and unthreaded XS module, threaded perl will look at uninit C stack or 
uninit
-   register to get var key (remember it assumes 1st arg is interp cxt).
-
-Perl_xs_handshake(U32 key, void * v_my_perl, const char * file,
-[U32 items, U32 ax], [char * api_version], [char * xs_version]) */
+/* Perl_xs_handshake():
+   implement the various XS_*_BOOTCHECK macros, which are added to .c
+   files by ExtUtils::ParseXS, to check that the perl the module was built
+   with is binary compatible with the running perl.
+
+   usage:
+       Perl_xs_handshake(U32 key, void * v_my_perl, const char * file,
+            [U32 items, U32 ax], [char * api_version], [char * xs_version])
+
+   The meaning of the varargs is determined the U32 key arg (which is not
+   a format string). The fields of key are assembled by using HS_KEY().
+
+   Under PERL_IMPLICIT_CONTEX, the v_my_perl arg is of type
+   "PerlInterpreter *" and represents the callers context; otherwise it is
+   of type "CV *", and is the boot xsub's CV.
+
+   v_my_perl will catch where a threaded future perl526.dll calling IO.dll
+   for example, and IO.dll was linked with threaded perl524.dll, and both
+   perl526.dll and perl524.dll are in %PATH and the Win32 DLL loader
+   successfully can load IO.dll into the process but simultaneously it
+   loaded an interpreter of a different version into the process, and XS
+   code will naturally pass SV*s created by perl524.dll for perl526.dll to
+   use through perl526.dll's my_perl->Istack_base.
+
+   v_my_perl cannot be the first arg, since then 'key' will be out of
+   place in a threaded vs non-threaded mixup; and analyzing the key
+   number's bitfields won't reveal the problem, since it will be a valid
+   key (unthreaded perl) on interp side, but croak will report the XS mod's
+   key as gibberish (it is really a my_perl ptr) (threaded XS mod); or if
+   it's a threaded perl and an unthreaded XS module, threaded perl will
+   look at an uninit C stack or an uninit register to get 'key'
+   (remember that it assumes that the 1st arg is the interp cxt).
+
+   'file' is the source filename of the caller.
+*/
+
 I32
 Perl_xs_handshake(const U32 key, void * v_my_perl, const char * file, ...)
 {
@@ -5411,8 +5425,8 @@ Perl_xs_handshake(const U32 key, void * v_my_perl, const 
char * file, ...)
     if(UNLIKELY(got != need)) {
        bad_handshake:/* recycle branch and string from above */
        if(got != (void *)HSf_NOCHK)
-           noperl_die("%s: Invalid handshake key got %p"
-               " needed %p, binaries are mismatched",
+           noperl_die("%s: loadable library and perl binaries are mismatched"
+                       " (got handshake key %p, needed %p)\n",
                file, got, need);
     }
 
@@ -5458,6 +5472,7 @@ Perl_xs_handshake(const U32 key, void * v_my_perl, const 
char * file, ...)
     return ax;
 }
 
+
 STATIC void
 S_xs_version_bootcheck(pTHX_ U32 items, U32 ax, const char *xs_p,
                          STRLEN xs_len)

--
Perl5 Master Repository

Reply via email to