summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Bunce <TimBunce@ig.ac.uk>1998-05-15 14:18:52 +0000
committerTim Bunce <TimBunce@ig.ac.uk>1998-05-15 14:18:52 +0000
commit782b2911f3789f274063c2176a93a5520f0f74dd (patch)
tree600de20596faaf1d3d7a5331e2aef67c4e90376b
parentc8aee7092c0ad4af36b59e106cbf6e876af31cea (diff)
parent7d3b49c79266655e0e1f4f890c80e8e09a10eaa7 (diff)
downloadperl-782b2911f3789f274063c2176a93a5520f0f74dd.tar.gz
[differences between patch application from Change 982 and Change 984]
------ CORE LANGUAGE ------ Title: "Fix close pipe returning status from wrong child" From: "M.J.T. Guy" <mjtg@cus.cam.ac.uk>, kstar@chapin.edu@ig.co.uk () Msg-ID: <199805142313.TAA02684@chapin.edu>, <E0yZ8ah-0005d8-00@taurus.cus.cam.ac.uk> Files: t/io/pipe.t util.c Title: "Avoid English.pm triggering load of Errno.pm" From: Tim Bunce Files: gv.c lib/English.pm ------ EXTENSIONS ------ Title: "BSD Platforms need STRUCT_TM_HASZONE for POSIX" From: Andy Dougherty <doughera@lafcol.lafayette.edu> Msg-ID: <Pine.SUN.3.96.980512095524.8158C-100000@newton.phys> Files: MANIFEST ext/POSIX/hints/bsdos.pl ext/POSIX/hints/freebsd.pl ext/POSIX/hints/netbsd.pl ext/POSIX/hints/openbsd.pl ------ TESTS ------ Title: "Fix constant detection in t/op/ipcsem.t for Digit UNIX" From: Jarkko Hietaniemi <jhi@iki.fi> Msg-ID: <199805121212.PAA15351@alpha.hut.fi> Files: t/op/ipcsem.t Title: "Fix doc bug for system() return value" From: Daniel Grisinger <dgris@perrin.dimensional.com> Msg-ID: <Pine.LNX.3.96.980514165608.4062A-100000@perrin.dimensional.com> Files: pod/perlfunc.pod t/op/exec.t ------ UTILITIES ------ Title: "Avoid possible constant autoload loop" From: "M.J.T. Guy" <mjtg@cus.cam.ac.uk>, Graham Barr <gbarr@ti.com>, Ilya Zakharevich <ilya@math.ohio-state.edu> Msg-ID: <199805141910.PAA26994@monk.mps.ohio-state.edu>, <355B475A.C5AD4B90@ti.com>, <E0ya11X-0000hm-00@taurus.cus.cam.ac.uk> Files: utils/h2xs.PL (applied based on p5p message as 483d93a08418d963f1cf43997ab37a2ebc55f2ff, this change contains the difference) p4raw-link: @982 on //depot/maint-5.004/perl: c5ed518aab0e5c6006080a87273e79a1b8e0d48b p4raw-id: //depot/maint-5.004/perl@984
-rw-r--r--MANIFEST4
-rw-r--r--ext/POSIX/hints/bsdos.pl3
-rw-r--r--ext/POSIX/hints/freebsd.pl3
-rw-r--r--ext/POSIX/hints/netbsd.pl3
-rw-r--r--ext/POSIX/hints/openbsd.pl3
-rw-r--r--gv.c4
-rw-r--r--lib/English.pm4
-rw-r--r--pod/perlfunc.pod2
-rwxr-xr-xt/io/pipe.t26
-rwxr-xr-xt/op/exec.t2
-rwxr-xr-xt/op/ipcsem.t38
-rw-r--r--util.c7
-rw-r--r--utils/h2xs.PL2
13 files changed, 80 insertions, 21 deletions
diff --git a/MANIFEST b/MANIFEST
index f3208c4bce..59341059c1 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -175,8 +175,12 @@ ext/POSIX/Makefile.PL POSIX extension makefile writer
ext/POSIX/POSIX.pm POSIX extension Perl module
ext/POSIX/POSIX.pod POSIX extension documentation
ext/POSIX/POSIX.xs POSIX extension external subroutines
+ext/POSIX/hints/bsdos.pl Hint for POSIX for named architecture
+ext/POSIX/hints/freebsd.pl Hint for POSIX for named architecture
ext/POSIX/hints/linux.pl Hint for POSIX for named architecture
+ext/POSIX/hints/netbsd.pl Hint for POSIX for named architecture
ext/POSIX/hints/next_3.pl Hint for POSIX for named architecture
+ext/POSIX/hints/openbsd.pl Hint for POSIX for named architecture
ext/POSIX/hints/sunos_4.pl Hint for POSIX for named architecture
ext/POSIX/typemap POSIX extension interface types
ext/SDBM_File/Makefile.PL SDBM extension makefile writer
diff --git a/ext/POSIX/hints/bsdos.pl b/ext/POSIX/hints/bsdos.pl
new file mode 100644
index 0000000000..62732ac7b9
--- /dev/null
+++ b/ext/POSIX/hints/bsdos.pl
@@ -0,0 +1,3 @@
+# BSD platforms have extra fields in struct tm that need to be initialized.
+# XXX A Configure test is needed.
+$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE' ;
diff --git a/ext/POSIX/hints/freebsd.pl b/ext/POSIX/hints/freebsd.pl
new file mode 100644
index 0000000000..62732ac7b9
--- /dev/null
+++ b/ext/POSIX/hints/freebsd.pl
@@ -0,0 +1,3 @@
+# BSD platforms have extra fields in struct tm that need to be initialized.
+# XXX A Configure test is needed.
+$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE' ;
diff --git a/ext/POSIX/hints/netbsd.pl b/ext/POSIX/hints/netbsd.pl
new file mode 100644
index 0000000000..62732ac7b9
--- /dev/null
+++ b/ext/POSIX/hints/netbsd.pl
@@ -0,0 +1,3 @@
+# BSD platforms have extra fields in struct tm that need to be initialized.
+# XXX A Configure test is needed.
+$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE' ;
diff --git a/ext/POSIX/hints/openbsd.pl b/ext/POSIX/hints/openbsd.pl
new file mode 100644
index 0000000000..62732ac7b9
--- /dev/null
+++ b/ext/POSIX/hints/openbsd.pl
@@ -0,0 +1,3 @@
+# BSD platforms have extra fields in struct tm that need to be initialized.
+# XXX A Configure test is needed.
+$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE' ;
diff --git a/gv.c b/gv.c
index 3081a51bd7..d532b94a31 100644
--- a/gv.c
+++ b/gv.c
@@ -743,7 +743,7 @@ I32 sv_type;
case '!':
if(len > 1)
break;
- if(sv_type == SVt_PVHV) {
+ if(sv_type > SVt_PV) {
HV* stash = gv_stashpvn("Errno",5,FALSE);
if(!stash || !(gv_fetchmethod(stash, "TIEHASH"))) {
dSP;
@@ -752,7 +752,7 @@ I32 sv_type;
SPAGAIN;
stash = gv_stashpvn("Errno",5,FALSE);
if (!stash || !(gv_fetchmethod(stash, "TIEHASH")))
- croak("%! is not avaliable on this machine");
+ croak("Can't use %%! because Errno.pm is not avaliable");
}
}
goto magicalize;
diff --git a/lib/English.pm b/lib/English.pm
index bbb6bd7b28..1cbacd11f8 100644
--- a/lib/English.pm
+++ b/lib/English.pm
@@ -137,8 +137,8 @@ sub import {
# Error status.
*CHILD_ERROR = *? ;
- *OS_ERROR = *! ;
- *ERRNO = *! ;
+ *OS_ERROR = \$! ;
+ *ERRNO = \$! ;
*EXTENDED_OS_ERROR = *^E ;
*EVAL_ERROR = *@ ;
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index e11edc515b..6176b0fb7c 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -3653,7 +3653,7 @@ signals and core dumps.
# forked, so the errno value is not visible in the parent.
printf "command failed: %s\n", ($! || "Unknown system() error");
}
- elsif ($rc > 0x80) {
+ elsif (($rc & 0xff) == 0) {
$rc >>= 8;
print "ran with non-zero exit status $rc\n";
}
diff --git a/t/io/pipe.t b/t/io/pipe.t
index ac149810ec..55813912f4 100755
--- a/t/io/pipe.t
+++ b/t/io/pipe.t
@@ -13,7 +13,7 @@ BEGIN {
}
$| = 1;
-print "1..10\n";
+print "1..12\n";
open(PIPE, "|-") || (exec 'tr', 'YX', 'ko');
print PIPE "Xk 1\n";
@@ -25,6 +25,7 @@ if (open(PIPE, "-|")) {
s/^not //;
print;
}
+ close PIPE; # avoid zombies which disrupt test 12
}
else {
print STDOUT "not ok 3\n";
@@ -40,6 +41,7 @@ if ($pid = fork) {
y/A-Z/a-z/;
print;
}
+ close READER; # avoid zombies which disrupt test 12
}
else {
die "Couldn't fork" unless defined $pid;
@@ -66,11 +68,13 @@ close WRITER;
print "ok 8\n";
# VMS doesn't like spawning subprocesses that are still connected to
-# STDOUT. Someone should modify tests #9 and #10 to work with VMS.
+# STDOUT. Someone should modify tests #9 to #12 to work with VMS.
if ($^O eq 'VMS') {
print "ok 9\n";
print "ok 10\n";
+ print "ok 11\n";
+ print "ok 12\n";
exit;
}
@@ -108,3 +112,21 @@ elsif ($? == 0) {
else {
print "ok 10\n";
}
+
+# check that status for the correct process is collected
+my $zombie = fork or exit 37;
+my $pipe = open *FH, "sleep 2;exit 13|" or die "Open: $!\n";
+$SIG{ALRM} = sub { return };
+alarm(1);
+my $close = close FH;
+if ($? == 13*256 && ! length $close && ! $!) {
+ print "ok 11\n";
+} else {
+ print "not ok 11\n# close $close\$?=$? \$!=", $!+0, ":$!\n";
+};
+my $wait = wait;
+if ($? == 37*256 && $wait == $zombie && ! $!) {
+ print "ok 12\n";
+} else {
+ print "not ok 12\n# pid=$wait \$?=$? \$!=", $!+0, ":$!\n";
+}
diff --git a/t/op/exec.t b/t/op/exec.t
index 7dfcd6177f..506fc09fbd 100755
--- a/t/op/exec.t
+++ b/t/op/exec.t
@@ -6,6 +6,7 @@ $| = 1; # flush stdout
if ($^O eq 'MSWin32') {
print "# exec is unsupported on Win32\n";
+ # XXX the system tests could be written to use ./perl and so work on Win32
print "1..0\n";
exit(0);
}
@@ -16,6 +17,7 @@ print "not ok 1\n" if system "echo ok \\1"; # shell interpreted
print "not ok 2\n" if system "echo ok 2"; # split and directly called
print "not ok 3\n" if system "echo", "ok", "3"; # directly called
+# these should probably be rewritten to match the examples in perlfunc.pod
if (system "true") {print "not ok 4\n";} else {print "ok 4\n";}
if ((system "/bin/sh -c 'exit 1'") != 256) { print "not "; }
diff --git a/t/op/ipcsem.t b/t/op/ipcsem.t
index f3f6e3ce4c..73b8a8f351 100755
--- a/t/op/ipcsem.t
+++ b/t/op/ipcsem.t
@@ -30,12 +30,15 @@ BEGIN {
print "1..0\n";
exit;
}
+
+ use strict;
+
my @incpath = (split(/\s+/, $Config{usrinc}), split(/\s+/ ,$Config{locincpth}));
my %done = ();
my %define = ();
sub process_file {
- my($file) = @_;
+ my($file,$level) = @_;
return unless defined $file;
@@ -51,40 +54,55 @@ BEGIN {
return if exists $done{$path};
$done{$path} = 1;
- unless(defined $path) {
+ if(not defined $path and $level == 0) {
warn "Cannot find '$file'";
return;
}
+ local(*F);
open(F,$path) or return;
+ $level = 1 unless defined $level;
+ my $indent = " " x $level;
+ print "#$indent open $path\n";
while(<F>) {
s#/\*.*(\*/|$)##;
- process_file($mm,$1)
- if /^#\s*include\s*[<"]([^>"]+)[>"]/;
+ if ( /^#\s*include\s*[<"]([^>"]+)[>"]/ ) {
+ print "#${indent} include $1\n";
+ process_file($1,$level+1);
+ print "#${indent} done include $1\n";
+ print "#${indent} back in $path\n";
+ }
s/(?:\([^)]*\)\s*)//;
- $define{$1} = $2
- if /^#\s*define\s+(\w+)\s+((0x)?\d+|\w+)/;
+ if ( /^#\s*define\s+(\w+)\s+(\w+)/ ) {
+ print "#${indent} define $1 $2\n";
+ $define{$1} = $2;
+ }
}
close(F);
+ print "#$indent close $path\n";
}
process_file("sys/sem.h");
process_file("sys/ipc.h");
process_file("sys/stat.h");
- foreach $d (@define) {
+ foreach my $d (@define) {
while(defined($define{$d}) && $define{$d} !~ /^(0x)?\d+$/) {
$define{$d} = exists $define{$define{$d}}
? $define{$define{$d}} : undef;
}
unless(defined $define{$d}) {
- print "0..0\n";
+ print "# $d undefined\n";
+ print "1..0\n";
exit;
- };
- ${ $d } = eval $define{$d};
+ }
+ {
+ no strict 'refs';
+ ${ $d } = eval $define{$d};
+ }
}
}
diff --git a/util.c b/util.c
index 41c191144a..0eaa18feed 100644
--- a/util.c
+++ b/util.c
@@ -2008,6 +2008,7 @@ PerlIO *ptr;
int status;
SV **svp;
int pid;
+ int pid2;
bool close_failed;
int saved_errno;
#ifdef VMS
@@ -2042,8 +2043,8 @@ PerlIO *ptr;
rsignal_save(SIGINT, SIG_IGN, &istat);
rsignal_save(SIGQUIT, SIG_IGN, &qstat);
do {
- pid = wait4pid(pid, &status, 0);
- } while (pid == -1 && errno == EINTR);
+ pid2 = wait4pid(pid, &status, 0);
+ } while (pid2 == -1 && errno == EINTR);
rsignal_restore(SIGHUP, &hstat);
rsignal_restore(SIGINT, &istat);
rsignal_restore(SIGQUIT, &qstat);
@@ -2051,7 +2052,7 @@ PerlIO *ptr;
SETERRNO(saved_errno, saved_vaxc_errno);
return -1;
}
- return(pid < 0 ? pid : status == 0 ? 0 : (errno = 0, status));
+ return(pid2 < 0 ? pid2 : status == 0 ? 0 : (errno = 0, status));
}
#endif /* !DOSISH */
diff --git a/utils/h2xs.PL b/utils/h2xs.PL
index 7d1a0da1f4..97d3ceded3 100644
--- a/utils/h2xs.PL
+++ b/utils/h2xs.PL
@@ -497,7 +497,7 @@ sub AUTOLOAD {
croak "Your vendor has not defined $module macro \$constname";
}
}
- eval "sub \$AUTOLOAD { \$val }";
+ *\$AUTOLOAD = sub () { \$val };
goto &\$AUTOLOAD;
}