perl 3.0 patch #15

Larry Wall lwall at jpl-devvax.JPL.NASA.GOV
Thu Mar 15 06:46:05 AEST 1990


System: perl version 3.0
Patch #: 15
Priority: HIGH, alas
Subject: commands involving execs could cause malloc arena corruption
Subject: dumpvar.pl was missing final 1;
Subject: termcap.pl didn't interpret ^x right
Subject: man page falsely states that you can't subscript array values
Subject: t/op.sleep could fail occasionally

Description:
	In patch 13, there was a fix to make the VAR=value construct
	in a command force interpretation by the shell.  This was botched,
	causing an argv list to be occasionally allocated with too small
	a size.  This problem is hidden on some machines because of
	BSD malloc's semantics.

	The lib/dumpvar.pl file was missing final 1; which made it
	difficult to tell if it loaded right.

	The lib/termcap.pl Tgetent subroutine didn't interpret ^x right
	due to a missing ord().

	In the section of the man page that gives hints for C programmers,
	it falsely declared that you can't subscript array values.  As of
	patch 13, this statement is "inoperative".

	The t/op.sleep test assumed that a sleep of 2 seconds would always
	return a value of 2 seconds slept.  Depending on the load and
	the whimsey of the scheduler, it could actually sleep longer than
	2 seconds upon occasion.  It now allows sleeps of up to 10 seconds.

Fix:	From rn, say "| patch -p -N -d DIR", where DIR is your perl source
	directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
	If you don't have the patch program, apply the following by hand,
	or get patch (version 2.0, latest patchlevel).

	After patching:
		make
		make test
		make install

	If patch indicates that patchlevel is the wrong version, you may need
	to apply one or more previous patches, or the patch may already
	have been applied.  See the patchlevel.h file to find out what has or
	has not been applied.  In any event, don't continue with the patch.

	If you are missing previous patches they can be obtained from me:

	Larry Wall
	lwall at jpl-devvax.jpl.nasa.gov

	If you send a mail message of the following form it will greatly speed
	processing:

	Subject: Command
	@SH mailpatch PATH perl 3.0 LIST
		   ^ note the c

	where PATH is a return path FROM ME TO YOU either in Internet notation,
	or in bang notation from some well-known host, and LIST is the number
	of one or more patches you need, separated by spaces, commas, and/or
	hyphens.  Saying 35- says everything from 35 to the end.


	You can also get the patches via anonymous FTP from
	jpl-devvax.jpl.nasa.gov (128.149.1.143).

NOTE: if patchlevel.h is saying that you are at patchlevel 12, and you thought
you ftp'd patchlevel 14 kits from my machine, you probably did.  In the 24
hour period after patches 13 and 14 came out, the kits in the ftp directory
erroneously said patchlevel 12.  People who have been applying the patches
all along should not have this problem.  If you do, edit your patchlevel.h
file to say 14 instead of 12 before applying this patch.

Index: patchlevel.h
Prereq: 14
1c1
< #define PATCHLEVEL 14
---
> #define PATCHLEVEL 15

Index: doio.c
Prereq: 3.0.1.6
*** doio.c.old	Wed Mar 14 12:32:03 1990
--- doio.c	Wed Mar 14 12:32:08 1990
***************
*** 1,4 ****
! /* $Header: doio.c,v 3.0.1.6 90/03/12 16:30:07 lwall Locked $
   *
   *    Copyright (c) 1989, Larry Wall
   *
--- 1,4 ----
! /* $Header: doio.c,v 3.0.1.7 90/03/14 12:26:24 lwall Locked $
   *
   *    Copyright (c) 1989, Larry Wall
   *
***************
*** 6,11 ****
--- 6,14 ----
   *    as specified in the README file that comes with the perl 3.0 kit.
   *
   * $Log:	doio.c,v $
+  * Revision 3.0.1.7  90/03/14  12:26:24  lwall
+  * patch15: commands involving execs could cause malloc arena corruption
+  * 
   * Revision 3.0.1.6  90/03/12  16:30:07  lwall
   * patch13: system 'FOO=bar command' didn't invoke sh as it should
   * 
***************
*** 931,936 ****
--- 934,942 ----
  
      /* see if there are shell metacharacters in it */
  
+     for (s = cmd; *s && isalpha(*s); s++) ;	/* catch VAR=val gizmo */
+     if (*s == '=')
+ 	goto doshell;
      for (s = cmd; *s; s++) {
  	if (*s != ' ' && !isalpha(*s) && index("$&*(){}[]'\";\\|?<>~`\n",*s)) {
  	    if (*s == '\n' && !s[1]) {
***************
*** 942,950 ****
  	    return FALSE;
  	}
      }
-     for (s = cmd; *s && isalpha(*s); s++) ;	/* catch VAR=val gizmo */
-     if (*s == '=')
- 	goto doshell;
      New(402,argv, (s - cmd) / 2 + 2, char*);
  
      a = argv;
--- 948,953 ----

Index: lib/dumpvar.pl
*** lib/dumpvar.pl.old	Wed Mar 14 12:32:18 1990
--- lib/dumpvar.pl	Wed Mar 14 12:32:20 1990
***************
*** 26,28 ****
--- 26,30 ----
  	}
      }
  }
+ 
+ 1;

Index: t/op.sleep
Prereq: 3.0
*** t/op.sleep.old	Wed Mar 14 12:33:03 1990
--- t/op.sleep	Wed Mar 14 12:33:04 1990
***************
*** 1,8 ****
  #!./perl
  
! # $Header: op.sleep,v 3.0 89/10/18 15:31:15 lwall Locked $
  
  print "1..1\n";
  
  $x = sleep 2;
! if ($x == 2) {print "ok 1\n";} else {print "not ok 1\n";}
--- 1,8 ----
  #!./perl
  
! # $Header: op.sleep,v 3.0.1.1 90/03/14 12:31:39 lwall Locked $
  
  print "1..1\n";
  
  $x = sleep 2;
! if ($x >= 2 && $x <= 10) {print "ok 1\n";} else {print "not ok 1 $x\n";}

Index: perl.man.4
Prereq: 3.0.1.6
*** perl.man.4.old	Wed Mar 14 12:32:46 1990
--- perl.man.4	Wed Mar 14 12:32:53 1990
***************
*** 1,7 ****
  ''' Beginning of part 4
! ''' $Header: perl.man.4,v 3.0.1.6 90/03/12 16:54:04 lwall Locked $
  '''
  ''' $Log:	perl.man.4,v $
  ''' Revision 3.0.1.6  90/03/12  16:54:04  lwall
  ''' patch13: improved documentation of *name
  ''' 
--- 1,10 ----
  ''' Beginning of part 4
! ''' $Header: perl.man.4,v 3.0.1.7 90/03/14 12:29:50 lwall Locked $
  '''
  ''' $Log:	perl.man.4,v $
+ ''' Revision 3.0.1.7  90/03/14  12:29:50  lwall
+ ''' patch15: man page falsely states that you can't subscript array values
+ ''' 
  ''' Revision 3.0.1.6  90/03/12  16:54:04  lwall
  ''' patch13: improved documentation of *name
  ''' 
***************
*** 1458,1465 ****
  The \*(L"system\*(R" calls link, unlink, rename, etc. return nonzero for success, not 0.
  .Ip * 4 2
  Signal handlers deal with signal names, not numbers.
- .Ip * 4 2
- You can't subscript array values, only arrays (no $x = (1,2,3)[2];).
  .PP
  Seasoned
  .I sed
--- 1461,1466 ----

Index: lib/termcap.pl
Prereq: 3.0.1.1
*** lib/termcap.pl.old	Wed Mar 14 12:32:25 1990
--- lib/termcap.pl	Wed Mar 14 12:32:26 1990
***************
*** 1,4 ****
! ;# $Header: termcap.pl,v 3.0.1.1 90/02/28 17:46:44 lwall Locked $
  ;#
  ;# Usage:
  ;#	do 'ioctl.pl';
--- 1,4 ----
! ;# $Header: termcap.pl,v 3.0.1.2 90/03/14 12:28:28 lwall Locked $
  ;#
  ;# Usage:
  ;#	do 'ioctl.pl';
***************
*** 70,76 ****
  	    s/\\f/\f/g;
  	    s/\\\^/\377/g;
  	    s/\^\?/\177/g;
! 	    s/\^(.)/pack('c',$1 & 31)/eg;
  	    s/\\(.)/$1/g;
  	    s/\377/^/g;
  	    $TC{$entry} = $_ if $TC{$entry} eq '';
--- 70,76 ----
  	    s/\\f/\f/g;
  	    s/\\\^/\377/g;
  	    s/\^\?/\177/g;
! 	    s/\^(.)/pack('c',ord($1) & 31)/eg;
  	    s/\\(.)/$1/g;
  	    s/\377/^/g;
  	    $TC{$entry} = $_ if $TC{$entry} eq '';



More information about the Comp.sources.bugs mailing list