385abae
Description: <short summary of the patch>
385abae
 TODO: Put a short summary on the line above and replace this paragraph
385abae
 with a longer explanation of this change. Complete the meta-information
385abae
 with other relevant fields (see below for details). To make it easier, the
385abae
 information below has been extracted from the changelog. Adjust it or drop
385abae
 it.
385abae
 .
385abae
 gcl (2.6.12-29) unstable; urgency=medium
385abae
 .
385abae
   * Version_2_6_13pre35; support latest binutils
385abae
   * Bug fix: "gcl ftbfs on amd64 and i386 with binutils from
385abae
     experimental", thanks to Matthias Klose (Closes: #803214).
385abae
Author: Camm Maguire <camm@debian.org>
385abae
Bug-Debian: https://bugs.debian.org/803214
385abae
385abae
---
385abae
The information above should follow the Patch Tagging Guidelines, please
385abae
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
385abae
are templates for supplementary fields that you might want to add:
385abae
385abae
Origin: <vendor|upstream|other>, <url of original patch>
385abae
Bug: <url in upstream bugtracker>
385abae
Bug-Debian: https://bugs.debian.org/<bugnumber>
385abae
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
385abae
Forwarded: <no|not-needed|url proving that it has been forwarded>
385abae
Reviewed-By: <name and email of someone who approved the patch>
385abae
Last-Update: <YYYY-MM-DD>
385abae
385abae
--- gcl-2.6.12.orig/cmpnew/gcl_cmpvs.lsp
385abae
+++ gcl-2.6.12/cmpnew/gcl_cmpvs.lsp
385abae
@@ -75,8 +75,8 @@
385abae
 (defun wt-vs* (vs)
385abae
   (wt "(" )(wt-vs vs) (wt "->c.c_car)"))
385abae
 
385abae
-(defun wt-ccb-vs (ccb-vs)
385abae
-  (wt "(fun->cc.cc_turbo[" (- *initial-ccb-vs* ccb-vs) "]->c.c_car)"))
385abae
+(defun wt-ccb-vs (ccb-vs);;FIXME harmonize *closure-p* with *clink*
385abae
+  (wt "(" (if *closure-p* "fun->cc.cc_turbo" "base0") "[" (- *initial-ccb-vs* ccb-vs) "]->c.c_car)"))
385abae
 
385abae
 (defun clink (vs) (setq *clink* vs))
385abae
 
385abae
--- gcl-2.6.12.orig/configure
385abae
+++ gcl-2.6.12/configure
385abae
@@ -7663,7 +7663,7 @@ fi
385abae
 if test "${enable_ansi+set}" = set; then :
385abae
   enableval=$enable_ansi;
385abae
 else
385abae
-  enable_ansi="no"
385abae
+  enable_ansi="yes"
385abae
 fi
385abae
 
385abae
 
385abae
--- gcl-2.6.12.orig/configure.in
385abae
+++ gcl-2.6.12/configure.in
385abae
@@ -2133,7 +2133,7 @@ AC_ARG_ENABLE(readline,
385abae
 
385abae
 # ansi lisp
385abae
 AC_ARG_ENABLE(ansi,[--enable-ansi builds a large gcl aiming for ansi compliance, 
385abae
-		    --disable-ansi builds the smaller traditional CLtL1 image],,enable_ansi="no")
385abae
+		    --disable-ansi builds the smaller traditional CLtL1 image],,enable_ansi="yes")
385abae
 
385abae
 if test "$enable_ansi" = "yes" ; then
385abae
 	SYSTEM=ansi_gcl
385abae
--- gcl-2.6.12.orig/o/alloc.c
385abae
+++ gcl-2.6.12/o/alloc.c
385abae
@@ -1241,7 +1241,7 @@ gcl_init_alloc(void *cs_start) {
385abae
 
385abae
     massert(!getrlimit(RLIMIT_STACK, &rl);;
385abae
     if (rl.rlim_cur!=RLIM_INFINITY && (rl.rlim_max == RLIM_INFINITY || rl.rlim_max > rl.rlim_cur)) {
385abae
-      rl.rlim_cur = rl.rlim_max == RLIM_INFINITY ? rl.rlim_max : rl.rlim_max/64;
385abae
+      rl.rlim_cur = rl.rlim_max;
385abae
       massert(!setrlimit(RLIMIT_STACK,&rl);;
385abae
     }
385abae
     cssize = rl.rlim_cur/sizeof(*cs_org) - sizeof(*cs_org)*CSGETA;
385abae
--- gcl-2.6.12.orig/o/file.d
385abae
+++ gcl-2.6.12/o/file.d
385abae
@@ -2407,17 +2407,18 @@ object x=Cnil;
385abae
    inPort = (myport == Cnil ? 0 : fix(Iis_fixnum(myport)));
385abae
    
385abae
 #ifdef BSD
385abae
+
385abae
   if (isServer && daemon != Cnil) {
385abae
 
385abae
     long pid,i;
385abae
     struct rlimit r;
385abae
-    struct sigaction sa;
385abae
+    struct sigaction sa,osa;
385abae
 
385abae
     sa.sa_handler=SIG_IGN;
385abae
     sa.sa_flags=SA_NOCLDWAIT;
385abae
     sigemptyset(&sa.sa_mask);
385abae
 
385abae
-    sigaction(SIGCHLD,&sa,NULL);
385abae
+    massert(!sigaction(SIGCHLD,&sa,&osa));
385abae
 
385abae
     switch((pid=pfork())) {
385abae
     case -1:
385abae
@@ -2425,8 +2426,7 @@ object x=Cnil;
385abae
       break;
385abae
     case 0:
385abae
 
385abae
-      if (setsid()<0)
385abae
-	FEerror("setsid error", 0);
385abae
+      massert(setsid()>=0);
385abae
 
385abae
       if (daemon == sKpersistent)
385abae
 	switch(pfork()) {
385abae
@@ -2440,23 +2440,17 @@ object x=Cnil;
385abae
 	  break;
385abae
 	}
385abae
       
385abae
+      massert(!chdir("/"));
385abae
+
385abae
       memset(&r,0,sizeof(r));
385abae
-      if (getrlimit(RLIMIT_NOFILE,&r))
385abae
-	FEerror("Cannot get resourse usage",0);
385abae
+      massert(!getrlimit(RLIMIT_NOFILE,&r);;
385abae
       
385abae
       for (i=0;i
385abae
-	close(i);
385abae
-      errno=0;
385abae
-      
385abae
-      if ((i=open("/dev/null",O_RDWR))==-1)
385abae
-	FEerror("Can't open /dev/null for stdin",0);
385abae
-      if ((i=dup(i))==-1)
385abae
-	FEerror("Can't dup",0);
385abae
-      if ((i=dup(i))==-1)
385abae
-	FEerror("Can't dup twice",0);
385abae
+      	close(i);/*FIXME some of this will return error*/
385abae
       
385abae
-      if (chdir("/"))
385abae
-	FEerror("Cannot chdir to /",0);
385abae
+      massert((i=open("/dev/null",O_RDWR))>=0);
385abae
+      massert((i=dup(i))>=0);
385abae
+      massert((i=dup(i))>=0);
385abae
       
385abae
       umask(0);
385abae
       
385abae
@@ -2473,16 +2467,14 @@ object x=Cnil;
385abae
 	
385abae
 	FD_ZERO(&fds);
385abae
 	FD_SET(fd,&fds);
385abae
-	i=select(fd+1,&fds,NULL,NULL,NULL);
385abae
 	
385abae
-	if (i>0) {
385abae
+	if (select(fd+1,&fds,NULL,NULL,NULL)>0) {
385abae
 	  
385abae
 	  y=maccept(x);
385abae
 	  
385abae
-	  sigaction(SIGCHLD,&sa,NULL);
385abae
-	  
385abae
 	  switch((pid=pfork())) {
385abae
 	  case 0:
385abae
+	    massert(!sigaction(SIGCHLD,&osa,NULL));
385abae
 	    ifuncall1(server,y);
385abae
 	    exit(0);
385abae
 	    break;
385abae
@@ -2506,6 +2498,8 @@ object x=Cnil;
385abae
       break;
385abae
     }
385abae
 
385abae
+    massert(!sigaction(SIGCHLD,&osa,NULL));
385abae
+
385abae
   } else 
385abae
 
385abae
 #endif
385abae
--- gcl-2.6.12.orig/o/main.c
385abae
+++ gcl-2.6.12/o/main.c
385abae
@@ -227,9 +227,9 @@ get_phys_pages1(char freep) {
385abae
 static void
385abae
 get_gc_environ(void) {
385abae
 
385abae
-  const char *e;;
385abae
+  const char *e;
385abae
   
385abae
-  mem_multiple=1.0;
385abae
+  mem_multiple=0.85;
385abae
   if ((e=getenv("GCL_MEM_MULTIPLE"))) {
385abae
     massert(sscanf(e,"%lf",&mem_multiple)==1);
385abae
     massert(mem_multiple>=0.0);
385abae
--- gcl-2.6.12.orig/o/nsocket.c
385abae
+++ gcl-2.6.12/o/nsocket.c
385abae
@@ -630,50 +630,43 @@ doReverse(char *s, int n)
385abae
   of the buffer may be changed.
385abae
  */
385abae
 int
385abae
-getCharGclSocket(object strm, object block)
385abae
-{
385abae
-  object bufp = SOCKET_STREAM_BUFFER(strm);
385abae
-  if (bufp->ust.ust_fillp > 0) {
385abae
-    dprintf("getchar returns (%c)\n",bufp->ust.ust_self[-1+(bufp->ust.ust_fillp)]);
385abae
+getCharGclSocket(object strm, object block) {
385abae
+
385abae
+  object bufp=SOCKET_STREAM_BUFFER(strm);
385abae
+  int fd=SOCKET_STREAM_FD(strm);
385abae
+
385abae
+  if (bufp->ust.ust_fillp > 0)
385abae
     return bufp->ust.ust_self[--(bufp->ust.ust_fillp)];
385abae
-  }
385abae
-  else {
385abae
+
385abae
+  if (fd>=0) {
385abae
+
385abae
     fd_set readfds;
385abae
-    struct timeval timeout;
385abae
-    int fd = SOCKET_STREAM_FD(strm);
385abae
-    if (1)
385abae
-      { int high;
385abae
-      AGAIN:      
385abae
-      /* under cygwin a too large timout like (1<<30) does not work */
385abae
-      timeout.tv_sec = 0;
385abae
-      timeout.tv_usec = 10000;
385abae
-      FD_ZERO(&readfds);
385abae
-      FD_SET(fd,&readfds);
385abae
-      high = select(fd+1,&readfds,NULL,NULL,block==Ct ? NULL : &timeout);
385abae
-      if (high > 0)
385abae
-	{ object bufp = SOCKET_STREAM_BUFFER(strm);
385abae
-	int n;
385abae
-	n = SAFE_READ(fd,bufp->st.st_self ,bufp->ust.ust_dim);
385abae
+    struct timeval t,t1={0,10000},*tp=block==Ct ? NULL : &t;
385abae
+    int high,n;
385abae
+
385abae
+    FD_ZERO(&readfds);
385abae
+    FD_SET(fd,&readfds);
385abae
+
385abae
+    for (;(errno=0,t=t1,high=select(fd+1,&readfds,NULL,NULL,tp))==-1 && !tp && errno==EINTR;);
385abae
+
385abae
+    if (high > 0) {
385abae
+
385abae
+      massert((n=SAFE_READ(fd,bufp->st.st_self,bufp->ust.ust_dim))>=0);
385abae
+
385abae
+      if (n) {
385abae
 	doReverse(bufp->st.st_self,n);
385abae
 	bufp->ust.ust_fillp=n;
385abae
-	if (n > 0)
385abae
-	  {
385abae
-	    dprintf("getchar returns (%c)\n",bufp->ust.ust_self[-1+(bufp->ust.ust_fillp)]);
385abae
-	    return bufp->ust.ust_self[--(bufp->ust.ust_fillp)];
385abae
-	  }
385abae
-	else
385abae
-	  {
385abae
-	    SOCKET_STREAM_FD(strm)=-1;
385abae
-	    return EOF;
385abae
-	    FEerror("select said there was stuff there but there was not",0);
385abae
-	  }
385abae
-	}
385abae
-      /* probably a signal interrupted us.. */
385abae
-      if (block == Ct)
385abae
-	goto AGAIN;
385abae
-      return EOF;
385abae
-      }
385abae
+      } else
385abae
+	SOCKET_STREAM_FD(strm)=-1;
385abae
+
385abae
+      return getCharGclSocket(strm,block);
385abae
+
385abae
+    }
385abae
+
385abae
   }
385abae
+
385abae
+  return EOF;
385abae
+
385abae
 }
385abae
 
385abae
 #else
385abae
--- gcl-2.6.12.orig/o/prelink.c
385abae
+++ gcl-2.6.12/o/prelink.c
385abae
@@ -7,6 +7,7 @@ extern FILE *stdin __attribute__((weak))
385abae
 extern FILE *stderr __attribute__((weak));
385abae
 extern FILE *stdout __attribute__((weak));
385abae
 
385abae
+#ifdef HAVE_READLINE
385abae
 #if RL_READLINE_VERSION < 0x0600
385abae
 extern Function		*rl_completion_entry_function __attribute__((weak));
385abae
 extern char		*rl_readline_name __attribute__((weak));
385abae
@@ -15,6 +16,7 @@ extern rl_compentry_func_t *rl_completio
385abae
 extern const char *rl_readline_name __attribute__((weak));
385abae
 #endif
385abae
 #endif
385abae
+#endif
385abae
 
385abae
 void
385abae
 prelink_init(void) {
385abae
--- gcl-2.6.12.orig/o/sfasli.c
385abae
+++ gcl-2.6.12/o/sfasli.c
385abae
@@ -116,14 +116,20 @@ int
385abae
 use_symbols(double d,...) {
385abae
 
385abae
 #ifndef DARWIN
385abae
+
385abae
   extern void sincos(double,double *,double *);
385abae
+  double d2;
385abae
+
385abae
+  sincos(d,&d,&d2;;
385abae
 
385abae
-  sincos(d,&d,&d);
385abae
 #else
385abae
+
385abae
   d=sin(d)+cos(d);
385abae
+  d2=sin(d)+cos(d);
385abae
+
385abae
 #endif
385abae
 
385abae
-  return (int)d;
385abae
+  return (int)(d+d2);
385abae
 
385abae
 }
385abae
 #endif