-
Notifications
You must be signed in to change notification settings - Fork 560
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
Tests fail with GCC 5.0 because Errno cannot obtain errno constants #14491
Comments
From @ppisarHello, I don't know if this is the best news before releasing perl 5.20.2, but none t/run/switches ................................................. "EACCES" is not etc. This is caused by wrongly generated Errno.h which is missing all the constants Inline Patch--- /usr/lib64/perl5/Errno.pm 2015-01-23 15:15:43.000000000 +0100
+++ ext/Errno/Errno.pm 2015-02-10 16:06:47.831000000 +0100
@@ -9,10 +9,10 @@
use strict;
"$Config{'archname'}-$Config{'osvers'}" eq
-"x86_64-linux-thread-multi-3.17.8-300.bz1178975.fc21.x86_64" or
- die "Errno architecture (x86_64-linux-thread-multi-3.17.8-300.bz1178975.fc21.x86_64) does not match executable architecture ($Config{'archname'}-$Config{'osvers'})";
+"x86_64-linux-thread-multi-3.19.0-0.rc7.git2.1.fc22.x86_64" or
+ die "Errno architecture (x86_64-linux-thread-multi-3.19.0-0.rc7.git2.1.fc22.x86_64) does not match executable architecture ($Config{'archname'}-$Config{'osvers'})";
-our $VERSION = "1.20_03";
+our $VERSION = "1.22";
$VERSION = eval $VERSION;
our @ISA = 'Exporter';
@@ -20,140 +20,6 @@
BEGIN {
%err = (
- EPERM => 1,
- ENOENT => 2,
- ESRCH => 3,
That's reportedly caused by a change in GCC 5.0's preprocesor as described in: <https://lists.fedoraproject.org/pipermail/devel/2015-February/207549.html> The preprocessed output contains a new line with current working directory Simple work-around is to call the preprocessor with -P option (inhibit -- Petr |
From @ppisarOn 2015-02-10, Petr Pisar <perlbug-followup@perl.org> wrote:
The format change is from: "ENOSTR" [[60]] to "ENOSTR" [[ in preprocessed errno.c in write_errno_pm().
As each line is broken into 5 lines and because the processed file is This might be useful when running the preprocessor on something that But I don't know whether the option is something universally supported -- Petr |
From @rurbanI perlbugged the fix to p5p, but I'm not sure if I'm still blocked, because I don't see my ticket. basically gcc as cpp requires now the -P besides the -E See attachment. -- |
From @rurban0001-Fix-Errno.pm-generation-for-gcc-5.0.patchFrom 1daec2374859ca47ac1d03e7cf187473390c55fa Mon Sep 17 00:00:00 2001
From: Reini Urban <rurban@cpanel.net>
Date: Tue, 10 Feb 2015 20:03:03 +0100
Subject: [PATCH 01/20] Fix Errno.pm generation for gcc-5.0
gcc-5.0 -E interleaves now line numbers with expended macros, so that
the generated errno.c will be preprocessed to
EBFONT => [[
59
]]
which is hard to parse in in line-based reader.
So probe for cpp with "-E -P" first, which will skip producing the linenumbers.
---
Configure | 6 ++++++
1 file changed, 6 insertions(+)
diff --git Configure Configure
index 034104f..244b063 100755
--- Configure
+++ Configure
@@ -4826,6 +4826,12 @@ fi
if $ok; then
: nothing
+elif echo 'Maybe "'"$cc"' -E -P" will work...'; \
+ $cc -E <testcpp.c >testcpp.out 2>&1; \
+ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+ echo "Yup, it does."
+ x_cpp="$cc $cppflags -E -P"
+ x_minus='';
elif echo 'Maybe "'"$cc"' -E" will work...'; \
$cc -E <testcpp.c >testcpp.out 2>&1; \
$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
--
2.1.4
|
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Tue Feb 10 12:43:33 2015, rurban wrote:
Unfortunately that patch is broken in at least three different ways: 1) the echo says it's testing -E -P but then only tests -E 2) even if it's modified to use -P, it fails, since we're testing processing stdin 3) if we fix both of those, adding -P to cppstdin breaks makedepend, since it' uses the #line lines to generate the dependencies The attached fixed all of those problems, but perhaps this belongs in a change to Errno_pm.PL Tony |
From @tonycozOn Tue Feb 10 20:32:03 2015, tonyc wrote:
Now with the attachment. Tony |
From @tonycoz0001-Fix-Errno.pm-generation-for-gcc-5.0.patchFrom 180f90af5a74169a7f016fe874f3c32d71eeaabf Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Wed, 11 Feb 2015 15:29:05 +1100
Subject: [PATCH] Fix Errno.pm generation for gcc-5.0
gcc-5.0 -E interleaves now line numbers with expended macros, so that
the generated errno.c will be preprocessed to
EBFONT => [[
59
]]
which is hard to parse in in line-based reader.
So probe for cpp with "-E -ftrack-macro-expansion=0" first, which
will skip splitting the lines.
It's tempting to use -P instead, but that breaks makedepend.
Based on a patch by Reini Urban.
---
Configure | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/Configure b/Configure
index 034104f..6d21e2b 100755
--- a/Configure
+++ b/Configure
@@ -4826,6 +4826,18 @@ fi
if $ok; then
: nothing
+elif echo 'Maybe "'"$cc"' -E -ftrack-macro-expansion=0" will work...'; \
+ $cc -E -ftrack-macro-expansion=0 <testcpp.c >testcpp.out 2>&1; \
+ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+ echo "Yup, it does."
+ x_cpp="$cc $cppflags -E -ftrack-macro-expansion=0"
+ x_minus='';
+elif echo 'Maybe "'"$cc"' -E -ftrack-macro-expansion=0 -" will work...'; \
+ $cc -E -ftrack-macro-expansion=0 - <testcpp.c >testcpp.out 2>&1; \
+ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+ echo "Yup, it does."
+ x_cpp="$cc $cppflags -E -ftrack-macro-expansion=0"
+ x_minus='-';
elif echo 'Maybe "'"$cc"' -E" will work...'; \
$cc -E <testcpp.c >testcpp.out 2>&1; \
$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
--
1.7.10.4
|
From @ppisarOn 2015-02-11, Tony Cook via RT <perlbug-followup@perl.org> wrote:
I think Errno_pm.PL is better place. Otherwise the you change CPP flags
With the patch the lib/h2ph.t test fails for me: lib/h2ph ....................................................... # Failed test 5 - preamble compiles at ../lib/h2ph.t line 49 -- Petr |
From @ppisarOn 2015-02-11, Petr Pisar <ppisar@redhat.com> wrote:
This failure is probably not releated to the patch as it fails with GCC 5.0 -- Petr |
From @ppisarThis is my patch patching Errno_pm.PL instead of the global configuration. -- Petr |
From @ppisar0001-Fix-Errno.pm-generation-for-gcc-5.0.patchFrom 9e99628b4e1c05e04f01522854799dd53228ff40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 11 Feb 2015 15:46:37 +0100
Subject: [PATCH] Fix Errno.pm generation for gcc-5.0
gcc-5.0 -E interleaves now line numbers with expended macros, so that
the generated errno.c will be preprocessed to
EBFONT => [[
59
]]
which is hard to parse in in line-based reader.
So use -P option with gcc >= 5.0. Global -P usage would break makedepend,
global -ftrack-macro-expansion=0 would break lib/h2ph.t.
RT#123784
---
ext/Errno/Errno_pm.PL | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
index 3dadfce..92c8666 100644
--- a/ext/Errno/Errno_pm.PL
+++ b/ext/Errno/Errno_pm.PL
@@ -215,20 +215,31 @@ sub write_errno_pm {
{ # BeOS (support now removed) did not enter this block
# invoke CPP and read the output
+ my $inhibit_linemarkers = '';
+ if ($Config{gccversion} =~ /\A(5)\./ and $1 >= 5) {
+ # GCC 5.0 interleaves expanded macros with line numbers breaking
+ # each line into multiple lines. RT#123784
+ $inhibit_linemarkers = ' -P';
+ }
+
if ($^O eq 'VMS') {
- my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}";
+ my $cpp = "$Config{cppstdin} $Config{cppflags}" .
+ $inhibit_linemarkers . " $Config{cppminus}";
$cpp =~ s/sys\$input//i;
open(CPPO,"$cpp errno.c |") or
die "Cannot exec $Config{cppstdin}";
} elsif ($IsMSWin32 || $^O eq 'NetWare') {
- open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or
- die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'";
+ my $cpp = "$Config{cpprun} $Config{cppflags}" .
+ $inhibit_linemarkers;
+ open(CPPO,"$cpp errno.c |") or
+ die "Cannot run '$cpp errno.c'";
} elsif ($IsSymbian) {
- my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc -";
+ my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc" .
+ $inhibit_linemarkers ." -";
open(CPPO,"$cpp < errno.c |")
or die "Cannot exec $cpp";
} else {
- my $cpp = default_cpp();
+ my $cpp = default_cpp() . $inhibit_linemarkers;
open(CPPO,"$cpp < errno.c |")
or die "Cannot exec $cpp";
}
--
2.3.0
|
From @ppisarOn 2015-02-11, Petr Pisar <ppisar@redhat.com> wrote:
The t/_h2ph_pre.ph file generated by the ../utils/h2ps differs, for -unless (defined &__INT16_MAX__) { sub __INT16_MAX__() { 32767 } } All the test failures are about lines with a hexadecimal number prefixed This could be maybe caused my glibc-headers-2.20.90 which was also built -- Petr |
From @ppisarOn 2015-02-11, Petr Pisar <ppisar@redhat.com> wrote:
After I implement hexadecimal integers in the h2ph, I got this failure: $ ./perl -MTestInit lib/h2ph.t My understanding is this is rather advice for Perl users not to use such What surprises me is that the failing number is 0x7fffffffffffffff which $ ./perl -Ilib -w -e '$a = 9223372036854775807'; -- Petr |
From @tonycozOn Wed Feb 11 08:09:15 2015, ppisar wrote:
The preamble file generation doesn't handle hex constants. If you look at cppsymbols in config.sh, you'll see: __INT32_MAX__=0x7fffffff Attached a patch to fix that. As to the warning, I suspect hex constants warn because people expect them to be treated as integers, while a decimal constant could be treated either way. Tony |
From @tonycoz0001-h2ph-correct-handling-of-hex-constants-for-the-pream.patchFrom 9bab817af6c7d7c028d2c790d2ae4eb319e1077f Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 12 Feb 2015 14:10:36 +1100
Subject: [PATCH] h2ph: correct handling of hex constants for the preamble
---
utils/h2ph.PL | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/utils/h2ph.PL b/utils/h2ph.PL
index 9a8b14d..c46d423 100644
--- a/utils/h2ph.PL
+++ b/utils/h2ph.PL
@@ -769,7 +769,7 @@ sub inc_dirs
sub build_preamble_if_necessary
{
# Increment $VERSION every time this function is modified:
- my $VERSION = 3;
+ my $VERSION = 4;
my $preamble = "$Dest_dir/_h2ph_pre.ph";
# Can we skip building the preamble file?
@@ -788,6 +788,8 @@ sub build_preamble_if_necessary
open PREAMBLE, ">$preamble" or die "Cannot open $preamble: $!";
print PREAMBLE "# This file was created by h2ph version $VERSION\n";
+ # prevent large hex constants from warning
+ print PREAMBLE "no warnings qw(portable);\n";
foreach (sort keys %define) {
if ($opt_D) {
@@ -810,7 +812,7 @@ DEFINE
# float:
print PREAMBLE
"unless (defined &$_) { sub $_() { $1 } }\n\n";
- } elsif ($define{$_} =~ /^([+-]?\d+)U?L{0,2}$/i) {
+ } elsif ($define{$_} =~ /^([+-]?\d+|0x[\da-f]+)U?L{0,2}$/i) {
# integer:
print PREAMBLE
"unless (defined &$_) { sub $_() { $1 } }\n\n";
--
1.7.10.4
|
From @ppisarOn Wed, Feb 11, 2015 at 07:21:19PM -0800, Tony Cook via RT wrote:
Yes. It works for me. Thanks. Just a nit-pick. The regular expression: /^([+-]?\d+|0x[\da-f]+)U?L{0,2}$/i does not cover negative hexadecimal integers. If I understand the ISO-C11
I don't understand. Hexadecimal constants are not integers? -- Petr |
From @ppisarOn Wed, Feb 11, 2015 at 04:48:24PM +0100, Petr Pisar wrote:
The patch did not expected GCC with major version number greater than 5 and it Together with Tony's h2ph: correct handling of hex constants for the preamble -- Petr |
From @ppisar0001-Fix-Errno.pm-generation-for-gcc-5.0.patchFrom 96bcd6ed97ff05f5b421005f23973279dbfcafbf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 11 Feb 2015 15:46:37 +0100
Subject: [PATCH 1/2] Fix Errno.pm generation for gcc-5.0
gcc-5.0 -E interleaves now line numbers with expended macros, so that
the generated errno.c will be preprocessed to
EBFONT => [[
59
]]
which is hard to parse in in line-based reader.
So use -P option with gcc >= 5.0. Global -P usage would break makedepend,
global -ftrack-macro-expansion=0 would break lib/h2ph.t.
RT#123784
---
ext/Errno/Errno_pm.PL | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
index 3dadfce..c6bfa06 100644
--- a/ext/Errno/Errno_pm.PL
+++ b/ext/Errno/Errno_pm.PL
@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
use Config;
use strict;
-our $VERSION = "1.22";
+our $VERSION = "1.23";
my %err = ();
@@ -215,20 +215,31 @@ sub write_errno_pm {
{ # BeOS (support now removed) did not enter this block
# invoke CPP and read the output
+ my $inhibit_linemarkers = '';
+ if ($Config{gccversion} =~ /\A(\d+)\./ and $1 >= 5) {
+ # GCC 5.0 interleaves expanded macros with line numbers breaking
+ # each line into multiple lines. RT#123784
+ $inhibit_linemarkers = ' -P';
+ }
+
if ($^O eq 'VMS') {
- my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}";
+ my $cpp = "$Config{cppstdin} $Config{cppflags}" .
+ $inhibit_linemarkers . " $Config{cppminus}";
$cpp =~ s/sys\$input//i;
open(CPPO,"$cpp errno.c |") or
die "Cannot exec $Config{cppstdin}";
} elsif ($IsMSWin32 || $^O eq 'NetWare') {
- open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or
- die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'";
+ my $cpp = "$Config{cpprun} $Config{cppflags}" .
+ $inhibit_linemarkers;
+ open(CPPO,"$cpp errno.c |") or
+ die "Cannot run '$cpp errno.c'";
} elsif ($IsSymbian) {
- my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc -";
+ my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc" .
+ $inhibit_linemarkers ." -";
open(CPPO,"$cpp < errno.c |")
or die "Cannot exec $cpp";
} else {
- my $cpp = default_cpp();
+ my $cpp = default_cpp() . $inhibit_linemarkers;
open(CPPO,"$cpp < errno.c |")
or die "Cannot exec $cpp";
}
--
2.3.0
|
From @tonycozOn Thu, Feb 12, 2015 at 08:51:10AM +0100, Petr Pisar wrote:
I'll fix that.
On a 32-bit platform (without -Duse64bitint), a decimal integer over This makes me wonder if we have another issue - will _h2ph_pre.ph - 32-bit build of perl Tony |
From @ppisarOn Thu, Feb 12, 2015 at 10:10:39PM +1100, Tony Cook wrote:
You were right. This does not work. I thought it worked, but after installing t ok 6 - output free of warnings Supressing "overflow" warnings category makes me nervous. -- Petr |
From @tonycozOn Fri Feb 13 06:55:57 2015, ppisar wrote:
Does the attached help? I don't have a 32-bit system with gcc-5 installed. Replaces my original patch. Tony |
From @tonycoz0001-h2ph-correct-handling-of-hex-constants-for-the-pream.patchFrom df7e6433e66989a4cd0d1c5b914dedb065220d30 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 16 Feb 2015 15:57:00 +1100
Subject: [PATCH] h2ph: correct handling of hex constants for the preamble
Previously they were treated as identifiers resulting in code
generated like C< &0xFFF >.
We also try to prevent compile-time warnings from large hex integers,
the user isn't responsible for the generated code, so we delay those
warnings to run-time.
---
utils/h2ph.PL | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/utils/h2ph.PL b/utils/h2ph.PL
index 9a8b14d..d082f22 100644
--- a/utils/h2ph.PL
+++ b/utils/h2ph.PL
@@ -769,7 +769,7 @@ sub inc_dirs
sub build_preamble_if_necessary
{
# Increment $VERSION every time this function is modified:
- my $VERSION = 3;
+ my $VERSION = 4;
my $preamble = "$Dest_dir/_h2ph_pre.ph";
# Can we skip building the preamble file?
@@ -788,6 +788,11 @@ sub build_preamble_if_necessary
open PREAMBLE, ">$preamble" or die "Cannot open $preamble: $!";
print PREAMBLE "# This file was created by h2ph version $VERSION\n";
+ # Prevent non-portable hex constants from warning.
+ #
+ # We still produce an overflow warning if we can't represent
+ # a hex constant as an integer.
+ print PREAMBLE "no warnings qw(portable);\n";
foreach (sort keys %define) {
if ($opt_D) {
@@ -814,6 +819,18 @@ DEFINE
# integer:
print PREAMBLE
"unless (defined &$_) { sub $_() { $1 } }\n\n";
+ } elsif ($define{$_} =~ /^([+-]?0x[\da-f]+)U?L{0,2}$/i) {
+ # hex integer
+ # Special cased, since perl warns on hex integers
+ # that can't be represented in a UV.
+ #
+ # This way we get the warning at time of use, so the user
+ # only gets the warning if they happen to use this
+ # platform-specific definition.
+ my $code = $1;
+ $code = "hex('$code')" if length $code > 10;
+ print PREAMBLE
+ "unless (defined &$_) { sub $_() { $code } }\n\n";
} elsif ($define{$_} =~ /^\w+$/) {
my $def = $define{$_};
if ($isatype{$def}) {
--
1.7.10.4
|
From @ppisarOn Sun, Feb 15, 2015 at 09:11:25PM -0800, Tony Cook via RT wrote:
Yes. It works both on amd64 and on x86 with native integers. -- Petr |
From @tonycozOn Mon Feb 16 04:57:45 2015, ppisar wrote:
Your patch thanks, applied as 816b056 and mine as 3bea78d. Tony |
@tonycoz - Status changed from 'open' to 'pending release' |
From @ppisarOn Fri, Feb 13, 2015 at 03:55:12PM +0100, Petr Pisar wrote:
I tracked the cause why it failed after second rebuild and not on the first $ LD_PRELOAD=$PWD/libperl.so strace -fq -s 1024 -e execve,chdir,open -y -v ./perl -MTestInit lib/h2ph.t It's becuse lib/h2ph.t executes generated code without passing proper -I Attached patch fixes it. -- Petr |
From @ppisar0001-lib-h2ph.t-to-test-generated-t-_h2ph_pre.ph-instead-.patchFrom ae54661bfad51c56e0d5c01bace60d44513a77e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 17 Feb 2015 13:11:00 +0100
Subject: [PATCH] lib/h2ph.t to test generated t/_h2ph_pre.ph instead of the
system one
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The lib/h2ph.t test executes a t/lib/h2ph.pht which requires
'_h2ph_pre.ph'. This should find and exercise generated t/_h2ph_pre.ph
file. However, it found a loaded _h2ph_pre.ph from system because the
interpreter has the './' directory after the system paths in the @INC by
default.
This patch adds '-I./' to the runperl() invocation to prefer the
_h2ph_pre.ph generated at build time.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
lib/h2ph.t | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/h2ph.t b/lib/h2ph.t
index 2b58f6a..64d9dc0 100644
--- a/lib/h2ph.t
+++ b/lib/h2ph.t
@@ -48,7 +48,7 @@ $result = runperl( progfile => '_h2ph_pre.ph',
stderr => 1 );
like( $result, qr/syntax OK$/, "preamble compiles");
-$result = runperl( switches => ["-w"],
+$result = runperl( switches => ['-I.', "-w"],
stderr => 1,
prog => <<'PROG' );
$SIG{__WARN__} = sub { die $_[0] }; require q(lib/h2ph.pht);
--
2.1.0
|
From @tonycozOn Tue Feb 17 04:57:50 2015, ppisar wrote:
Thanks, applied as 3359391. Tony |
From @khwilliamsonThank you for submitting this ticket. The issue should now be resolved with the release today of Perl v5.22, which is available at http://www.perl.org/get.html |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#123784 (status was 'resolved')
Searchable as RT123784$
The text was updated successfully, but these errors were encountered: