Dear CLISP team,

I've recently built (vanilla) clisp-2.42 on MacOS X 10.5 (aka  
Leopard). The resulting binary exhibited the infamous "Error 45"  
problem [1], i.e. running

clisp | tee clisp.log # for example

yields the the following error message:

 >
*** - UNIX error 45: Operation not supportd

(in an endless loop for CVS head even)

The MacPorts project [1] seems to work around this bug by compiling  
clisp using
-D_NONSTD_SOURCE cflags. This however is an undesirable situation as  
the include file /usr/include/sys/cdefs.h has the following to say  
about this option:

/*
  * COMPILATION ENVIRONMENTS
  * [...]
  * LEGACY       Defining _NONSTD_SOURCE will get pre-POSIX APIs plus  
Apple
  *              API extensions in scope.
  *
  *              This is generally equivalent to the Tiger release  
compilation
  *              environment, except that it cannot be applied to 64  
bit code;
  *              its use is discouraged.
  *
  *              We expect this environment to be deprecated in the  
future.
  * [...]
  */

The cause of the bug: Apple changed the value of EOPNOTSUPP to 102 in / 
usr/include/sys/errno.h in the STANDARD compilation environment. This  
seems to be due to the UNIX2003 certification that MacOS X 10.5 has  
received. ENOTSUP however still is defined to be 45, and this is the  
value the Darwin 9 kernel returns to user space. The problem can be  
corrected by checking for both the ENOTSUP and the EOPNOTSUPP error  
code in src/stream.d:

--- START PATCH ---

--- clisp-2.42/src/stream.d.ORIG        2007-11-05 20:17:55.000000000 +0100
+++ clisp-2.42/src/stream.d     2007-10-03 15:30:26.000000000 +0200
@@ -3463,7 +3463,7 @@
            if ((errno != EBADF) && (errno != EACCES) && (errno !=  
EBADRQC))
            #endif
            #ifdef UNIX_DARWIN
-          if ((errno != EOPNOTSUPP) && (errno != ENOTSUP) && (errno ! 
= ENODEV))
+          if ((errno != EOPNOTSUPP) && (errno != ENODEV))
            #endif
            if (!(errno==EINVAL))
              { OS_error(); }
@@ -3474,7 +3474,7 @@
        if (!( TCDRAIN(handle) ==0)) {
          if (!((errno==ENOTTY)||(errno==EINVAL)))
          #ifdef UNIX_DARWIN
-        if (!((errno==EOPNOTSUPP)||(errno==ENOTSUP)||(errno==ENODEV)))
+        if (!((errno==EOPNOTSUPP)||(errno==ENODEV)))
          #endif
            { OS_error(); } # no TTY: OK, report other Error
        } else goto ok;
@@ -3523,7 +3523,7 @@
          if ((errno != EBADF) && (errno != EACCES) && (errno !=  
EBADRQC))
          #endif
          #ifdef UNIX_DARWIN
-        if ((errno != EOPNOTSUPP) && (errno != ENOTSUP) && (errno !=  
ENODEV))
+        if ((errno != EOPNOTSUPP) && (errno != ENODEV))
          #endif
          if (!(errno==EINVAL))
            OS_error();
@@ -3549,7 +3549,7 @@
          #endif
          if (!((errno==ENOTTY)||(errno==EINVAL)))
          #ifdef UNIX_DARWIN
-        if (!((errno==EOPNOTSUPP)||(errno==ENOTSUP)||(errno==ENODEV)))
+        if (!((errno==EOPNOTSUPP)||(errno==ENODEV)))
          #endif
            { OS_error(); } # no TTY: OK, report other Error
        }

--- END PATCH ---

The patch has been tested against the current CVS head (as of Wed Nov   
7 10:29:03 UTC 2007).

Kindest Regards,
Ralf-Philipp Weinmann

[1] Martin Costabel:
     [Fink-devel] clisp, maxima and the UNIX error 45,
     22 Jun 2005 01:59:06 -0700
     http://www.mail-archive.com/[EMAIL PROTECTED]/msg11839.html

[2] MacPorts
     http://www.macports.org/

--
Ralf-P. Weinmann <[EMAIL PROTECTED]>
TU Darmstadt, FB Informatik, Cryptography & Computer Algebra
PGP fingerprint: 1024D/EF114FC02F150EB9D4F275B6159CEBEAEFCD9B06




--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to