Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace the current XS 'bad handshake" wording with more informative text #19112

Open
nwc10 opened this issue Sep 9, 2021 · 0 comments
Open

Comments

@nwc10
Copy link
Contributor

nwc10 commented Sep 9, 2021

On Thu, Sep 09, 2021 at 03:07:46AM -0700, Nicholas Clark wrote:

xs_handshake() makes two different comparisons that on failure are reported
as "got handshake key %p, needed %p", with opaque hexadecimal values.

Personally I'd go further. This message most often appears when modules
built with one version of perl are loaded by a different perl binary. This
is a fairly common occurrence (e.g. if PERL5LIB is set), and the message
is horrible. It's going on about a 'handshake' having the wrong hex key,
and just scares the user without saying anything useful.

Personally I think the error message should:

  • remove any mention of 'handshake' (it makes it sound like some sort of
    network error);

  • should be a lot more verbose, suggesting (where relevant) that its
    likely a mismatch between perl version/build and module build, and
    displaying (where relevant) the @inc path and relevant PERL env vars.
    So, a bit like how we improved the 'module not found' error:

    Can't locate Foo/Bar.pm in @inc (you may need to install the Foo::Bar
    module) @.*** contains: ....).

  • If the hex values have any further useful info, they should be
    symbolically decoded if possible.

--
In my day, we used to edit the inodes by hand. With magnets.

Originally posted by @iabyn in #19111 (comment)

bulk88 added a commit to bulk88/perl5 that referenced this issue Nov 1, 2024
-this fatal error is much more common by general users than
 I (orig author) anticipated when I added this check in 5.21.6/2014.
 I assumed Unix land never had ABI/SEGVing or upgrade problems previous.
 I wrote the code for my dev style, and my personal setup as test cases,
 and test cases with Win32-isms.
 If other OSes get bad-ABI caught, its a plus, but I thought they wouldn't.

-the hexadecimal handshake keys were intended to be a debug tool for core
 devs hacking on something and for XS authors with very complicated
 Makefile.PL s. To catch -D CCFLAGS arg dropouts on the way to the final
 cmd line invocation of the CC.

-I say the handshake keys are a terrible UI for general "power users" and
 non-coder sys admins

-the Perl API version strings ARE available, even with mismatched
 interp struct sizes, and those are much more user friendly to print
 as a error. It should be obvious that from now on, non-power users
 can figure out on their own (no community help) that a way to "fix"
 XS boot handshake is to force "reinstall" the "left side perl"
 or "right side perl" through the OS Pkg Manager.

-after this commit, much more often! but not always, users will see a
 "Perl API 5.X.Y against 5.X+1.Y is incompatible" fatal message instead
 of the those Core-dev only undocumented hex handshake keys. Sadly the
 technical P5P debug info is now gone/lost/hidden if
 "Perl API 5.X.Y against 5.X+1.Y is incompatible" fatal message executes.

-core devs, obv will have v5.X.Y matching v5.X.Y in blead perl, so they
 will still get the handshake keys hex numbers. Since API strings are
 same.

-Package name will get downgraded to "Foo.c" if interp size is wrong, or
 2 libperls in 1 proc happens. But the major improvement is showing left
 and right side Perl API version info.

This commit was specifically written for

Perl#16654

but there are dozens or 100s of them

Perl#19112
bulk88 added a commit to bulk88/perl5 that referenced this issue Nov 1, 2024
-this fatal error is much more common by general users than
 I (orig author) anticipated when I added this check in 5.21.6/2014.
 I assumed Unix land never had ABI/SEGVing or upgrade problems previous.
 I wrote the code for my dev style, and my personal setup as test cases,
 and test cases with Win32-isms.
 If other OSes get bad-ABI caught, its a plus, but I thought they wouldn't.

-the hexadecimal handshake keys were intended to be a debug tool for core
 devs hacking on something and for XS authors with very complicated
 Makefile.PL s. To catch -D CCFLAGS arg dropouts on the way to the final
 cmd line invocation of the CC.

-I say the handshake keys are a terrible UI for general "power users" and
 non-coder sys admins

-the Perl API version strings ARE available, even with mismatched
 interp struct sizes, and those are much more user friendly to print
 as a error. It should be obvious that from now on, non-power users
 can figure out on their own (no community help) that a way to "fix"
 XS boot handshake is to force "reinstall" the "left side perl"
 or "right side perl" through the OS Pkg Manager.

-after this commit, much more often! but not always, users will see a
 "Perl API 5.X.Y against 5.X+1.Y is incompatible" fatal message instead
 of the those Core-dev only undocumented hex handshake keys. Sadly the
 technical P5P debug info is now gone/lost/hidden if
 "Perl API 5.X.Y against 5.X+1.Y is incompatible" fatal message executes.

-core devs, obv will have v5.X.Y matching v5.X.Y in blead perl, so they
 will still get the handshake keys hex numbers. Since API strings are
 same.

-Package name will get downgraded to "Foo.c" if interp size is wrong, or
 2 libperls in 1 proc happens. But the major improvement is showing left
 and right side Perl API version info.

This commit was specifically written for

Perl#16654

but there are dozens or 100s of them

Perl#19112
bulk88 added a commit to bulk88/perl5 that referenced this issue Nov 6, 2024
-this fatal error is much more common by general users than
 I (orig author) anticipated when I added this check in 5.21.6/2014.
 I assumed Unix land never had ABI/SEGVing or upgrade problems previous.
 I wrote the code for my dev style, and my personal setup as test cases,
 and test cases with Win32-isms.
 If other OSes get bad-ABI caught, its a plus, but I thought they wouldn't.

-the hexadecimal handshake keys were intended to be a debug tool for core
 devs hacking on something and for XS authors with very complicated
 Makefile.PL s. To catch -D CCFLAGS arg dropouts on the way to the final
 cmd line invocation of the CC.

-I say the handshake keys are a terrible UI for general "power users" and
 non-coder sys admins

-the Perl API version strings ARE available, even with mismatched
 interp struct sizes, and those are much more user friendly to print
 as a error. It should be obvious that from now on, non-power users
 can figure out on their own (no community help) that a way to "fix"
 XS boot handshake is to force "reinstall" the "left side perl"
 or "right side perl" through the OS Pkg Manager.

-after this commit, much more often! but not always, users will see a
 "Perl API 5.X.Y against 5.X+1.Y is incompatible" fatal message instead
 of the those Core-dev only undocumented hex handshake keys. Sadly the
 technical P5P debug info is now gone/lost/hidden if
 "Perl API 5.X.Y against 5.X+1.Y is incompatible" fatal message executes.

-core devs, obv will have v5.X.Y matching v5.X.Y in blead perl, so they
 will still get the handshake keys hex numbers. Since API strings are
 same.

-Package name will get downgraded to "Foo.c" if interp size is wrong, or
 2 libperls in 1 proc happens. But the major improvement is showing left
 and right side Perl API version info.

-The POD text is very wordy and detailed, since it has been observed over
 time, some Perl users, do not know Perl's backend implementation is
 written in the ISO C language. Or other Perl users on various internet
 forums or social media, do not know what the term XS code is.

 While they can sucessful write and debug private personal Perl 5 code,
 they only read the POD of CPAN modules and only use public documented
 APIs of CPAN modules, and rarely or never look at
 "private source" of CPAN modules. Therefore this group of users truly
 do not know MANY MANY p5p core modules and CPAN modules, make call outs
 to another language (C), and are unable to troubleshoot a .so file on
 their filing system is responsible for the error. Since they do not know
 about XS code concept, their troubleshooting goes very wrong as they
 keeping looking and keep incorrect diagnosing the problem to ASCII text
 somewhere in the Perl ecosystem. Either Perl source code, they wrote, or
 CPAN Perl source code, or a CSV, YAML or JSON file related to Perl.

 Make it clear, that some "Perl 5 modules" written in ASCII text in Perl 5
 lang, depend on "foreign" C code and "foreign" .so/.dll files at runtime.
 First time Perl coders, can mistakenly assume the Perl 5 interpreter
 has JIT and self bootstraps to OS binaries from only Perl 5 source like
 Google Chrome V8 and Raku. So they guess, as first time users,
 Perl 5 also does it and has no dependency on legacy technologies like
 C or C++.

This commit was specifically written for

Perl#16654

but there are dozens or 100s of them

Perl#19112
bulk88 added a commit to bulk88/perl5 that referenced this issue Dec 19, 2024
-this fatal error is much more common by general users than
 I (orig author) anticipated when I added this check in 5.21.6/2014.
 I assumed Unix land never had ABI/SEGVing or upgrade problems previous.
 I wrote the code for my dev style, and my personal setup as test cases,
 and test cases with Win32-isms.
 If other OSes get bad-ABI caught, its a plus, but I thought they wouldn't.

-the hexadecimal handshake keys were intended to be a debug tool for core
 devs hacking on something and for XS authors with very complicated
 Makefile.PL s. To catch -D CCFLAGS arg dropouts on the way to the final
 cmd line invocation of the CC.

-I say the handshake keys are a terrible UI for general "power users" and
 non-coder sys admins

-the Perl API version strings ARE available, even with mismatched
 interp struct sizes, and those are much more user friendly to print
 as a error. It should be obvious that from now on, non-power users
 can figure out on their own (no community help) that a way to "fix"
 XS boot handshake is to force "reinstall" the "left side perl"
 or "right side perl" through the OS Pkg Manager.

-after this commit, much more often! but not always, users will see a
 "Perl API 5.X.Y against 5.X+1.Y is incompatible" fatal message instead
 of the those Core-dev only undocumented hex handshake keys. Sadly the
 technical P5P debug info is now gone/lost/hidden if
 "Perl API 5.X.Y against 5.X+1.Y is incompatible" fatal message executes.

-core devs, obv will have v5.X.Y matching v5.X.Y in blead perl, so they
 will still get the handshake keys hex numbers. Since API strings are
 same.

-Package name will get downgraded to "Foo.c" if interp size is wrong, or
 2 libperls in 1 proc happens. But the major improvement is showing left
 and right side Perl API version info.

-The POD text is very wordy and detailed, since it has been observed over
 time, some Perl users, do not know Perl's backend implementation is
 written in the ISO C language. Or other Perl users on various internet
 forums or social media, do not know what the term XS code is.

 While they can sucessful write and debug private personal Perl 5 code,
 they only read the POD of CPAN modules and only use public documented
 APIs of CPAN modules, and rarely or never look at
 "private source" of CPAN modules. Therefore this group of users truly
 do not know MANY MANY p5p core modules and CPAN modules, make call outs
 to another language (C), and are unable to troubleshoot a .so file on
 their filing system is responsible for the error. Since they do not know
 about XS code concept, their troubleshooting goes very wrong as they
 keeping looking and keep incorrect diagnosing the problem to ASCII text
 somewhere in the Perl ecosystem. Either Perl source code, they wrote, or
 CPAN Perl source code, or a CSV, YAML or JSON file related to Perl.

 Make it clear, that some "Perl 5 modules" written in ASCII text in Perl 5
 lang, depend on "foreign" C code and "foreign" .so/.dll files at runtime.
 First time Perl coders, can mistakenly assume the Perl 5 interpreter
 has JIT and self bootstraps to OS binaries from only Perl 5 source like
 Google Chrome V8 and Raku. So they guess, as first time users,
 Perl 5 also does it and has no dependency on legacy technologies like
 C or C++.

This commit was specifically written for

Perl#16654

but there are dozens or 100s of them

Perl#19112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant