develooper Front page | perl.perl5.porters | Postings from July 2019

[perl #133981] ext/XS-APItest/t/locale.t crashes on Windows afterpassing a couple tests

From:
Steve Hay via RT
Date:
July 4, 2019 13:13
Subject:
[perl #133981] ext/XS-APItest/t/locale.t crashes on Windows afterpassing a couple tests
Message ID:
rt-4.0.24-26477-1562246034-597.133981-15-0@perl.org
On Thu, 27 Jun 2019 09:25:27 -0700, khw wrote:
> On Tue, 30 Apr 2019 09:44:23 -0700, shay wrote:
> > On Mon, 29 Apr 2019 17:06:17 -0700, khw wrote:
> > > On Fri, 26 Apr 2019 00:09:18 -0700, shay wrote:
> > > > On Fri, 05 Apr 2019 01:06:09 -0700, shay wrote:
> > > > > On Fri, 5 Apr 2019 at 08:25, Steve Hay
> > > > > <steve.m.hay@googlemail.com>
> > > > > wrote:
> > > > > >
> > > > > > On Thu, 4 Apr 2019 at 23:31, Karl Williamson
> > > > > > <public@khwilliamson.com> wrote:
> > > > > > >
> > > > > > > On 4/4/19 3:40 PM, Karl Williamson wrote:
> > > > > > > > On 4/4/19 3:09 PM, Steve Hay wrote:
> > > > > > > >> On Thu, 4 Apr 2019 at 21:23, Karl Williamson
> > > > > > > >> <public@khwilliamson.com>
> > > > > > > >> wrote:
> > > > > > > >>>
> > > > > > > >>> On 4/3/19 11:00 AM, Steve Hay (via RT) wrote:
> > > > > > > >>>> # New Ticket Created by  Steve Hay
> > > > > > > >>>> # Please include the string:  [perl #133981]
> > > > > > > >>>> # in the subject line of all future correspondence
> > > > > > > >>>> about
> > > > > > > >>>> this
> > > > > > > >>>> issue.
> > > > > > > >>>> # <URL:
> > > > > > > >>>> https://rt.perl.org/Ticket/Display.html?id=133981
> > > > > > > >>>> >
> > > > > > > >>>>
> > > > > > > >>>>
> > > > > > > >>>> This is a bug report for perl from
> > > > > > > >>>> steve.m.hay@googlemail.com,
> > > > > > > >>>> generated with the help of perlbug 1.41 running under
> > > > > > > >>>> perl
> > > > > > > >>>> 5.29.10.
> > > > > > > >>>>
> > > > > > > >>>>
> > > > > > > >>>> -----------------------------------------------------------------
> > > > > > > >>>> [Please describe your issue here]
> > > > > > > >>>>
> > > > > > > >>>> Blead is currently crashing at the end of ext/XS-
> > > > > > > >>>> APItest/t/locale.t on
> > > > > > > >>>> Windows (this is Windows 10).
> > > > > > > >>>>
> > > > > > > >>>> I get the same result using VC14 and VC14.1, but VC12
> > > > > > > >>>> and
> > > > > > > >>>> MinGW-w64
> > > > > > > >>>> GCC 7.1.0 work fine, all x64.
> > > > > > > >>>>
> > > > > > > >>>> Verbose output:
> > > > > > > >>>>
> > > > > > > >>>> ../ext/XS-APItest/t/locale.t ..
> > > > > > > >>>> ok 1 - Gconvert doesn't recognize underlying locale
> > > > > > > >>>> outside
> > > > > > > >>>> 'use
> > > > > > > >>>> locale'
> > > > > > > >>>> ok 2 - Gconvert doesn't recognize underlying locale
> > > > > > > >>>> inside
> > > > > > > >>>> 'use locale'
> > > > > > > >>>> Dubious, test returned 9 (wstat 2304, 0x900)
> > > > > > > >>>> All 2 subtests passed
> > > > > > > >>>>
> > > > > > > >>>> Test Summary Report
> > > > > > > >>>> -------------------
> > > > > > > >>>> ../ext/XS-APItest/t/locale.t (Wstat: 2304 Tests: 2
> > > > > > > >>>> Failed:
> > > > > > > >>>> 0)
> > > > > > > >>>>     Non-zero exit status: 9
> > > > > > > >>>>     Parse errors: No plan found in TAP output
> > > > > > > >>>> Files=1, Tests=2,  3 wallclock secs ( 0.00 usr +  0.00
> > > > > > > >>>> sys
> > > > > > > >>>> =
> > > > > > > >>>> 0.00 CPU)
> > > > > > > >>>> Result: FAIL
> > > > > > > >>>
> > > > > > > >>>
> > > > > > > >>> Since I don't have access to a box where this is
> > > > > > > >>> failing,
> > > > > > > >>> this
> > > > > > > >>> will take
> > > > > > > >>> some back and forth effort.
> > > > > > > >>>
> > > > > > > >>> Let's start by running this single test manually on a
> > > > > > > >>> DEBUGGING
> > > > > > > >>> build
> > > > > > > >>> with -DL and sending me the output.
> > > > > > > >>
> > > > > > > >> STDERR output from the following is attached, along with
> > > > > > > >> the
> > > > > > > >> corresponding perl -V:
> > > > > > > >>
> > > > > > > >> D:\Dev\Git\perl\ext\XS-APItest>..\..\perl -DL t\locale.t
> > > > > > > >> 2> out.txt
> > > > > > > >> ok 1 - Gconvert doesn't recognize underlying locale
> > > > > > > >> outside
> > > > > > > >> 'use
> > > > > > > >> locale'
> > > > > > > >> ok 2 - Gconvert doesn't recognize underlying locale
> > > > > > > >> inside
> > > > > > > >> 'use
> > > > > > > >> locale'
> > > > > > > >>
> > > > > > > >
> > > > > > > > Thanks for that.  I think I now know what the problem is.
> > > > > > > > To
> > > > > > > > confirm,
> > > > > > > > run the same test but use this branch
> > > > > > > >
> > > > > > > > https://perl5.git.perl.org/perl.git/shortlog/refs/heads/smoke-
> > > > > > > > me/khw-133981
> > > > > > > >
> > > > > > >
> > > > > > > In looking further, I'm not confident that will help.  It
> > > > > > > looks
> > > > > > > now
> > > > > > > like
> > > > > > > a Windows bug.  Try compiling and running the attached C
> > > > > > > program.
> > > > > > >
> > > > > > > From the trace you gave, that looks like it will print 3
> > > > > > > lines,
> > > > > > > the
> > > > > > > first NULL, and the 2nd and 3rd "iso_latin_16".  But all
> > > > > > > three
> > > > > > > lines
> > > > > > > should be the same.  If not, its a windows bug.  If they
> > > > > > > are
> > > > > > > the
> > > > > > > same,
> > > > > > > its back to the drawing board for me.
> > > > > > >
> > > > > >
> > > > > > You are correct: With VC14, VC14.1 and VC14.2 (VS2015, VS2017
> > > > > > and
> > > > > > VS2019):
> > > > > >
> > > > > > 9: NULL
> > > > > > 13: iso_latin_16
> > > > > > 17: iso_latin_16
> > > > > >
> > > > > > With VC6 thru VC12 (VC++ 6.0 thru VS2013):
> > > > > >
> > > > > > 9: NULL
> > > > > > 13: NULL
> > > > > > 17: NULL
> > > > > >
> > > > > > So, being a Windows (actually, recent VC++?) problem, I'll
> > > > > > report
> > > > > > it
> > > > > > to Microsoft :-)
> > > > > >
> > > > >
> > > > > Now reported here:
> > > > >
> > > > > https://developercommunity.visualstudio.com/content/problem/519486/setlocalelc-
> > > > > numeric-iso-latin-16-fails-then-succee.html
> > > >
> > > > An update on that page acknowledges this as a regression in the
> > > > Universal CRT introduced in the Windows 10 April 2018 Update. It
> > > > will
> > > > be fixed in the May 2019 update.
> > >
> > > So what do we do about this ticket?  Its out of our hands.  I don't
> > > see a work around possible.  I'm guessing everybody gets this fix
> > > as
> > > part of Windows Update.
> >
> > I think so. I've updated README.win32 in commit
> > 71153651052686ec603bfb6618118391b0b3f03e to note the impending fix. I
> > will leave the ticket open for now. Hopefully I'll get the update the
> > next month or so and if it works then I'll close the ticket then.
> >
> > (I don't think a suggestion I made earlier in this ticket to skip the
> > tests for VC++ 14 and above is a good idea since it would now require
> > testing for the Windows 10 Update version in the skip logic, which
> > isn't worth the hassle with a fix on the way soon anyway.)
> 
> I believe the fix is out.  Can someone verify if this is still an
> issue?


I've updated to Windows 10 May 2019 (Version 1903) and now the shay.c program that you sent previously produces the same output with VC14.2 as it does with VC6-VC12, namely:

9: NULL
13: NULL
17: NULL

However, our test script still crashes as before!:

D:\Dev\Git\perl\t>.\perl harness ..\ext\XS-APItest\t\locale.t
../ext/XS-APItest/t/locale.t .. Dubious, test returned 9 (wstat 2304, 0x900)
All 2 subtests passed

Test Summary Report
-------------------
../ext/XS-APItest/t/locale.t (Wstat: 2304 Tests: 2 Failed: 0)
  Non-zero exit status: 9
  Parse errors: No plan found in TAP output
Files=1, Tests=2,  3 wallclock secs ( 0.00 usr +  0.01 sys =  0.01 CPU)
Result: FAIL

New -DL output attached.

The crash is here:

 	ucrtbase.dll!00007ff88794bcf8()	Unknown
 	ucrtbase.dll!00007ff88792b84a()	Unknown
 	ucrtbase.dll!00007ff8878ec165()	Unknown
 	ucrtbase.dll!00007ff8878ec10f()	Unknown
 	ucrtbase.dll!00007ff8878ec0c7()	Unknown
>	perl531.dll!S_win32_setlocale(interpreter * my_perl, int category, const char * locale) Line 2144	C
 	perl531.dll!Perl_setlocale(const int category, const char * locale) Line 2272	C
 	POSIX.dll!XS_POSIX_setlocale(interpreter * my_perl, cv * cv) Line 2277	C
 	perl531.dll!Perl_pp_entersub(interpreter * my_perl) Line 5240	C
 	perl531.dll!Perl_runops_debug(interpreter * my_perl) Line 2537	C
 	perl531.dll!S_run_body(interpreter * my_perl, long oldscope) Line 2714	C
 	perl531.dll!perl_run(interpreter * my_perl) Line 2638	C
 	perl531.dll!RunPerl(int argc, char * * argv, char * * env) Line 217	C++
 	perl.exe!main(int argc, char * * argv, char * * env) Line 40	C
 	[External Code]	

The code is:
result = setlocale(category, locale);
where category is 0 and locale is "Français".

The exception text is:
Unhandled exception at 0x00007FF88794BCF8 (ucrtbase.dll) in perl.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.

I'm not sure what the problem is here now. If I build and run this:

#include <stdio.h>
#include <locale.h>

int
main()
{
    const char * result = setlocale(0, "Français");
    if (result == NULL) result = "NULL";
    fprintf(stderr, "%d: %s\n", __LINE__, result);
}

then there is no crash. The output is simply:

9: NULL


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=133981



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About