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

[perl #133760] Please define _GNU_SOURCE unconditionally on Linux tomake memmem() available

Thread Previous | Thread Next
From:
perlbug-followup
Date:
January 12, 2019 21:19
Subject:
[perl #133760] Please define _GNU_SOURCE unconditionally on Linux tomake memmem() available
Message ID:
rt-4.0.24-16056-1547137446-1912.133760-75-0@perl.org
# New Ticket Created by   
# Please include the string:  [perl #133760]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=133760 >



This is a bug report for perl from aranea@aixah.de,
generated with the help of perlbug 1.40 running under perl 5.26.2.


-----------------------------------------------------------------
[Please describe your issue here]

Since 5.25, Perl uses the memmem() function to implement ninstr().
memmem() is only available from the string.h header if _GNU_SOURCE is
defined. However, the perl build system currently only defines
_GNU_SOURCE for threaded builds.

On systems with the glibc libc, things appear to work regardless (I
don't know why), but with the musl libc, this breaks ninstr(). Perl
builds fine, but at runtime, functions using ninstr() fail:

$ perl -e '($foo) = "abc" =~ /^(.*)$/; print index("abc", $foo)'
-94330366722048

Please define _GNU_SOURCE unconditionally to fix this issue.


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl 5.26.2:

Configured by Gentoo at Thu Jan 10 14:01:07 CET 2019.

Summary of my perl5 (revision 5 version 26 subversion 2) configuration:
   
  Platform:
    osname=linux
    osvers=4.20.0
    archname=x86_64-linux
    uname='linux deneb.skynet.aixah.de 4.20.0 #2 smp wed jan 9 22:36:55 cet 2019 x86_64 intel(r) core(tm) i7-9700k cpu @ 3.60ghz genuineintel gnulinux '
    config_args='-des -Dinstallprefix=/usr -Dinstallusrbinperl=n -Ui_ndbm -Di_gdbm -Ui_db -DDEBUGGING=-g -Dnoextensions=ODBM_File -Duseshrplib -Darchname=x86_64-linux -Dcc=x86_64-gentoo-linux-musl-gcc -Doptimize=-march=native -O2 -pipe -ggdb -Dldflags=-Wl,-O1 -Wl,--as-needed -Dprefix=/usr -Dsiteprefix=/usr/local -Dvendorprefix=/usr -Dscriptdir=/usr/bin -Dprivlib=/usr/lib/perl5/5.26.2 -Darchlib=/usr/lib/perl5/5.26.2/x86_64-linux -Dsitelib=/usr/local/lib/perl5/5.26.2 -Dsitearch=/usr/local/lib/perl5/5.26.2/x86_64-linux -Dvendorlib=/usr/lib/perl5/vendor_perl/5.26.2 -Dvendorarch=/usr/lib/perl5/vendor_perl/5.26.2/x86_64-linux -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dvendorman1dir=/usr/share/man/man1 -Dvendorman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm -Dlibperl=libperl.so.5.26.2
-Dlocincpth=/usr/include  -Dglibpth=/lib /usr/lib  -Duselargefiles -Dd_semctl_semun -Dcf_by=Gentoo -Dmyhostname=localhost -Dperladmin=root@localhost -Ud_csh -Dsh=/bin/sh -Dtargetsh=/bin/sh -Uusenm -Ui_ndbm -Di_gdbm -Ui_db -DDEBUGGING=-g -Dnoextensions=ODBM_File'
    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='x86_64-gentoo-linux-musl-gcc'
    ccflags ='-fwrapv -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    optimize='-march=native -O2 -pipe -ggdb'
    cppflags='-fwrapv -fno-strict-aliasing -pipe'
    ccversion=''
    gccversion='7.3.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='x86_64-gentoo-linux-musl-gcc'
    ldflags ='-Wl,-O1 -Wl,--as-needed'
    libpth=/usr/lib /usr/lib/../lib64 /lib
    libs=-lpthread -lgdbm -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
    libc=/usr/lib/libc.so
    so=so
    useshrplib=true
    libperl=libperl.so.5.26.2
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -march=native -O2 -pipe -ggdb -Wl,-O1 -Wl,--as-needed'

Locally applied patches:
    gentoo/hints_hpux - Fix hpux hints
    gentoo/aix_soname - aix gcc detection and shared library soname support
    gentoo/EUMM-RUNPATH - https://bugs.gentoo.org/105054 cpan/ExtUtils-MakeMaker: drop $PORTAGE_TMPDIR from LD_RUN_PATH
    gentoo/config_over - Remove -rpath and append LDFLAGS to lddlflags
    gentoo/opensolaris_headers - Add headers for opensolaris
    gentoo/patchlevel - List packaged patches for perl-5.26.2(#1) in patchlevel.h
    gentoo/cleanup-paths - Cleanup PATH and shrpenv
    gentoo/enc2xs - Tweak enc2xs to follow symlinks and ignore missing @INC directories.
    gentoo/darwin-cc-ld - https://bugs.gentoo.org/297751 darwin: Use $CC to link
    gentoo/cpan_definstalldirs - Provide a sensible INSTALLDIRS default for modules installed from CPAN.
    gentoo/interix - Fix interix hints
    gentoo/create_libperl_soname - https://bugs.gentoo.org/286840 Set libperl soname
    gentoo/mod_paths - Add /etc/perl to @INC
    gentoo/EUMM_perllocalpod - cpan/ExtUtils-MakeMaker: remove targets that generate perllocal.pod
    gentoo/drop_fstack_protector - https://bugs.gentoo.org/348557 Don't force -fstack-protector on everyone
    gentoo/usr_local - Configure: Don't include sources in /usr/local/ for compiling perl
    gentoo/D-SHA-CFLAGS - https://bugs.gentoo.org/506818 Do not set custom CFLAGS in cpan/Digest-SHA
    gentoo/io_socket_ip_tests - cpan/IO-Socket-IP: Disable network tests
    gentoo/tests - Fix EUMM podlocal tests
    gentoo/no-nsl.patch -
    debian/cpan-missing-site-dirs - Fix CPAN::FirstTime defaults with nonexisting site dirs if a parent is writable
    debian/makemaker-pasthru - Pass LD settings through to subdirectories
    fixes/memoize_storable_nstore - [rt.cpan.org #77790] Memoize::Storable: respect 'nstore' option not respected
    fixes/podman-pipe - Better errors for man pages from standard input
    fixes/respect_umask - Respect umask during installation
    fixes/net_smtp_docs - [rt.cpan.org #36038] Document the Net::SMTP 'Port' option
    fixes/document_makemaker_ccflags - [rt.cpan.org #68613] Document that CCFLAGS should include $Config{ccflags}
    fixes/parallel-manisort.patch - Fix parallel building

---
@INC for perl 5.26.2:
    /etc/perl
    /usr/local/lib/perl5/5.26.2/x86_64-linux
    /usr/local/lib/perl5/5.26.2
    /usr/lib/perl5/vendor_perl/5.26.2/x86_64-linux
    /usr/lib/perl5/vendor_perl/5.26.2
    /usr/lib/perl5/5.26.2/x86_64-linux
    /usr/lib/perl5/5.26.2

---
Environment for perl 5.26.2:
    HOME=/home/lre
    LANG=en_US.utf8
    LANGUAGE (unset)
    LC_CTYPE=en_US.UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/home/lre/bin
    PERL_BADLANG (unset)
    SHELL=/bin/fish


Thread Previous | Thread Next


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