Subject: Re: B20 Problems...
From: [email-masked] (Corinna Vinschen)

14 Nov 1998 05:55:19 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: Raj Menon <[email-masked]>, [email-masked]

Hello Raj,

I have figured out, that the libc function `dup()'
not in any case does what expected. Until I have found
the correct solution for this problem, I have a
patch, that solves nearly all problems by patching
tcsh for a while. Unfortunately, here scripts still doesn't
work, if tcsh is a subshell. But it's better than nothing.

Your make problem is less significant if CYGWIN=...notty...,
I have found, that configure scripts run completely in
notty mode, but hang very often in tty mode. I'm using
tty mode only with care.

Regards,
Corinna

---- snip ----
--- sh.sem.c.orig       Sat Nov 14 02:29:43 1998
+++ sh.sem.c    Sat Nov 14 02:22:05 1998
@@ -857,7 +857,8 @@ doio(t, pipein, pipeout)
        }
        else if (flags & F_PIPEIN) {
            (void) close(0);
-           (void) dup(pipein[0]);
+           //(void) dup(pipein[0]);
+           (void) dup2(pipein[0], 0);
            (void) close(pipein[0]);
            (void) close(pipein[1]);
        }
@@ -867,7 +868,8 @@ doio(t, pipein, pipeout)
        }
        else {
            (void) close(0);
-           (void) dup(OLDSTD);
+           //(void) dup(OLDSTD);
+           (void) dup2(OLDSTD, 0);
 #if defined(CLOSE_ON_EXEC) && defined(CLEX_DUPS)
            /*
             * PWP: Unlike Bezerkeley 4.3, FIONCLEX for Pyramid is preserved
@@ -919,12 +921,14 @@ doio(t, pipein, pipeout)
     }
     else if (flags & F_PIPEOUT) {
        (void) close(1);
-       (void) dup(pipeout[1]);
+       //(void) dup(pipeout[1]);
+       (void) dup2(pipeout[1], 1);
        is1atty = 0;
     }
     else {
        (void) close(1);
-       (void) dup(SHOUT);
+       //(void) dup(SHOUT);
+       (void) dup2(SHOUT, 1);
        is1atty = isoutatty;
 #if defined(CLOSE_ON_EXEC) && defined(CLEX_DUPS)
        (void) close_on_exec(1, 0);
@@ -933,11 +937,13 @@ doio(t, pipein, pipeout)

     (void) close(2);
     if (flags & F_STDERR) {
-       (void) dup(1);
+       //(void) dup(1);
+       (void) dup2(1, 2);
        is2atty = is1atty;
     }
     else {
-       (void) dup(SHDIAG);
+       //(void) dup(SHDIAG);
+       (void) dup2(SHDIAG, 2);
        is2atty = isdiagatty;
 #if defined(CLOSE_ON_EXEC) && defined(CLEX_DUPS)
        (void) close_on_exec(2, 0);
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".