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

[Win32] op/pack.t test failures on extended precision long double builds of 32-bit perl-5.27.5 #16205

Closed
p5pRT opened this issue Oct 21, 2017 · 11 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 21, 2017

Migrated from rt.perl.org#132338 (status was 'resolved')

Searchable as RT132338$

@p5pRT
Copy link
Author

p5pRT commented Oct 21, 2017

From @sisyphus

Ever since it has been possible to build 32-bit perl on Windows with an
nvtype of (extended precision) long double, 2 of the op/pack.t tests (tests
13177 and 13180) have been failing on those builds.

Patch to t/op/pack.t is attached.

Note​: This patch fixes t/op/pack.t for 32-bit builds only. With 64-bit
builds the script still crashes after the successful completion of test 518.
(Something to work on.)

Cheers,
Rob

@p5pRT
Copy link
Author

p5pRT commented Oct 21, 2017

From @sisyphus

pack.t.patch
--- pack.t_orig	2017-10-21 23:32:24 +1100
+++ pack.t	2017-10-21 23:34:37 +1100
@@ -1414,7 +1414,7 @@
   my @b = unpack "$t X[$t] $t", $p;	# Extract, step back, extract again
   is(scalar @b, 2 * scalar @a);
   $b = "@b";
-  $b =~ s/(?:17000+|16999+)\d+(e-45) /17$1 /gi; # stringification is gamble
+  $b =~ s/(?:17000+|16999+)\d+(e-0?45) /17$1 /gi; # stringification is gamble
   is($b, "@a @a");
 
   use warnings qw(NONFATAL all);;
@@ -1427,7 +1427,7 @@
   is($warning, undef);
   is(scalar @b, scalar @a);
   $b = "@b";
-  $b =~ s/(?:17000+|16999+)\d+(e-45) /17$1 /gi; # stringification is gamble
+  $b =~ s/(?:17000+|16999+)\d+(e-0?45) /17$1 /gi; # stringification is gamble
   is($b, "@a");
 }
 

@p5pRT
Copy link
Author

p5pRT commented Oct 23, 2017

From @jkeenan

On Sat, 21 Oct 2017 13​:36​:12 GMT, sisyphus wrote​:

Ever since it has been possible to build 32-bit perl on Windows with
an
nvtype of (extended precision) long double, 2 of the op/pack.t tests
(tests
13177 and 13180) have been failing on those builds.

Patch to t/op/pack.t is attached.

Note​: This patch fixes t/op/pack.t for 32-bit builds only. With 64-bit
builds the script still crashes after the successful completion of
test 518.
(Something to work on.)

Cheers,
Rob

There are nearly 15,000 unit tests in t/op/pack.t, most of them lacking descriptions. I took the liberty of adding descriptions to the tests in the relevant block simply so I and other readers would not get lost in the output.

However, before I apply it, I want to ask the list​: Is there any reason to believe that applying this patch would have a negative impact on tests on any other platform (including other configurations of Windows)?

Thank you very much.
Jim Keenan

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Oct 23, 2017

From @jkeenan

132338-0001-32-bit-perl-on-Windows-with-nytype-of-extended-preci.patch
From a970be27cf6308e63f2821f5339317feaeec9615 Mon Sep 17 00:00:00 2001
From: Sisyphus <sisyphus1@optusnet.com.au>
Date: Mon, 23 Oct 2017 16:55:27 -0400
Subject: [PATCH] 32-bit perl on Windows with nytype of (extended precision)
 long double.

Enable tests to pass on that platform for:

    struct {char c1; double d; char cc[2];}

Committer: add descriptions to tests in relevant block.

For: RT #132338
---
 t/op/pack.t | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/t/op/pack.t b/t/op/pack.t
index 919e4c5..5dde642 100644
--- a/t/op/pack.t
+++ b/t/op/pack.t
@@ -1410,12 +1410,13 @@ is(scalar unpack('A /A /A Z20', '3004bcde'), 'bcde');
   my $t = 'C x![d] d C[2]';
   my @a = (173, 1.283476517e-45, 42, 215);
   my $p = pack $t, @a;
-  ok( length $p);
+  ok( length $p, "Packed string has nonzero length");
   my @b = unpack "$t X[$t] $t", $p;	# Extract, step back, extract again
-  is(scalar @b, 2 * scalar @a);
+  is(scalar @b, 2 * scalar @a,
+    "Array unpacked per template has twice number of elements as original array");
   $b = "@b";
-  $b =~ s/(?:17000+|16999+)\d+(e-45) /17$1 /gi; # stringification is gamble
-  is($b, "@a @a");
+  $b =~ s/(?:17000+|16999+)\d+(e-0?45) /17$1 /gi; # stringification is gamble
+  is($b, "@a @a", "Got expected stringification of unpacked array");
 
   use warnings qw(NONFATAL all);;
   my $warning;
@@ -1424,11 +1425,12 @@ is(scalar unpack('A /A /A Z20', '3004bcde'), 'bcde');
   };
   @b = unpack "x[C] x[$t] X[$t] X[C] $t", "$p\0";
 
-  is($warning, undef);
-  is(scalar @b, scalar @a);
+  is($warning, undef, "Got no warning from unpack, as expected");
+  is(scalar @b, scalar @a,
+    "Array unpacked per second template has same number of elements as original array");
   $b = "@b";
-  $b =~ s/(?:17000+|16999+)\d+(e-45) /17$1 /gi; # stringification is gamble
-  is($b, "@a");
+  $b =~ s/(?:17000+|16999+)\d+(e-0?45) /17$1 /gi; # stringification is gamble
+  is($b, "@a", "Got expected stringification of unpacked array");
 }
 
 is(length(pack("j", 0)), $Config{ivsize});
-- 
2.7.4

@p5pRT
Copy link
Author

p5pRT commented Oct 23, 2017

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Oct 23, 2017

From @sisyphus

-----Original Message-----
From​: James E Keenan via RT
Sent​: Tuesday, October 24, 2017 8​:05 AM
To​: sisyphus1@​optusnet.com.au
Subject​: [perl #132338] [Win32] op/pack.t test failures on extended
precision long double builds of 32-bit perl-5.27.5

However, before I apply it, I want to ask the list​: Is there any reason
to believe that applying this patch would have a negative impact on tests
on any other platform (including other configurations of Windows)?

=========
Elaboration

on windows, (with extended precision long double) the string looks like​:
173 1.28347651700000004e-045 42 215 173 1.28347651700000004e-045 42 215
on many other systems, (with extended precision long double) the string
looks like​:
173 1.28347651700000004e-45 42 215 173 1.28347651700000004e-45 42 215

The tests pass iff that string is modified to​:
on windows​:
173 1.283476517e-045 42 215 173 1.283476517e-045 42 215
on many other systems​:
173 1.283476517e-45 42 215 173 1.283476517e-45 42 215

The original regex does the job for "many other systems" but not for
Windows.
The modified regex does the job for both categories​:

########################################
use warnings;
use strict;

my $nix = "173 1.28347651700000004e-45 42 215 173 1.28347651700000004e-45 42
215";
my $win = "173 1.28347651700000004e-045 42 215 173 1.28347651700000004e-045
42 215";

$nix =~ s/(?​:17000+|16999+)\d+(e-45) /17$1 /gi;
print "Original regex (nix)​: $nix\n";
$win =~ s/(?​:17000+|16999+)\d+(e-45) /17$1 /gi;
print "Original regex (win)​: $win\n\n";

$nix = "173 1.28347651700000004e-45 42 215 173 1.28347651700000004e-45 42
215";
$win = "173 1.28347651700000004e-045 42 215 173 1.28347651700000004e-045 42
215";

$nix =~ s/(?​:17000+|16999+)\d+(e-0?45) /17$1 /gi;
print "Modified regex (nix)​: $nix\n";
$win =~ s/(?​:17000+|16999+)\d+(e-0?45) /17$1 /gi;
print "Modified regex (win)​: $win\n";
########################################

Outputs​:

########################################
Original regex (nix)​: 173 1.283476517e-45 42 215 173 1.283476517e-45 42 215
Original regex (win)​: 173 1.28347651700000004e-045 42 215 173
1.28347651700000004e-045 42 215

Modified regex (nix)​: 173 1.283476517e-45 42 215 173 1.283476517e-45 42 215
Modified regex (win)​: 173 1.283476517e-045 42 215 173 1.283476517e-045 42
215
########################################

Cheers,
Rob

@p5pRT
Copy link
Author

p5pRT commented Jan 7, 2019

From @tonycoz

On Sat, 21 Oct 2017 06​:36​:12 -0700, sisyphus wrote​:

Ever since it has been possible to build 32-bit perl on Windows with
an
nvtype of (extended precision) long double, 2 of the op/pack.t tests
(tests
13177 and 13180) have been failing on those builds.

Patch to t/op/pack.t is attached.

This appears to have been fixed by 0e45f48 using your patch.

Note​: This patch fixes t/op/pack.t for 32-bit builds only. With 64-bit
builds the script still crashes after the successful completion of
test 518.
(Something to work on.)

Is that still a problem for you?

Tony

@p5pRT
Copy link
Author

p5pRT commented Jan 8, 2019

From @sisyphus

This ticket can be closed.

I can't recall how the particular issue with the 64-bit build was resolved,
but t/op/pack.t is now behaving just fine for me.

Cheers,
Rob

On Tue, Jan 8, 2019 at 10​:21 AM Tony Cook via RT <perlbug-followup@​perl.org>
wrote​:

On Sat, 21 Oct 2017 06​:36​:12 -0700, sisyphus wrote​:

Ever since it has been possible to build 32-bit perl on Windows with
an
nvtype of (extended precision) long double, 2 of the op/pack.t tests
(tests
13177 and 13180) have been failing on those builds.

Patch to t/op/pack.t is attached.

This appears to have been fixed by
0e45f48 using your patch.

Note​: This patch fixes t/op/pack.t for 32-bit builds only. With 64-bit
builds the script still crashes after the successful completion of
test 518.
(Something to work on.)

Is that still a problem for you?

Tony

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

@p5pRT
Copy link
Author

p5pRT commented Jan 8, 2019

@tonycoz - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented May 22, 2019

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release today of Perl 5.30.0, this and 160 other issues have been
resolved.

Perl 5.30.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.30.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT
Copy link
Author

p5pRT commented May 22, 2019

@khwilliamson - Status changed from 'pending release' to 'resolved'

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

No branches or pull requests

1 participant