Subject: [clisp-list] [More on]: CLISP on cygwin and io trouble

From: "Young, David" <[email-masked]>
Date: Fri Aug 2 07:10:05 2002

Ok, here's an update on that "UNIX Error 13" endless loop trouble I reported
yesterday.

After building the CVS head, the problem remains. However, Matthias Lindner
sent me mail this morning with a patch he'd made for this problem; he had
the same problem with CLISP 2.28 on cygwin, running rxvt. I applied the
patch to stream.d; the first hunk took, the second failed (probably because
I applied the thing to the latest CLISP and not 2.28). In any event, I
recompiled CLISP and behold! the trouble disappeared.

Matthias claims no responsibility for "correctness" here; he just tried
something to see if it would address his problem. Here's a snippet from his
mail, with permission:

"What I did was to hack stream.d to simply skip the error.
Included is my patch to stream.d which solved this problem for me and
solved another, where readline did not work, as Clisp did not
realize, that "/dev/conin" and "/dev/conout" are the same device.
As I mentioned I don't think what I did is a "proper" solution - it
just kept me going. Maybe it helps you (to find a proper solution?)."

Sam, I've included the patch to see if it will spark any ideas. Let me know
if I can help further.

---- Cut here -------------------------------------------------------------
--- stream.d~	Sun Mar  3 00:21:30 2002
+++ stream.d	Tue Mar 12 18:55:15 2002
@@ -3237,8 +3237,8 @@
           #if defined(UNIX_IRIX) || defined(EMUNIX)
           if (!(errno==ENOSYS))
           #endif
-          #ifdef UNIX_CYGWIN32 # needed for Win95 only
-          if (!(errno==EBADF))
+          #ifdef UNIX_CYGWIN32 # needed for Win95 only / EACCES for
xterm/rxvt
+          if (!((errno==EBADF) || (errno==EACCES)))
           #endif
           if (!(errno==EINVAL))
             { OS_error(); }
@@ -10063,8 +10063,15 @@
       struct stat stdin_stat;
       struct stat stdout_stat;
       if ((fstat(stdin_handle,&stdin_stat) >= 0) &&
(fstat(stdout_handle,&stdout_stat) >= 0))
-        if ((stdin_stat.st_dev == stdout_stat.st_dev) && (stdin_stat.st_ino
== stdout_stat.st_ino))
+          if (stdin_stat.st_dev == stdout_stat.st_dev) 
+            if (stdin_stat.st_ino == stdout_stat.st_ino)
           same_tty = true;
+            #ifdef UNIX_CYGWIN32 # Cygwin in NT Shell needs this
+            else
+              if ((strcmp("/dev/conin",  ttyname(stdin_handle))  == 0)  &&
+                  (strcmp("/dev/conout", ttyname(stdout_handle)) == 0))
+                same_tty = true;
+          #endif
      #endif
     #endif
     #ifdef MSDOS
---- Cut here -----------------------------------------------------------

Cheers,

--
------------------------------------------
David E. Young
[email-masked]
http://www.bloodhoundinc.com

"Those who expect to reap the blessings of liberty
 must undergo the fatigues of supporting it."
  -- Thomas Paine

"But all the world understands my language."
  -- Franz Joseph Haydn (1732-1809)