Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
2.09k stars 577 forks source link

Not OK: perl v5.7.0 +SUIDMAIL +DEVEL6680 on os2-64int 2.30 (UNINSTALLED) #2392

Closed p5pRT closed 21 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#3739 (status was 'resolved')

Searchable as RT3739$

p5pRT commented 24 years ago

From @ysth

op/fork..............PROG​: if ($pid = fork()) {   print "forked first kid\n";   print "waitpid() returned ok\n" if waitpid($pid\,0) == $pid; } else {   print "first child\n";   exit(0); } if ($pid = fork()) {   print "forked second kid\n";   print "wait() returned ok\n" if wait() == $pid; } else {   print "second child\n";   exit(0); } EXPECTED​: forked first kid first child waitpid() returned ok forked second kid second child wait() returned ok GOT​: first child forked first kid waitpid() returned ok second child forked first kid waitpid() returned ok forked second kid wait() returned ok FAILED at test 17

Perl Info ``` Flags: category=install severity=none Site configuration information for perl v5.7.0: Configured by sthoenna at Thu Aug 17 16:21:12 PDT 2000. Summary of my perl5 (revision 5.0 version 7 subversion 0) configuration: Platform: osname=os2, osvers=2.30, archname=os2-64int uname='os2 efn.org 2 2.30 i386 ' config_args='-de -Dprefix=d:/perl -Dusedevel -Duse64bitint -Aoptimize=-DDEBUGGING' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define use64bitint=define use64bitall=undef uselongdouble=undef usesocks=undef Compiler: cc='gcc', optimize='-O2 -fomit-frame-pointer -malign-loops=2 -malign-jumps=2 -malign-functions=2 -s -DDEBUGGING', gccversion=2.8.1, gccosandvers= cppflags='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. -D_EMX_CRT_REV_=63' ccflags ='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. -D_EMX_CRT_REV_=63' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=4, usemymalloc=y, prototype=define Linker and Libraries: ld='gcc', ldflags ='-Zexe -Zomf -Zmt -Zcrtdll -Zstack 32000' libpth=d:/emx/lib d:/emx/lib/mt libs=-lsocket -lm -lbsd libc=d:/emx/lib/mt/c_import.lib, so=dll, useshrplib=true, libperl=libperl.lib Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-Zdll', lddlflags='-Zdll -Zomf -Zmt -Zcrtdll -s' Locally applied patches: SUIDMAIL - fixes for suidperl security DEVEL6680 @INC for perl v5.7.0: lib d:/perl/lib/5.7.0/os2-64int d:/perl/lib/5.7.0 d:/perl/lib/site_perl/5.7.0/os2-64int d:/perl/lib/site_perl/5.7.0 d:/perl/lib/site_perl . Environment for perl v5.7.0: HOME=d:\home\sthoenna LANG=en_us LANGUAGE (unset) LD_LIBRARY_PATH=D:/perl-current LOGDIR (unset) PATH=d:\bin;C:\OS2;d:\perl\bin;C:\OS2\SYSTEM;C:\OS2\INSTALL;C:\;C:\OS2\MDOS;C:\OS2\APPS;C:\MMOS2;d:\os2apps\util;d:\DOSAPPS\UTIL;c:\sio;D:\WINDOWS;d:\pdksh;d:\emx\bin;d:\emacs\19.33\bin;d:\ispell PERL_BADLANG (unset) PERL_SH_DIR=d:\BIN SHELL=d:/bin/sh.exe ```
p5pRT commented 24 years ago

From @ysth

In article \200008180053\.e7I0r5h29919@​garcia\.efn\.org\, I wrote​:

op/fork..............PROG​: if ($pid = fork()) { print "forked first kid\n"; print "waitpid() returned ok\n" if waitpid($pid\,0) == $pid; } else { print "first child\n"; exit(0); } if ($pid = fork()) { print "forked second kid\n"; print "wait() returned ok\n" if wait() == $pid; } else { print "second child\n"; exit(0); } EXPECTED​: forked first kid first child waitpid() returned ok forked second kid second child wait() returned ok GOT​: first child forked first kid waitpid() returned ok second child forked first kid waitpid() returned ok forked second kid wait() returned ok FAILED at test 17

Here's a patch​:

Inline Patch ```diff --- t/op/fork.t.orig Thu Aug 17 16:09:26 2000 +++ t/op/fork.t Thu Aug 17 18:29:18 2000 @@ -375,6 +375,7 @@ pipe_from_fork pipe_to_fork ######## +$|=1; if ($pid = fork()) { print "forked first kid\n"; print "waitpid() returned ok\n" if waitpid($pid,0) == $pid; ```
p5pRT commented 24 years ago

From @gsar

On Thu\, 17 Aug 2000 17​:53​:05 PDT\, sthoenna@​efn.org wrote​:

op/fork..............PROG​: if ($pid = fork()) { print "forked first kid\n"; print "waitpid() returned ok\n" if waitpid($pid\,0) == $pid; } else { print "first child\n"; exit(0); } if ($pid = fork()) { print "forked second kid\n"; print "wait() returned ok\n" if wait() == $pid; } else { print "second child\n"; exit(0); } EXPECTED​: forked first kid first child waitpid() returned ok forked second kid second child wait() returned ok GOT​: first child forked first kid waitpid() returned ok second child forked first kid waitpid() returned ok forked second kid wait() returned ok FAILED at test 17

Looks like you've got the fork() buffering problem that afflicts people without a working fflush(NULL). Try adding $|=1 at the top of that test and see what happens.

Sarathy gsar@​ActiveState.com

p5pRT commented 24 years ago

From @jhi

On Thu\, Aug 17\, 2000 at 06​:49​:24PM -0700\, Gurusamy Sarathy wrote​:

On Thu\, 17 Aug 2000 17​:53​:05 PDT\, sthoenna@​efn.org wrote​:

op/fork..............PROG​: if ($pid = fork()) { print "forked first kid\n"; print "waitpid() returned ok\n" if waitpid($pid\,0) == $pid; } else { print "first child\n"; exit(0); } if ($pid = fork()) { print "forked second kid\n"; print "wait() returned ok\n" if wait() == $pid; } else { print "second child\n"; exit(0); } EXPECTED​: forked first kid first child waitpid() returned ok forked second kid second child wait() returned ok GOT​: first child forked first kid waitpid() returned ok second child forked first kid waitpid() returned ok forked second kid wait() returned ok FAILED at test 17

Looks like you've got the fork() buffering problem that afflicts people without a working fflush(NULL). Try adding $|=1 at the top of that test and see what happens.

Ummm\, but does that guarantee much anything about in which order the parent and the kid print their stuff?

p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

Jarkko Hietaniemi \jhi@​iki\.fi wrote

Ummm\, but does that guarantee much anything about in which order the parent and the kid print their stuff?

That was my reaction too when I looked at the test. But the test is sneakier than that - it sorts it's output before checking it.

Mike Guy

p5pRT commented 24 years ago

From @jhi

On Fri\, Aug 18\, 2000 at 01​:32​:00PM +0100\, Mike Guy wrote​:

Jarkko Hietaniemi \jhi@​iki\.fi wrote

Ummm\, but does that guarantee much anything about in which order the parent and the kid print their stuff?

That was my reaction too when I looked at the test. But the test is sneakier than that - it sorts it's output before checking it.

use D'oh;