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

[PATCH] Make Errno_pm.PL compatible with /usr/include/<ARCH>/errno.h #16751

Closed
p5pRT opened this issue Nov 17, 2018 · 8 comments
Closed

[PATCH] Make Errno_pm.PL compatible with /usr/include/<ARCH>/errno.h #16751

p5pRT opened this issue Nov 17, 2018 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 17, 2018

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

Searchable as RT133662$

@p5pRT
Copy link
Author

p5pRT commented Nov 17, 2018

From @ntyni

This is a bug report for perl from ntyni@​debian.org,
generated with the help of perlbug 1.41 running under perl 5.29.5.


As seen in <https://bugs.debian.org/798955>, Debian glibc
maintainers intend to move system header files from /usr/include to
/usr/include/<arch> at some point. This would break Errno_pm.PL, which
has logic for asking cpp for the location of errno.h but fails earlier
if errno.h is not on a list of known paths.

The attached patch changes the logic to take the cpp fallback instead
of dying. The behaviour should stay identical as long as errno.h is
not moved.

This will also enable multiarch (non-sysroot) cross builds.

Original patch by Helmut Grohne.

Bug-Debian​: https://bugs.debian.org/875921



Flags​:
  category=library
  severity=low
  module=Errno


Site configuration information for perl 5.29.5​:

Configured by niko at Sat Nov 17 20​:25​:08 EET 2018.

Summary of my perl5 (revision 5 version 29 subversion 5) configuration​:
  Local Commit​: 10ff9dbb3d5509189dcef103ccc815213ed41690
  Ancestor​: 3db0bcc
  Platform​:
  osname=linux
  osvers=4.18.0-2-amd64
  archname=x86_64-linux
  uname='linux estella 4.18.0-2-amd64 #1 smp debian 4.18.10-2 (2018-11-02) x86_64 gnulinux '
  config_args='-des -Dusedevel'
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=undef
  usemultiplicity=undef
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  bincompat5005=undef
  Compiler​:
  cc='cc'
  ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
  optimize='-O2'
  cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
  ccversion=''
  gccversion='8.2.0'
  gccosandvers=''
  intsize=4
  longsize=8
  ptrsize=8
  doublesize=8
  byteorder=12345678
  doublekind=3
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=16
  longdblkind=3
  ivtype='long'
  ivsize=8
  nvtype='double'
  nvsize=8
  Off_t='off_t'
  lseeksize=8
  alignbytes=8
  prototype=define
  Linker and Libraries​:
  ld='cc'
  ldflags =' -fstack-protector-strong -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
  libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
  perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
  libc=libc-2.27.so
  so=so
  useshrplib=false
  libperl=libperl.a
  gnulibc_version='2.27'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs
  dlext=so
  d_dlsymun=undef
  ccdlflags='-Wl,-E'
  cccdlflags='-fPIC'
  lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Locally applied patches​:
  10ff9dbb3d5509189dcef103ccc815213ed41690


@​INC for perl 5.29.5​:
  lib
  /usr/local/lib/perl5/site_perl/5.29.5/x86_64-linux
  /usr/local/lib/perl5/site_perl/5.29.5
  /usr/local/lib/perl5/5.29.5/x86_64-linux
  /usr/local/lib/perl5/5.29.5


Environment for perl 5.29.5​:
  HOME=/home/niko
  LANG=en_US.UTF-8
  LANGUAGE (unset)
  LC_CTYPE=fi_FI.UTF-8
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/home/niko/bin​:/home/niko/bin​:/home/niko/bin​:/usr/local/bin​:/usr/bin​:/bin​:/usr/local/games​:/usr/games​:/sbin​:/usr/sbin​:/sbin​:/usr/sbin
  PERL_BADLANG (unset)
  SHELL=/bin/zsh

@p5pRT
Copy link
Author

p5pRT commented Nov 17, 2018

From @ntyni

0001-Make-Errno_pm.PL-compatible-with-usr-include-ARCH-er.patch
From 66c44c59a373128794723ae75e48c1f21328e357 Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Sat, 17 Nov 2018 19:27:42 +0200
Subject: [PATCH] Make Errno_pm.PL compatible with /usr/include/<ARCH>/errno.h

As seen in <https://bugs.debian.org/798955>, Debian glibc
maintainers intend to move system header files from /usr/include to
/usr/include/<arch> at some point. This would break Errno_pm.PL, which
has logic for asking cpp for the location of errno.h but fails earlier
if errno.h is not on a list of known paths.

Take the cpp fallback instead of dying. The behaviour should stay
identical as long as errno.h is not moved.

This will also enable multiarch (non-sysroot) cross builds.

Original patch by Helmut Grohne.

Bug-Debian: https://bugs.debian.org/875921
---
 ext/Errno/Errno_pm.PL | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
index d565f31b2f..84fd151d27 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.29";
+our $VERSION = "1.30";
 
 my %err = ();
 
@@ -111,6 +111,17 @@ sub default_cpp {
 
 sub get_files {
     my %file = ();
+    # When cross-compiling we may store a path for gcc's "sysroot" option:
+    my $sysroot = $Config{sysroot} || '';
+    my $linux_errno_h;
+    if ($^O eq 'linux') {
+	# Some Linuxes have weird errno.hs which generate
+	# no #file or #line directives
+	($linux_errno_h) = grep { -e $_ } map { "$_/errno.h" }
+	    "$sysroot/usr/include", "$sysroot/usr/local/include",
+	    split / / => $Config{locincpth};
+    }
+
     # VMS keeps its include files in system libraries
     if ($^O eq 'VMS') {
 	$file{'Sys$Library:DECC$RTLDEF.TLB'} = 1;
@@ -125,17 +136,10 @@ sub get_files {
 	}
     } elsif ($^O eq 'linux' &&
 	      $Config{gccversion} ne '' && 
-	      $Config{gccversion} !~ /intel/i
+	      $Config{gccversion} !~ /intel/i &&
 	      # might be using, say, Intel's icc
+	      $linux_errno_h
 	     ) {
-    # When cross-compiling we may store a path for gcc's "sysroot" option:
-    my $sysroot = $Config{sysroot} || '';
-	# Some Linuxes have weird errno.hs which generate
-	# no #file or #line directives
-	my ($linux_errno_h) = grep { -e $_ } map { "$_/errno.h" }
-	    "$sysroot/usr/include", "$sysroot/usr/local/include",
-	    split / / => $Config{locincpth} or
-		die "Cannot find errno.h";
 	$file{$linux_errno_h} = 1;
     } elsif ($^O eq 'haiku') {
 	# hidden in a special place
-- 
2.19.1

@p5pRT
Copy link
Author

p5pRT commented Nov 17, 2018

From @jkeenan

On Sat, 17 Nov 2018 19​:19​:21 GMT, ntyni@​debian.org wrote​:

This is a bug report for perl from ntyni@​debian.org,
generated with the help of perlbug 1.41 running under perl 5.29.5.

-----------------------------------------------------------------
As seen in <https://bugs.debian.org/798955>, Debian glibc
maintainers intend to move system header files from /usr/include to
/usr/include/<arch> at some point. This would break Errno_pm.PL, which
has logic for asking cpp for the location of errno.h but fails earlier
if errno.h is not on a list of known paths.

The attached patch changes the logic to take the cpp fallback instead
of dying. The behaviour should stay identical as long as errno.h is
not moved.

This will also enable multiarch (non-sysroot) cross builds.

Original patch by Helmut Grohne.

Bug-Debian​: https://bugs.debian.org/875921

Made available for smoke testing in this branch​:

smoke-me/jkeenan/ntyni/rt-133662-errno-pm

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

@p5pRT
Copy link
Author

p5pRT commented Nov 17, 2018

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

@p5pRT
Copy link
Author

p5pRT commented Nov 20, 2018

From @tonycoz

On Sat, 17 Nov 2018 11​:19​:21 -0800, ntyni@​debian.org wrote​:

As seen in <https://bugs.debian.org/798955>, Debian glibc
maintainers intend to move system header files from /usr/include to
/usr/include/<arch> at some point. This would break Errno_pm.PL, which
has logic for asking cpp for the location of errno.h but fails earlier
if errno.h is not on a list of known paths.

The attached patch changes the logic to take the cpp fallback instead
of dying. The behaviour should stay identical as long as errno.h is
not moved.

This will also enable multiarch (non-sysroot) cross builds.

Original patch by Helmut Grohne.

Bug-Debian​: https://bugs.debian.org/875921

Thanks, applied as 6c5080f.

Tony

@p5pRT
Copy link
Author

p5pRT commented Nov 20, 2018

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant