Skip Menu |
Report information
Id: 132560
Status: pending release
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: Joakim.Tjernlund [at] infinera.com
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: unknown
Perl Version: (no value)
Fixed In: (no value)



Subject: perl-5.24.3, wrong Configure test for IPC_STAT
From: Joakim.Tjernlund [...] infinera.com
Date: Sun, 10 Dec 2017 18:10:36 +0100
To: perlbug [...] perl.org
Download (untitled) / with headers
text/plain 8.1k
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
RT-Send-CC: perl5-porters [...] perl.org
On Sun, 10 Dec 2017 17:19:46 GMT, Joakim.Tjernlund@infinera.com wrote: Show quoted text
> > 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. > >
I'm having trouble understanding exactly where in Configure you think a correction should be made. Would you be able to do a checkout of the Perl 5 git repository, create a patch to Configure with your corrections and, assuming the patch "works", attach that patch to this ticket? [Note to metaconfig team: I *think* this pertains to approx. line 190 in U/modified/d_union_semun.U.] Thank you very much. ----------------------------------------------------------------- Show quoted text
> --- > 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
-- James E Keenan (jkeenan@cpan.org)
Subject: Re: [perl #132560] perl-5.24.3, wrong Configure test for IPC_STAT
Date: Wed, 13 Dec 2017 15:23:49 +0000
To: "perlbug-followup [...] perl.org" <perlbug-followup [...] perl.org>
From: Joakim Tjernlund <Joakim.Tjernlund [...] infinera.com>
Download (untitled) / with headers
text/plain 9.6k
On Mon, 2017-12-11 at 16:43 -0800, James E Keenan via RT wrote: Show quoted text
> > On Sun, 10 Dec 2017 17:19:46 GMT, Joakim.Tjernlund@infinera.com wrote:
> > > > 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. > > > >
> > I'm having trouble understanding exactly where in Configure you think a correction should be made.
Me too, I just snagged the try.c files and worked from there. Show quoted text
> > Would you be able to do a checkout of the Perl 5 git repository, create a patch to Configure with your corrections and, assuming the patch "works", attach that patch to this ticket?
Sorry, not any easier for me, not even knowing anything about perl internal build system. Show quoted text
> [Note to metaconfig team: I *think* this pertains to approx. line 190 in U/modified/d_union_semun.U.] > > Thank you very much. > -----------------------------------------------------------------
> > --- > > 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
> > > -- > James E Keenan (jkeenan@cpan.org)
From: Joakim Tjernlund <Joakim.Tjernlund [...] infinera.com>
Subject: Re: [perl #132560] perl-5.24.3, wrong Configure test for IPC_STAT
To: "perlbug-followup [...] perl.org" <perlbug-followup [...] perl.org>
Date: Mon, 18 Dec 2017 22:38:10 +0000
Download (untitled) / with headers
text/plain 10.2k
On Wed, 2017-12-13 at 16:23 +0100, Joakim Tjernlund wrote: Show quoted text
> On Mon, 2017-12-11 at 16:43 -0800, James E Keenan via RT wrote:
> > > > On Sun, 10 Dec 2017 17:19:46 GMT, Joakim.Tjernlund@infinera.com wrote:
> > > > > > 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. > > > > > >
> > > > I'm having trouble understanding exactly where in Configure you think a correction should be made.
> > Me too, I just snagged the try.c files and worked from there. >
> > > > Would you be able to do a checkout of the Perl 5 git repository, create a patch to Configure with your corrections and, assuming the patch "works", attach that patch to this ticket?
> > Sorry, not any easier for me, not even knowing anything about perl internal build system. >
> > [Note to metaconfig team: I *think* this pertains to approx. line 190 in U/modified/d_union_semun.U.]
Ping? Show quoted text
> > > > Thank you very much. > > -----------------------------------------------------------------
> > > --- > > > 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
> > > > > > -- > > James E Keenan (jkeenan@cpan.org)
From: Joakim Tjernlund <Joakim.Tjernlund [...] infinera.com>
Subject: Re: [perl #132560] perl-5.24.3, wrong Configure test for IPC_STAT
Date: Thu, 1 Mar 2018 19:11:15 +0000
To: "perlbug-followup [...] perl.org" <perlbug-followup [...] perl.org>
On Mon, 2017-12-18 at 23:38 +0100, Joakim Tjernlund wrote: Show quoted text
> On Wed, 2017-12-13 at 16:23 +0100, Joakim Tjernlund wrote:
> > On Mon, 2017-12-11 at 16:43 -0800, James E Keenan via RT wrote:
> > > > > > On Sun, 10 Dec 2017 17:19:46 GMT, Joakim.Tjernlund@infinera.com wrote:
> > > > > > > > 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. > > > > > > > >
> > > > > > I'm having trouble understanding exactly where in Configure you think a correction should be made.
> > > > Me too, I just snagged the try.c files and worked from there. > >
> > > > > > Would you be able to do a checkout of the Perl 5 git repository, create a patch to Configure with your corrections and, assuming the patch "works", attach that patch to this ticket?
> > > > Sorry, not any easier for me, not even knowing anything about perl internal build system. > >
> > > [Note to metaconfig team: I *think* this pertains to approx. line 190 in U/modified/d_union_semun.U.]
> > Ping? >
Gentle ping .. Show quoted text
> > > > > > Thank you very much. > > > -----------------------------------------------------------------
> > > > --- > > > > 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
> > > > > > > > > -- > > > James E Keenan (jkeenan@cpan.org)
From: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
Date: Thu, 29 Mar 2018 16:23:10 +0200
To: perl5-porters [...] perl.org, James E Keenan <jkeenan [...] pobox.com>, Leon Timmermans <fawaka [...] gmail.com>
Subject: Re: [perl #132560] perl-5.24.3, wrong Configure test for IPC_STAT
Download (untitled) / with headers
text/plain 3.5k
Added James and Leon to To: as my mails do not seem to arrive in p5p On Sun, 10 Dec 2017 09:19:47 -0800, (via RT) <perlbug-followup@perl.org> wrote: Show quoted text
> # Please include the string: [perl #132560] > # <URL: https://rt.perl.org/Ticket/Display.html?id=132560 > > ----------------------------------------------------------------- > in perl Configure script there is this test for IPC_STAT:
That is unit U/modified/d_union_semun.U, which you can find here: https://github.com/perl5-metaconfig/metaconfig/blob/master/U/modified/d_union_semun.U#L176 Show quoted text
> #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.
If I read the rest of the unit, combined with your rem,arks, that makes me think this ought to fix it: --8<--- diff --git a/U/modified/d_union_semun.U b/U/modified/d_union_semun.U index 55f224f..6ddad1a 100644 --- a/U/modified/d_union_semun.U +++ b/U/modified/d_union_semun.U @@ -184,21 +184,31 @@ END extern int errno; #endif int main() { - struct semid_ds arg; + union semun +#ifndef HAS_UNION_SEMUN + { + int val; + struct semid_ds *buf; + unsigned short *array; + } +#endif + arg; + struct semid_ds argbuf; int sem, st; #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT) sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT); if (sem > -1) { + arg.buf = &argbuf; # ifdef IPC_STAT - st = semctl(sem, 0, IPC_STAT, &arg); + 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) + if (semctl(sem, 0, IPC_RMID, arg) != 0) # endif /* IPC_RMID */ printf("semctl IPC_RMID failed: errno = %d\n", errno); } else -->8--- Do people with more knowledge on semctl agree? -- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using perl5.00307 .. 5.27 porting perl5 on HP-UX, AIX, and openSUSE http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/

Message body is not shown because sender requested not to inline it.

Download (untitled)
application/pgp-signature 473b

Message body not shown because it is not plain text.

To: perl5-porters [...] perl.org, James E Keenan <jkeenan [...] pobox.com>, Leon Timmermans <fawaka [...] gmail.com>, Karl Williamson <public [...] khwilliamson.com>
Subject: Re: [perl #132560] perl-5.24.3, wrong Configure test for IPC_STAT
From: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
Date: Thu, 12 Apr 2018 15:09:49 +0200
Download (untitled) / with headers
text/plain 4.1k
Karl, finally an update from me :) Sorry it took so long ... On Thu, 29 Mar 2018 16:23:10 +0200, "H.Merijn Brand" <h.m.brand@xs4all.nl> wrote: Show quoted text
> Added James and Leon to To: as my mails do not seem to arrive in p5p
Ping? As this is the last hurdle before Configure is back to sync again with META/DIST, I'd like some feedback. The rest of the issues is now resolved and push to meta If I commit this, Karl can continue with his LANGINFO work Show quoted text
> On Sun, 10 Dec 2017 09:19:47 -0800, (via RT) <perlbug-followup@perl.org> wrote: >
> > # Please include the string: [perl #132560] > > # <URL: https://rt.perl.org/Ticket/Display.html?id=132560 > > > ----------------------------------------------------------------- > > in perl Configure script there is this test for IPC_STAT:
> > That is unit U/modified/d_union_semun.U, which you can find here: > https://github.com/perl5-metaconfig/metaconfig/blob/master/U/modified/d_union_semun.U#L176 >
> > #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.
> > If I read the rest of the unit, combined with your rem,arks, that makes > me think this ought to fix it: > > --8<--- > diff --git a/U/modified/d_union_semun.U b/U/modified/d_union_semun.U > index 55f224f..6ddad1a 100644 > --- a/U/modified/d_union_semun.U > +++ b/U/modified/d_union_semun.U > @@ -184,21 +184,31 @@ END > extern int errno; > #endif > int main() { > - struct semid_ds arg; > + union semun > +#ifndef HAS_UNION_SEMUN > + { > + int val; > + struct semid_ds *buf; > + unsigned short *array; > + } > +#endif > + arg; > + struct semid_ds argbuf; > int sem, st; > > #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT) > sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT); > if (sem > -1) { > + arg.buf = &argbuf; > # ifdef IPC_STAT > - st = semctl(sem, 0, IPC_STAT, &arg); > + 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) > + if (semctl(sem, 0, IPC_RMID, arg) != 0) > # endif /* IPC_RMID */ > printf("semctl IPC_RMID failed: errno = %d\n", errno); > } else > -->8--- > > > Do people with more knowledge on semctl agree? >
-- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using perl5.00307 .. 5.27 porting perl5 on HP-UX, AIX, and openSUSE http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
Download (untitled)
application/pgp-signature 473b

Message body not shown because it is not plain text.

Subject: Re: [perl #132560] perl-5.24.3, wrong Configure test for IPC_STAT
CC: Perl5 Porters <perl5-porters [...] perl.org>, James E Keenan <jkeenan [...] pobox.com>
From: Leon Timmermans <fawaka [...] gmail.com>
To: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
Date: Sat, 14 Apr 2018 01:15:43 +0200
Download (untitled) / with headers
text/plain 3.8k
On Thu, Mar 29, 2018 at 4:23 PM, H.Merijn Brand <h.m.brand@xs4all.nl> wrote: Show quoted text
> Added James and Leon to To: as my mails do not seem to arrive in p5p > > On Sun, 10 Dec 2017 09:19:47 -0800, (via RT) <perlbug-followup@perl.org> wrote: >
>> # Please include the string: [perl #132560] >> # <URL: https://rt.perl.org/Ticket/Display.html?id=132560 > >> ----------------------------------------------------------------- >> in perl Configure script there is this test for IPC_STAT:
> > That is unit U/modified/d_union_semun.U, which you can find here: > https://github.com/perl5-metaconfig/metaconfig/blob/master/U/modified/d_union_semun.U#L176 >
>> #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.
> > If I read the rest of the unit, combined with your rem,arks, that makes > me think this ought to fix it: > > --8<--- > diff --git a/U/modified/d_union_semun.U b/U/modified/d_union_semun.U > index 55f224f..6ddad1a 100644 > --- a/U/modified/d_union_semun.U > +++ b/U/modified/d_union_semun.U > @@ -184,21 +184,31 @@ END > extern int errno; > #endif > int main() { > - struct semid_ds arg; > + union semun > +#ifndef HAS_UNION_SEMUN > + { > + int val; > + struct semid_ds *buf; > + unsigned short *array; > + } > +#endif > + arg; > + struct semid_ds argbuf; > int sem, st; > > #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT) > sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT); > if (sem > -1) { > + arg.buf = &argbuf; > # ifdef IPC_STAT > - st = semctl(sem, 0, IPC_STAT, &arg); > + 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) > + if (semctl(sem, 0, IPC_RMID, arg) != 0) > # endif /* IPC_RMID */ > printf("semctl IPC_RMID failed: errno = %d\n", errno); > } else > -->8--- > > > Do people with more knowledge on semctl agree?
Yeah, this looks sensible, as far as anything dealing with semctl can ever look sensible. The old code takes a shortcut by assuming a pointer type and a union containing that pointer type (and nothing bigger) are equivalent when passed as an argument to a varargs function. I'm not sure why they're apparently not on ppc32, but the C standard defines rather little about unions anyway. Leon


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org