pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lang/perl5 broken Makefile



On Fri, 03 May 2019 17:36:14 +0900 (JST)
Takahiro Kambe <taca%NetBSD.org@localhost> wrote:

> In message <20190503092747.89c9730671cf7e46b134acc6%googlemail.com@localhost>
> 	on Fri, 3 May 2019 09:27:47 +0100,
> 	Sad Clouds <cryintothebluesky%gmail.com@localhost> wrote:
> > Hello, if anyone out there maintaining this package, please note
> > this does not work on Solaris with its native find command.
> Hi,
> 
> I commited a fix not to use "-delete" option of find(1).
> Please try again.
> 
> -- 
> Takahiro Kambe <taca%NetBSD.org@localhost>


Hello, thanks for the fix, I've previously commented out that line
from Makefile, but looks like either Perl or GCC is buggy, this may
need to go upstream. I'm actually using GCC 8.3.0

Here is where it fails:

LD_LIBRARY_PATH=/opt/pkgbuild/objects/lang/perl5/work/perl-5.28.2 ./miniperl -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
bash: line 7:  5826 Bus Error               (core dumped) LD_LIBRARY_PATH=/opt/pkgbuild/objects/lang/perl5/work/perl-5.28.2 ./miniperl -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>'
Failed to build miniperl. Please run make minitest
*** [lib/buildcustomize.pl] Error code 1 (ignored)
LD_LIBRARY_PATH=/opt/pkgbuild/objects/lang/perl5/work/perl-5.28.2 ./miniperl -Ilib make_patchnum.pl
bash: line 3:  5829 Bus Error               (core dumped) LD_LIBRARY_PATH=/opt/pkgbuild/objects/lang/perl5/work/perl-5.28.2 ./miniperl -Ilib make_patchnum.pl
*** [lib/Config_git.pl] Error code 138

bmake: stopped in /opt/pkgbuild/objects/lang/perl5/work/perl-5.28.2
1 error


I compiled with debug symbols and looked at core dump:

Core was generated by `./miniperl -Ilib make_patchnum.pl'.
Program terminated with signal 10, Bus error.
#0  zaphod32_hash_with_state (key_len=25, key=0xffbff9da "ALLOW_VULNERABLE_PACKAGES=", state_ch=<optimized out>) at zaphod32_hash.h:280
280                 v1 -= U8TO32_LE(key+0);
(gdb) bt
#0  zaphod32_hash_with_state (key_len=25, key=0xffbff9da "ALLOW_VULNERABLE_PACKAGES=", state_ch=<optimized out>) at zaphod32_hash.h:280
#1  Perl_hv_common (my_perl=0x290008, hv=0x32cd18, keysv=0x0, key=0xffbff9da "ALLOW_VULNERABLE_PACKAGES=", klen=<optimized out>, flags=0, 
    action=8, val=0x0, hash=<optimized out>) at hv.c:633
#2  0x001afe00 in Perl_hv_common_key_len (my_perl=0x290008, hv=0x32cd18, key=0xffbff9da "ALLOW_VULNERABLE_PACKAGES=", 
    klen_i32=<optimized out>, action=8, val=0x0, hash=<optimized out>) at hv.c:337
#3  0x0011bf00 in S_init_postdump_symbols (my_perl=0x290008, argc=<optimized out>, argv=<optimized out>, env=0xffbfed6c) at perl.c:4560
#4  0x001211e4 in S_parse_body (xsinit=<optimized out>, env=<optimized out>, my_perl=<optimized out>) at perl.c:2434
#5  perl_parse (my_perl=<optimized out>, xsinit=<optimized out>, argc=<optimized out>, argv=<optimized out>, env=<optimized out>)
    at perl.c:1803
#6  0x0026dc9c in main (argc=<optimized out>, argv=<optimized out>, env=<optimized out>) at miniperlmain.c:127


Here is function prototype where key is a pointer to uint8_t:

ZAPHOD32_STATIC_INLINE
U32 zaphod32_hash_with_state(
    const U8 *state_ch,
    const U8 *key,
    const STRLEN key_len
)


This is where Bus Error happens when calling "v1 -= U8TO32_LE(key+0)"
on line 280:

    {
zaphod32_read8:
        len = key_len & 0x7;
        end = key + key_len - len;
        do {
            v1 -= U8TO32_LE(key+0);
            v0 += U8TO32_LE(key+4);
            ZAPHOD32_MIX(v0,v1,v2,"MIX 2-WORDS A");
            key += 8;
        } while ( key < end );
    }


Looking at macro for U8TO32_LE it looks like
ZAPHOD32_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN is not defined, so not
sure why the code in the #else part fails.

#ifndef U8TO32_LE
#if ZAPHOD32_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN
#define U8TO32_LE(ptr)  (*((const U32 *)(ptr)))
#else
#define U8TO32_LE(ptr)  (\
    (U32)(ptr)[3] << 24 | \
    (U32)(ptr)[2] << 16 | \
    (U32)(ptr)[1] << 8  | \
    (U32)(ptr)[0]         \
)
#endif
#endif

GDB disassembly shows

0x1aea5c <Perl_hv_common+5308>  ld  [ %l5 ], %o0
0x1aea60 <Perl_hv_common+5312>  call  0x26d764 <__bswapsi2>
0x1aea64 <Perl_hv_common+5316>  st  %g1, [ %fp + -16 ]
0x1aea68 <Perl_hv_common+5320>  st  %o0, [ %fp + -12 ]
0x1aea6c <Perl_hv_common+5324>  call  0x26d764 <__bswapsi2>
0x1aea70 <Perl_hv_common+5328>  ld  [ %l5 + 4 ], %o0
0x1aea74 <Perl_hv_common+5332>  ld  [ %fp + -12 ], %g2
0x1aea78 <Perl_hv_common+5336>  ld  [ %fp + -16 ], %g1

Suspect GCC loads 32-bit integer and then calls internal __bswapsi2,
so the load may be causing Bus Error since the actual data is an array
of uint8_t objects.


Home | Main Index | Thread Index | Old Index