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

index() sometimes returns invalid values on musl system #16832

Open
p5pRT opened this issue Jan 30, 2019 · 3 comments
Open

index() sometimes returns invalid values on musl system #16832

p5pRT opened this issue Jan 30, 2019 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Jan 30, 2019

Migrated from rt.perl.org#133810 (status was 'open')

Searchable as RT133810$

@p5pRT
Copy link
Author

p5pRT commented Jan 30, 2019

From perlbug@faith.eroen.eu

Created by perlbug@faith.eroen.eu

Perl Info

Flags:
    category=core
    severity=low

Site configuration information for perl 5.28.0:

Configured by Gentoo at Fri Mar 23 18:16:52 UTC 2114.

Summary of my perl5 (revision 5 version 28 subversion 0) configuration:
   
  Platform:
    osname=linux
    osvers=4.20.3-gentoo
    archname=aarch64-linux-debug
    uname='linux localhost 4.20.3-gentoo #1 smp preempt sun jan 20 17:35:30 utc 2019 aarch64 gnulinux '
    config_args='-des -Dinstallprefix=/usr -Dinstallusrbinperl=n -Ui_ndbm -Ui_gdbm -Ui_db -DDEBUGGING -Dnoextensions=ODBM_File GDBM_File NDBM_File -Duseshrplib -Darchname=aarch64-linux-debug -Dcc=aarch64-linux-musl-gcc -Doptimize=-O0 -ggdb3 -g -Dldflags=-Wl,-O1 -Wl,--as-needed -Dprefix=/usr -Dsiteprefix=/usr/local -Dvendorprefix=/usr -Dscriptdir=/usr/bin -Dprivlib=/usr/lib/perl5/5.28.0 -Darchlib=/usr/lib/perl5/5.28.0/aarch64-linux-debug -Dsitelib=/usr/local/lib/perl5/5.28.0 -Dsitearch=/usr/local/lib/perl5/5.28.0/aarch64-linux-debug -Dvendorlib=/usr/lib/perl5/vendor_perl/5.28.0 -Dvendorarch=/usr/lib/perl5/vendor_perl/5.28.0/aarch64-linux-debug -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.28.0 -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 -Ui_gdbm -Ui_db -DDEBUGGING -Dnoextensions=ODBM_File GDBM_File NDBM_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='aarch64-linux-musl-gcc'
    ccflags ='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    optimize='-O0 -ggdb3 -g'
    cppflags='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe'
    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=1
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='aarch64-linux-musl-gcc'
    ldflags ='-Wl,-O1 -Wl,--as-needed'
    libpth=/usr/lib /lib
    libs=-lpthread -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
    libc=/usr/lib/libc.so
    so=so
    useshrplib=true
    libperl=libperl.so.5.28.0
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O0 -ggdb3 -g -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.28.0(#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 -
    gentoo/no_porting_tests - Disable porting tests which create fun false-failures all over travis
    gentoo/pathtools_enoent - Disable PathTools tests which fails under sandboxing
    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.28.0:
    /etc/perl
    /usr/local/lib/perl5/5.28.0/aarch64-linux-debug
    /usr/local/lib/perl5/5.28.0
    /usr/lib/perl5/vendor_perl/5.28.0/aarch64-linux-debug
    /usr/lib/perl5/vendor_perl/5.28.0
    /usr/lib/perl5/5.28.0/aarch64-linux-debug
    /usr/lib/perl5/5.28.0


Environment for perl 5.28.0:
    HOME=/root
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Feb 4, 2019

From @tonycoz

On Wed, 30 Jan 2019 12​:45​:15 -0800, perlbug@​faith.eroen.eu wrote​:

This is a bug report for perl from perlbug@​faith.eroen.eu,
generated with the help of perlbug 1.41 running under perl 5.28.0.

This test program should print "0", but instead it prints "-
187651416129536"​:

$x = "1_1";
$y = "1_1";
print index($x, $y);

Ths issue is only observed when the compared values contain underscore
('_')
and are variables, rather than literals.

I observe this issue with perl 5.26.2 and 5.28.0 on an Aarch64 system
with
musl libc. It works correctly on other systems. It also works
correctly with
perl 5.24.4.

The same issue has been observed by at least one other person [1], but
I did
not find a follow-up bug reported anywhere.

This was previously reported in https://rt-archive.perl.org/perl5/Ticket/Display.html?id=133760

and is fixed in blead (the development version of perl).

I've proposed the fixes for backporting to 5.28.

Without all those fixes you should be able to get a working build by adding​:

-Accflags=-D_GNU_SOURCE

to the Configure command-line.

Tony

@p5pRT
Copy link
Author

p5pRT commented Feb 4, 2019

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

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

2 participants