Blob Blame History Raw
Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 gcl (2.6.12-37) unstable; urgency=medium
 .
   * Version_2_6_13pre49
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2016-10-04

--- gcl-2.6.12.orig/o/array.c
+++ gcl-2.6.12/o/array.c
@@ -850,31 +850,33 @@ raw_aet_ptr(object x, short int typ)
 	*/     
 
 void
-gset(void *p1, void *val, int n, int typ)
-{ if (val==0)
+gset(void *p1, void *val, int n, int typ) {
+
+  if (val==0)
     val = aet_types[typ].dflt;
-    switch (typ){
+
+  switch (typ){
 
 #define GSET(p,n,typ,val) {typ x = *((typ *) val); GSET1(p,n,typ,x)}
-#define GSET1(p,n,typ,val) while (n-- > 0) \
+#define GSET1(p,n,typ,val) while (n-- > 0)	\
       { *((typ *) p) = val; \
-	  p = p + sizeof(typ); \
-	  } break;
+	p = p + sizeof(typ);			\
+      } break;
 
-    case aet_object: GSET(p1,n,object,val);
-    case aet_ch:     GSET(p1,n,char,val);
-      /* Note n is number of fixnum WORDS for bit */
-    case aet_bit:    GSET(p1,n,fixnum,val);
-    case aet_fix:    GSET(p1,n,fixnum,val);
-    case aet_sf:     GSET(p1,n,shortfloat,val);
-    case aet_lf:     GSET(p1,n,longfloat,val);
-    case aet_char:   GSET(p1,n,char,val);
-    case aet_uchar:  GSET(p1,n,unsigned char,val);
-    case aet_short:  GSET(p1,n,short,val);
-    case aet_ushort: GSET(p1,n,unsigned short,val);
-    default:         FEerror("bad elttype",0);
-    }
+  case aet_object: GSET(p1,n,object,val);
+  case aet_ch:     GSET(p1,n,char,val);
+    /* Note n is number of fixnum WORDS for bit */
+  case aet_bit:    GSET(p1,n,fixnum,val);
+  case aet_fix:    GSET(p1,n,fixnum,val);
+  case aet_sf:     GSET(p1,n,shortfloat,val);
+  case aet_lf:     GSET(p1,n,longfloat,val);
+  case aet_char:   GSET(p1,n,char,val);
+  case aet_uchar:  GSET(p1,n,unsigned char,val);
+  case aet_short:  GSET(p1,n,short,val);
+  case aet_ushort: GSET(p1,n,unsigned short,val);
+  default:         FEerror("bad elttype",0);
   }
+}
 
 
 #define W_SIZE (BV_BITS*sizeof(fixnum))    
@@ -894,38 +896,43 @@ implementation dependent results.")
   int n1=fix(n1o),nc;
   if (VFUN_NARGS==4)
     { n1 = x->v.v_dim - i1;}
-  if (typ1==aet_bit)
-    {if (i1 % CHAR_SIZE)
-     badcopy:
-       FEerror("Bit copies only if aligned",0);
-    else
-      {int rest=n1%CHAR_SIZE;
-       if (rest!=0 )
-	 {if (typ2!=aet_bit)
-	    goto badcopy;
-	    {while(rest> 0)
-	       { fSaset1(y,i2+n1-rest,(fLrow_major_aref(x,i1+n1-rest)));
-		 rest--;}
-	     }}
-       i1=i1/CHAR_SIZE ;
-       n1=n1/CHAR_SIZE;
-       typ1=aet_char;
-     }};
-  if (typ2==aet_bit)
-    {if (i2 % CHAR_SIZE)
-       goto badcopy;
-       i2=i2/CHAR_SIZE ;}
-  if ((typ1 ==aet_object ||
-       typ2  ==aet_object) && typ1 != typ2)
+  if (typ1==aet_bit) {
+    if (i1 % CHAR_SIZE)
+    badcopy:
+      FEerror("Bit copies only if aligned",0);
+    else {
+      int rest=n1%CHAR_SIZE;
+      if (rest!=0) {
+	if (typ2!=aet_bit)
+	  goto badcopy;
+	while(rest> 0) {
+	  fSaset1(y,i2+n1-rest,(fLrow_major_aref(x,i1+n1-rest)));
+	  rest--;
+	}
+      }
+      i1=i1/CHAR_SIZE ;
+      n1=n1/CHAR_SIZE;
+      typ1=aet_char;
+    }
+  }
+
+  if (typ2==aet_bit) {
+    if (i2 % CHAR_SIZE)
+      goto badcopy;
+    i2=i2/CHAR_SIZE ;
+  }
+
+  if ((typ1 ==aet_object || typ2  ==aet_object) && typ1 != typ2)
     FEerror("Can't copy between different array types",0);
   nc=n1 * aet_sizes[(int)typ1];
-  if (i1+n1 > x->a.a_dim
-      || ((y->a.a_dim - i2) *aet_sizes[(int)typ2]) < nc)
+  if (i1+n1 > x->a.a_dim || ((y->a.a_dim - i2) *aet_sizes[(int)typ2]) < nc)
     FEerror("Copy  out of bounds",0);
   bcopy(x->ust.ust_self + (i1*aet_sizes[(int)typ1]),
 	y->ust.ust_self + (i2*aet_sizes[(int)typ2]),
 	nc);
+
   return x;
+
 }
 
 /* X is the header of an array.  This supplies the body which
--- gcl-2.6.12.orig/o/predicate.c
+++ gcl-2.6.12/o/predicate.c
@@ -744,14 +744,13 @@ BEGIN:
 	if (tx == t_complex)
 		return(contains_sharp_comma(x->cmp.cmp_real) ||
 		       contains_sharp_comma(x->cmp.cmp_imag));
-	if (tx == t_vector)
-	{
-		int i;
-	   if (x->v.v_elttype == aet_object)
-		for (i = 0;  i < x->v.v_fillp;  i++)
-			if (contains_sharp_comma(x->v.v_self[i]))
-				return(TRUE);
-		return(FALSE);
+	if (tx == t_vector) {
+	  int i;
+	  if (x->v.v_elttype == aet_object)
+	    for (i = 0;  i < x->v.v_fillp;  i++)
+	      if (contains_sharp_comma(x->v.v_self[i]))
+		return(TRUE);
+	  return(FALSE);
 	}
 	if (tx == t_cons) {
 		if (x->c.c_car == siSsharp_comma)
--- gcl-2.6.12.orig/o/unixsys.c
+++ gcl-2.6.12/o/unixsys.c
@@ -32,25 +32,39 @@ int
 vsystem(const char *command) {
 
   unsigned j,n=strlen(command)+1;
-  char *z=alloca(n),**p1,**pp,*c;
+  char *z,*c;
+  const char *x1[]={"/bin/sh","-c",NULL,NULL},*spc=" \n\t",**p1,**pp;
   int s;
   pid_t pid;
 
-  memcpy(z,command,n);
-  for (j=1,c=z;strtok(c," \n\t");c=NULL,j++);
+  if (strpbrk(command,"\"'$<>"))
 
-  memcpy(z,command,n);
-  p1=alloca(j*sizeof(*p1));
-  for (pp=p1,c=z;(*pp=strtok(c," \n\t"));c=NULL,pp++);
+    (p1=x1)[2]=command;
+
+  else {
+
+    z=alloca(n);
+    memcpy(z,command,n);
+    for (j=1,c=z;strtok(c,spc);c=NULL,j++);
+
+    memcpy(z,command,n);
+    p1=alloca(j*sizeof(*p1));
+    for (pp=p1,c=z;(*pp=strtok(c,spc));c=NULL,pp++);
+
+  }
 
   if (!(pid=vfork())) {
-    execvp(*p1,p1);
-    _exit(2);
+    errno=0;
+    execvp(*p1,(void *)p1);
+    _exit(128|(errno&0x7f));
   }
 
   massert(pid>0);
   massert(pid==waitpid(pid,&s,0));
 
+  if ((s>>8)&128)
+    emsg("execvp failure when executing '%s': %s\n",command,strerror((s>>8)&0x7f));
+
   return s;
 
 }