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-29) unstable; urgency=medium
 .
   * Version_2_6_13pre35; support latest binutils
   * Bug fix: "gcl ftbfs on amd64 and i386 with binutils from
     experimental", thanks to Matthias Klose (Closes: #803214).
Author: Camm Maguire <camm@debian.org>
Bug-Debian: https://bugs.debian.org/803214

---
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: <YYYY-MM-DD>

--- gcl-2.6.12.orig/cmpnew/gcl_cmpvs.lsp
+++ gcl-2.6.12/cmpnew/gcl_cmpvs.lsp
@@ -75,8 +75,8 @@
 (defun wt-vs* (vs)
   (wt "(" )(wt-vs vs) (wt "->c.c_car)"))
 
-(defun wt-ccb-vs (ccb-vs)
-  (wt "(fun->cc.cc_turbo[" (- *initial-ccb-vs* ccb-vs) "]->c.c_car)"))
+(defun wt-ccb-vs (ccb-vs);;FIXME harmonize *closure-p* with *clink*
+  (wt "(" (if *closure-p* "fun->cc.cc_turbo" "base0") "[" (- *initial-ccb-vs* ccb-vs) "]->c.c_car)"))
 
 (defun clink (vs) (setq *clink* vs))
 
--- gcl-2.6.12.orig/configure
+++ gcl-2.6.12/configure
@@ -7663,7 +7663,7 @@ fi
 if test "${enable_ansi+set}" = set; then :
   enableval=$enable_ansi;
 else
-  enable_ansi="no"
+  enable_ansi="yes"
 fi
 
 
--- gcl-2.6.12.orig/configure.in
+++ gcl-2.6.12/configure.in
@@ -2133,7 +2133,7 @@ AC_ARG_ENABLE(readline,
 
 # ansi lisp
 AC_ARG_ENABLE(ansi,[--enable-ansi builds a large gcl aiming for ansi compliance, 
-		    --disable-ansi builds the smaller traditional CLtL1 image],,enable_ansi="no")
+		    --disable-ansi builds the smaller traditional CLtL1 image],,enable_ansi="yes")
 
 if test "$enable_ansi" = "yes" ; then
 	SYSTEM=ansi_gcl
--- gcl-2.6.12.orig/o/alloc.c
+++ gcl-2.6.12/o/alloc.c
@@ -1241,7 +1241,7 @@ gcl_init_alloc(void *cs_start) {
 
     massert(!getrlimit(RLIMIT_STACK, &rl));
     if (rl.rlim_cur!=RLIM_INFINITY && (rl.rlim_max == RLIM_INFINITY || rl.rlim_max > rl.rlim_cur)) {
-      rl.rlim_cur = rl.rlim_max == RLIM_INFINITY ? rl.rlim_max : rl.rlim_max/64;
+      rl.rlim_cur = rl.rlim_max;
       massert(!setrlimit(RLIMIT_STACK,&rl));
     }
     cssize = rl.rlim_cur/sizeof(*cs_org) - sizeof(*cs_org)*CSGETA;
--- gcl-2.6.12.orig/o/file.d
+++ gcl-2.6.12/o/file.d
@@ -2407,17 +2407,18 @@ object x=Cnil;
    inPort = (myport == Cnil ? 0 : fix(Iis_fixnum(myport)));
    
 #ifdef BSD
+
   if (isServer && daemon != Cnil) {
 
     long pid,i;
     struct rlimit r;
-    struct sigaction sa;
+    struct sigaction sa,osa;
 
     sa.sa_handler=SIG_IGN;
     sa.sa_flags=SA_NOCLDWAIT;
     sigemptyset(&sa.sa_mask);
 
-    sigaction(SIGCHLD,&sa,NULL);
+    massert(!sigaction(SIGCHLD,&sa,&osa));
 
     switch((pid=pfork())) {
     case -1:
@@ -2425,8 +2426,7 @@ object x=Cnil;
       break;
     case 0:
 
-      if (setsid()<0)
-	FEerror("setsid error", 0);
+      massert(setsid()>=0);
 
       if (daemon == sKpersistent)
 	switch(pfork()) {
@@ -2440,23 +2440,17 @@ object x=Cnil;
 	  break;
 	}
       
+      massert(!chdir("/"));
+
       memset(&r,0,sizeof(r));
-      if (getrlimit(RLIMIT_NOFILE,&r))
-	FEerror("Cannot get resourse usage",0);
+      massert(!getrlimit(RLIMIT_NOFILE,&r));
       
       for (i=0;i<r.rlim_cur;i++)
-	close(i);
-      errno=0;
-      
-      if ((i=open("/dev/null",O_RDWR))==-1)
-	FEerror("Can't open /dev/null for stdin",0);
-      if ((i=dup(i))==-1)
-	FEerror("Can't dup",0);
-      if ((i=dup(i))==-1)
-	FEerror("Can't dup twice",0);
+      	close(i);/*FIXME some of this will return error*/
       
-      if (chdir("/"))
-	FEerror("Cannot chdir to /",0);
+      massert((i=open("/dev/null",O_RDWR))>=0);
+      massert((i=dup(i))>=0);
+      massert((i=dup(i))>=0);
       
       umask(0);
       
@@ -2473,16 +2467,14 @@ object x=Cnil;
 	
 	FD_ZERO(&fds);
 	FD_SET(fd,&fds);
-	i=select(fd+1,&fds,NULL,NULL,NULL);
 	
-	if (i>0) {
+	if (select(fd+1,&fds,NULL,NULL,NULL)>0) {
 	  
 	  y=maccept(x);
 	  
-	  sigaction(SIGCHLD,&sa,NULL);
-	  
 	  switch((pid=pfork())) {
 	  case 0:
+	    massert(!sigaction(SIGCHLD,&osa,NULL));
 	    ifuncall1(server,y);
 	    exit(0);
 	    break;
@@ -2506,6 +2498,8 @@ object x=Cnil;
       break;
     }
 
+    massert(!sigaction(SIGCHLD,&osa,NULL));
+
   } else 
 
 #endif
--- gcl-2.6.12.orig/o/main.c
+++ gcl-2.6.12/o/main.c
@@ -227,9 +227,9 @@ get_phys_pages1(char freep) {
 static void
 get_gc_environ(void) {
 
-  const char *e;;
+  const char *e;
   
-  mem_multiple=1.0;
+  mem_multiple=0.85;
   if ((e=getenv("GCL_MEM_MULTIPLE"))) {
     massert(sscanf(e,"%lf",&mem_multiple)==1);
     massert(mem_multiple>=0.0);
--- gcl-2.6.12.orig/o/nsocket.c
+++ gcl-2.6.12/o/nsocket.c
@@ -630,50 +630,43 @@ doReverse(char *s, int n)
   of the buffer may be changed.
  */
 int
-getCharGclSocket(object strm, object block)
-{
-  object bufp = SOCKET_STREAM_BUFFER(strm);
-  if (bufp->ust.ust_fillp > 0) {
-    dprintf("getchar returns (%c)\n",bufp->ust.ust_self[-1+(bufp->ust.ust_fillp)]);
+getCharGclSocket(object strm, object block) {
+
+  object bufp=SOCKET_STREAM_BUFFER(strm);
+  int fd=SOCKET_STREAM_FD(strm);
+
+  if (bufp->ust.ust_fillp > 0)
     return bufp->ust.ust_self[--(bufp->ust.ust_fillp)];
-  }
-  else {
+
+  if (fd>=0) {
+
     fd_set readfds;
-    struct timeval timeout;
-    int fd = SOCKET_STREAM_FD(strm);
-    if (1)
-      { int high;
-      AGAIN:      
-      /* under cygwin a too large timout like (1<<30) does not work */
-      timeout.tv_sec = 0;
-      timeout.tv_usec = 10000;
-      FD_ZERO(&readfds);
-      FD_SET(fd,&readfds);
-      high = select(fd+1,&readfds,NULL,NULL,block==Ct ? NULL : &timeout);
-      if (high > 0)
-	{ object bufp = SOCKET_STREAM_BUFFER(strm);
-	int n;
-	n = SAFE_READ(fd,bufp->st.st_self ,bufp->ust.ust_dim);
+    struct timeval t,t1={0,10000},*tp=block==Ct ? NULL : &t;
+    int high,n;
+
+    FD_ZERO(&readfds);
+    FD_SET(fd,&readfds);
+
+    for (;(errno=0,t=t1,high=select(fd+1,&readfds,NULL,NULL,tp))==-1 && !tp && errno==EINTR;);
+
+    if (high > 0) {
+
+      massert((n=SAFE_READ(fd,bufp->st.st_self,bufp->ust.ust_dim))>=0);
+
+      if (n) {
 	doReverse(bufp->st.st_self,n);
 	bufp->ust.ust_fillp=n;
-	if (n > 0)
-	  {
-	    dprintf("getchar returns (%c)\n",bufp->ust.ust_self[-1+(bufp->ust.ust_fillp)]);
-	    return bufp->ust.ust_self[--(bufp->ust.ust_fillp)];
-	  }
-	else
-	  {
-	    SOCKET_STREAM_FD(strm)=-1;
-	    return EOF;
-	    FEerror("select said there was stuff there but there was not",0);
-	  }
-	}
-      /* probably a signal interrupted us.. */
-      if (block == Ct)
-	goto AGAIN;
-      return EOF;
-      }
+      } else
+	SOCKET_STREAM_FD(strm)=-1;
+
+      return getCharGclSocket(strm,block);
+
+    }
+
   }
+
+  return EOF;
+
 }
 
 #else
--- gcl-2.6.12.orig/o/prelink.c
+++ gcl-2.6.12/o/prelink.c
@@ -7,6 +7,7 @@ extern FILE *stdin __attribute__((weak))
 extern FILE *stderr __attribute__((weak));
 extern FILE *stdout __attribute__((weak));
 
+#ifdef HAVE_READLINE
 #if RL_READLINE_VERSION < 0x0600
 extern Function		*rl_completion_entry_function __attribute__((weak));
 extern char		*rl_readline_name __attribute__((weak));
@@ -15,6 +16,7 @@ extern rl_compentry_func_t *rl_completio
 extern const char *rl_readline_name __attribute__((weak));
 #endif
 #endif
+#endif
 
 void
 prelink_init(void) {
--- gcl-2.6.12.orig/o/sfasli.c
+++ gcl-2.6.12/o/sfasli.c
@@ -116,14 +116,20 @@ int
 use_symbols(double d,...) {
 
 #ifndef DARWIN
+
   extern void sincos(double,double *,double *);
+  double d2;
+
+  sincos(d,&d,&d2);
 
-  sincos(d,&d,&d);
 #else
+
   d=sin(d)+cos(d);
+  d2=sin(d)+cos(d);
+
 #endif
 
-  return (int)d;
+  return (int)(d+d2);
 
 }
 #endif