Patches to some Perl 3.0 bugs

Guy Harris guy at auspex.auspex.com
Sat Sep 9 12:29:30 AEST 1989


Unofficial patches (which I'll forward to Larry Wall) for some problems:

1) a little problem "lint" caught in "cons.c".  "lint" is your friend.

*** cons.c.dist	Fri Sep  8 17:35:38 1989
--- cons.c	Fri Sep  8 18:46:26 1989
***************
*** 173,179 ****
      Newz(103,loc,258,CMD*);
      loc++;				/* lie a little */
      while (count--) {
! 	if ((cur->c_flags && CF_OPTIMIZE) == CFT_CCLASS) {
  	    for (i = 0; i <= 255; i++) {
  		if (!loc[i] && cur->c_short->str_ptr[i>>3] & (1 << (i&7))) {
  		    loc[i] = cur;
--- 173,179 ----
      Newz(103,loc,258,CMD*);
      loc++;				/* lie a little */
      while (count--) {
! 	if ((cur->c_flags & CF_OPTIMIZE) == CFT_CCLASS) {
  	    for (i = 0; i <= 255; i++) {
  		if (!loc[i] && cur->c_short->str_ptr[i>>3] & (1 << (i&7))) {
  		    loc[i] = cur;

2) One "#ifdef SYMLINK"/"#endif" was missed in "doio.c", causing Perl
   not to build on machines without "lstat".

*** doio.c.dist	Fri Sep  8 17:35:38 1989
--- doio.c	Fri Sep  8 18:47:26 1989
***************
*** 457,465 ****
--- 457,467 ----
      else {
  	str_sset(statname,ary->ary_array[sp]);
  	statstab = Nullstab;
+ #ifdef SYMLINK
  	if (arg->arg_type == O_LSTAT)
  	    i = lstat(str_get(statname),&statcache);
  	else
+ #endif
  	    i = stat(str_get(statname),&statcache);
  	if (i < 0)
  	    max = 0;

3) The "lstat()" function for which the "lstat"s were stuck in there in
   the first place seemed not to be recognized by the lexical analyzer. 
   (It also appears not to have been documented, but then again the
   BSD socket functions in Perl don't seem to be documented, either....)

*** toke.c.dist	Fri Sep  8 17:35:43 1989
--- toke.c	Fri Sep  8 18:49:16 1989
***************
*** 635,640 ****
--- 635,642 ----
  	    FUN2(O_LINK);
  	if (strEQ(d,"listen"))
  	    FOP2(O_LISTEN);
+ 	if (strEQ(d,"lstat"))
+ 	    FOP(O_LSTAT);
  	break;
      case 'm': case 'M':
  	SNARFWORD;

4) "vfork" interacts unpleasantly with register windows on SPARC
   machines.

5) "mypopen" required that the system have "dup2()"; some versions of
   UNIX do not but do have "fcntl" (S3, S5"R1", S5R2 - S5R3 has both).

*** eval.c.dist	Fri Sep  8 17:35:39 1989
--- eval.c	Fri Sep  8 17:51:15 1989
***************
*** 14,19 ****
--- 14,23 ----
  #include <signal.h>
  #include <errno.h>
  
+ #ifdef sparc
+ #  include <vfork.h>
+ #endif
+ 
  extern int errno;
  
  #ifdef VOIDSIG

*** util.c.dist	Fri Sep  8 17:35:44 1989
--- util.c	Fri Sep  8 19:02:10 1989
***************
*** 12,17 ****
--- 12,30 ----
  #include "perl.h"
  #include "errno.h"
  
+ #ifdef sparc
+ /*
+  * XXX - should be "#include <vfork.h>"; however, that doesn't seem
+  * to be sufficient to fix the problem, so we just #define "vfork"
+  * to be "fork"....
+  */
+ #define	vfork	fork
+ #endif
+ 
+ #ifdef FCNTL
+ #  include <fcntl.h>
+ #endif
+ 
  #ifdef VARARGS
  #  include <varargs.h>
  #endif
***************
*** 1001,1008 ****
  	this = !this;	/* swap this and that */
  	that = !this;
  	close(p[that]);
! 	if (p[this] != (*mode == 'r')) {
! 	    dup2(p[this], *mode == 'r');
  	    close(p[this]);
  	}
  	if (doexec) {
--- 1014,1026 ----
  	this = !this;	/* swap this and that */
  	that = !this;
  	close(p[that]);
! 	if (p[this] != this) {
! #ifdef FCNTL
! 	    close(this);
! 	    fcntl(p[this], F_DUPFD, this);
! #else
! 	    dup2(p[this], this);
! #endif
  	    close(p[this]);
  	}
  	if (doexec) {



More information about the Comp.sources.bugs mailing list