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

Strict xsloader #1

Open
wants to merge 513 commits into
base: blead
Choose a base branch
from
Open

Strict xsloader #1

wants to merge 513 commits into from

Conversation

toddr
Copy link
Owner

@toddr toddr commented Oct 7, 2020

This is just an idea. Currently these tests fail:

Test Summary Report
-------------------
../ext/XS-APItest/t/check_warnings.t                               (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
../ext/XS-APItest/t/keyword_plugin_threads.t                       (Wstat: 0 Tests: 1 Failed: 1)
  Failed test:  1
Files=2651, Tests=1196396, 225 wallclock secs (184.30 usr 21.08 sys + 1013.18 cusr 138.78 csys = 1357.34 CPU)
Result: FAIL
make: *** [test_harness_notty] Error 2

Further, you can see this error which is disturbing:

$>./perl -Ilib -e 'require XS::APItest'
Too late to run CHECK block at lib/DynaLoader.pm line 218.
Too late to run INIT block at lib/DynaLoader.pm line 218.

@toddr toddr force-pushed the xs_dynaloader branch 12 times, most recently from 7812c11 to 59724ad Compare October 13, 2020 17:11
khwilliamson and others added 17 commits December 19, 2020 22:00
Most implementations do not have a problem with two getenv()'s running
simultaneously in different threads.  But Posix doesn't require such
good behavior.  This adds a simple probe to test the current system.
get_env() needs to lock other threads from writing to the environment
while it is executing.  It may need to have an exclusive lock if those
threads can clobber its buffer before it gets a chance to save them.
The previous commit has added a Configure probe which tells us if that
is the case.  This commit uses it to select which type of mutex to use.
This fixes GH Perl#18341

There are problems with getenv() on threaded perls wchich can lead to
incorrect results when compiled with PERL_MEM_LOG.

Commit 0b83dfe fixed this for some
platforms, but as Tony Cook, pointed out there may be
standards-compliant platforms that that didn't fix.

The detailed comments outline the issues and (complicated) full solution.
# Conflicts:
#	pod/perldelta.pod
This rearranges some paragraphs that really belong together, and
clarifies the result is always in English
steve-m-hay and others added 23 commits January 23, 2021 13:12
In 83141f1, the maximum line length of all lines added was 77, which
should have passed the 78 maximum used in t/porting/podcheck.t.  There
were no tabs in the allegedly offending lines and no '=over' directives
in operation.  So it's unclear why this failed.

Nonetheless, as additional commits are pending, it's expedienct for us
to rebreak the lines manually to get the test program to pass and figure
out the problem another day.
Changes in inline comments only; responds to concern raised in commit
message for 363d555.
The Time::HiRes build was broken by 1d96b9c and requires a fix similar
to daacfc6 for mingw runtimes < 5.0. A definition of timespec was added
in mingwrt-5.0.

The compilers from mingw-w64 (which can be singled out by their definition
of __MINGW64_VERSION_MAJOR) were not affected since they all have timespec
defined anyway.

For me, this fixes the build with my mingw.org compilers from 3.4.5 to
4.8.1 inclusive. These are using runtimes 3.15.2 to 4.0.3 (which actually
reports itself as 3.20.0!) inclusive.

Note that builds with mingw.org compilers using mingwrt >= 5.0 are still
broken due to a different problem involving mkstemp(), as documented in
8a217c9. See GH#15446 for more details.
MinGW runtime version 3.21 added a definition of mkstemp(), so requires a
fix similar to f33b2f5 for MinGW-w64's runtime 4.0 onwards.

Based on a patch by Dan Collins on GH#15446.

This commit also tweaks 43b3b04, having discovered that mingw runtime
3.22 also contains a definition of timespec.

For me, this fixes the build with my mingw.org 5.3.0 compiler using any of
the mingw runtimes 3.21, 3.22.4 or 5.0 without breaking older versions such
as 4.9.3 with the 3.20 runtime (or even with the withdrawn 4.0.3 runtime,
which had __MINGW32_MAJOR/MINOR_VERSION set to 3.20 whilst adding new a
__MINGW_MAJOR/MINOR_VERSION set to 4.0).

However, 6.3.0 and 7.3.0 have other issues when compiling win32sck.c, while
8.2.0 and 9.2.0 have other issues again when compiling win32.c. See
GH#18510 for more details.

Also, C++ mode builds with some MinGW/MinGW-w64 compilers are still broken,
as documented in 8a217c9. See GH#16459 for more details.
Makefile.mk is redundant with GNUmakefile. See
https://www.nntp.perl.org/group/perl.perl5.porters/2021/01/msg258848.html
for more details.

We planned to remove it shortly after the introduction of GNUmakefile
but that slipped through the cracks for some reason:
Perl#14341
Previously the default libpth consisted of just a single folder and
failed to include the directory that contains the majority of the
libraries.

This is a fairly important issue but no one noticed it for two reasons:

1. EU::MM on Windows *always* links XS modules with the libraries from
   $Config{libs}, so you'd notice that linking doesn't work only if you
   needed a library that isn't listed there.

2. Strawberry Perl has a workaround for this issue[1].

I'm only using MinGW-w64 compilers, so I have no idea how library paths
work on MinGW.org builds. It's possible that the previous libpth worked
fine with them. Either way, this commit only adds new paths to libpth, it
doesn't modify the one that was already there, so it's unlikely it will
break anything.

[1] - https://github.com/StrawberryPerl/Perl-Dist-Strawberry/blob/2112b8a590882e913e98e4aa2dced4f34c4fea79/lib/Perl/Dist/Strawberry/Step/InstallPerlCore.pm#L136
PerlIO::encoding has a $fallback variable that allows one to set the
behavior on a encoding/decoding error, for example to make it throw an
exception on error. What is not documented (actually the example in the
documentation is even missing this) is that PerlIO::encoding needs the
(equally undocumented) Encode::STOP_AT_PARTIAL flag to be set, otherwise
a multi-byte character spanning buffer boundaries will be interpreted as
two invalid byte sequences. I could have fixed the documentation, but
instead I fixed the code to always pass this flag to Encode, simplifying
the use and making the current documentation correct again.
Encode allows one to pass a coderef instead of a set of flags to handle.
This however doesn't allow one to pass STOP_AT_PARTIAL, which means it
has always been buggy on buffer boundaries. With my new automatic
STOP_AT_PARTIAL passing this would result in an unpredictable value.
Instead we now disallow it in PerlIO::encoding.
It's also set from encoding.pm, doing it double serves no purpose
Setting $PerlIO::encoding::fallback to any value containing LEAVE_SRC
will result in an infinite loop of the first buffer of input. This is
never desirable.
The ticket mentions yet another message, not addressed in this
commit, "Insecure private-use override".  That message is part of a
hook for a so-far unimplemented module, so it actually doesn't ever get
raised.

Committer: One correction per Grinnz comment in
Perl#18491
Originally missing the word "at", but rather than just adding it, this wording seemed nicer.
khwilliamson and others added 5 commits February 2, 2021 19:15
CxTRYBLOCK would be confusing when we add a real CxTRY for try/catch

Also renames the associated CXp_TRYBLOCK flag to CXp_EVALBLOCK
 * Add feature, experimental warning, keyword
 * Basic parsing
 * Basic implementation as optree fragment

See also
  Perl#18504
Now we're using our, there's no value to attempting to support
versions below 5.6.
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

Successfully merging this pull request may close these issues.