develooper Front page | perl.perl5.porters | Postings from December 2017

[perl #132560] perl-5.24.3, wrong Configure test for IPC_STAT

Thread Previous | Thread Next
From:
perlbug-followup
Date:
December 14, 2017 14:38
Subject:
[perl #132560] perl-5.24.3, wrong Configure test for IPC_STAT
Message ID:
rt-4.0.24-10674-1512926386-1401.132560-75-0@perl.org
# New Ticket Created by   
# Please include the string:  [perl #132560]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=132560 >



This is a bug report for perl from Joakim.Tjernlund@infinera.com,
generated with the help of perlbug 1.40 running under perl 5.24.3.


-----------------------------------------------------------------
in perl Configure script there is this test for IPC_STAT:

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/stat.h>
#include "tryh.h"
#include <stdio.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
int main() {
    struct semid_ds arg;
    int sem, st;

#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
    printf("size:%d\n", sizeof(semopts));
    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
    if (sem > -1) {
#       ifdef IPC_STAT
            st = semctl(sem, 0, IPC_STAT, &arg);
        if (st == 0)
            printf("semid_ds\n");
        else
#       endif /* IPC_STAT */
            printf("semctl IPC_STAT failed: errno = %d\n", errno);
#       ifdef IPC_RMID
        if (semctl(sem, 0, IPC_RMID, &arg) != 0)
#       endif /* IPC_RMID */
            printf("semctl IPC_RMID failed: errno = %d\n", errno);
    } else
#endif /* IPC_PRIVATE && ... */
        printf("semget failed: errno = %d\n", errno);

    return 0;
}

This fails on ppc32 with:
  semctl IPC_STAT failed: errno = 14
because the test is flawed. The semctl() test must be like so:

    union semun {
      void *buf;
    } semopts;
    semopts.buf = &arg;
..
    st = semctl(sem, 0, IPC_STAT, semopts);
..
    if (semctl(sem, 0, IPC_RMID, semopts) != 0) /* semopts not really needed */

Now the test works.

-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl 5.24.3:

Configured by Gentoo at Fri Oct 13 16:43:19 CEST 2017.

Summary of my perl5 (revision 5 version 24 subversion 3) configuration:
   
  Platform:
    osname=linux, osvers=4.12.8, archname=x86_64-linux
    uname='linux gentoo-jocke.infinera.com 4.12.8 #1 smp preempt wed aug 30 19:00:29 cest 2017 x86_64 intel(r) core(tm) i7-2600 cpu @ 3.40ghz genuineintel gnulinux '
    config_args='-des -Dinstallprefix=/usr -Dinstallusrbinperl=n -Di_ndbm -Di_gdbm -Di_db -DDEBUGGING=none -Dinc_version_list=5.24.2/x86_64-linux 5.24.2 5.24.1/x86_64-linux 5.24.1 5.24.0/x86_64-linux 5.24.0  -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Dnoextensions=ODBM_File -Duseshrplib -Darchname=x86_64-linux -Dcc=x86_64-pc-linux-gnu-gcc -Doptimize=-O2 -pipe -Dldflags=-Wl,-O1 -Wl,--as-needed -Dprefix=/usr -Dsiteprefix=/usr/local -Dvendorprefix=/usr -Dscriptdir=/usr/bin -Dprivlib=/usr/lib64/perl5/5.24.3 -Darchlib=/usr/lib64/perl5/5.24.3/x86_64-linux -Dsitelib=/usr/local/lib64/perl5/5.24.3 -Dsitearch=/usr/local/lib64/perl5/5.24.3/x86_64-linux -Dvendorlib=/usr/lib64/perl5/vendor_perl/5.24.3 -Dvendorarch=/usr/lib64/perl5/vendor_perl/5.24.3/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 -D
 libperl=
 libperl.so.5.24.3 -Dlocincpth=/usr/include  -Dglibpth=/lib64 /usr/lib64  -Duselargefiles -Dd_semctl_semun -Dcf_by=Gentoo -Dmyhostname=localhost -Dperladmin=root@localhost -Ud_csh -Dsh=/bin/sh -Dtargetsh=/bin/sh -Uusenm -Di_ndbm -Di_gdbm -Di_db -DDEBUGGING=none -Dinc_version_list=5.24.2/x86_64-linux 5.24.2 5.24.1/x86_64-linux 5.24.1 5.24.0/x86_64-linux 5.24.0  -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Dnoextensions=ODBM_File'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='x86_64-pc-linux-gnu-gcc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -pipe',
    cppflags='-fwrapv -fno-strict-aliasing -pipe'
    ccversion='', gccversion='5.4.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-pc-linux-gnu-gcc', ldflags ='-Wl,-O1 -Wl,--as-needed'
    libpth=/usr/local/lib64 /lib64 /usr/lib64 /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include-fixed /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.23.so, so=so, useshrplib=true, libperl=libperl.so.5.24.3
    gnulibc_version='2.23'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -pipe -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.24.3(#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/cygwin-libperl - Cygwin: avoid libperl.dll.dll.a
    gentoo/tests - Fixup EUMM perlocal.pod tests and customised SHA1s
    gentoo/zlib-1.2.9-backported-fixes - [rt#119762] Compress-Raw-Zlib: backport zlib 1.2.9+ fixes from upstream 2.073
    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.24.3:
    /etc/perl
    /usr/local/lib64/perl5/5.24.3/x86_64-linux
    /usr/local/lib64/perl5/5.24.3
    /usr/lib64/perl5/vendor_perl/5.24.3/x86_64-linux
    /usr/lib64/perl5/vendor_perl/5.24.3
    /usr/local/lib64/perl5
    /usr/lib64/perl5/vendor_perl/5.24.1
    /usr/lib64/perl5/vendor_perl
    /usr/lib64/perl5/5.24.3/x86_64-linux
    /usr/lib64/perl5/5.24.3

---
Environment for perl 5.24.3:
    HOME=/home/jocke
    LANG=en_GB.utf8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/x86_64-pc-linux-gnu/gcc-bin/5.4.0:/usr/x86_64-pc-linux-gnu/powerpc-g2.20-linux-gnu/gcc-bin/4.9.3:/usr/i686-pc-linux-gnu/powerpc-softfloat-linux-gnu/gcc-bin/3.4.6:/usr/x86_64-pc-linux-gnu/powerpc-softfloat_4.5.3-linux-gnu/gcc-bin/4.5.3:/usr/x86_64-pc-linux-gnu/powerpc-softfloat_4.9.3-linux-gnu/gcc-bin/4.9.4:/usr/x86_64-pc-linux-gnu/x86_64-inf-linux-gnu/gcc-bin/4.9.4:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/games/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash


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