Re: Job control bug in revision 3800d4934391b,

2010-05-28 Thread Kris Maglione

On Fri, May 28, 2010 at 02:53:16PM +1000, Herbert Xu wrote:

Kris Maglione maglion...@gmail.com wrote:


I'm not sure how to describe this bug, but it's affected one of my
scripts, and those of several of my users. Basically, we've had loops
dieing when backgrounded programs exit. This is the simplest test case
I can come up with:

#!/bin/dash
{
   echo foo
   sleep 1
   echo foo
   echo done/dev/tty
} | while read p; do
   ( echo good  ) 
done
echo done


In versions prior to 3800d4934391b, the output would
good\ndone\ndone\ngood (or some permutation thereof depending on
system load), but from 3800d4934391b on, it's good\ndone.


This should be fixed by the patch that I posted yesterday.


I should have mentioned that I tested it with every revision 
upto and including that one (especially as it looked promising).


I definitely still have this problem as of 
207e4c2a322fe: [JOBS] Fix wait regression where it does not wait for all jobs  master 


Thanks,
--
Kris Maglione

Real Programmers don't believe in schedules.  Planners make up
schedules.  Managers firm up schedules.  Frightened coders strive to
meet schedules.  Real Programmers ignore schedules.

--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Job control bug in revision 3800d4934391b,

2010-05-28 Thread Herbert Xu
Kris Maglione maglion...@gmail.com wrote:

 I should have mentioned that I tested it with every revision 
 upto and including that one (especially as it looked promising).
 
 I definitely still have this problem as of 
 207e4c2a322fe: [JOBS] Fix wait regression where it does not wait for all jobs 
  master 

Hmm, I can't reproduce this here at all.  Can you please run it
with strace -f and send the result to us?

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} herb...@gondor.apana.org.au
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Job control bug in revision 3800d4934391b,

2010-05-28 Thread Herbert Xu
On Sat, May 29, 2010 at 09:10:39AM +1000, Herbert Xu wrote:
 On Fri, May 28, 2010 at 07:01:25PM -0400, Kris Maglione wrote:
 
  That's interesting. I've had three users complain about it so far. strace 
  is attached.
 
 Thanks, I have reproduced it here now.  It looks like it only
 happens occasionally on my system.

I think this patch should fix it, but please do test it as I
can only rarely reproduce this on my machine.

diff --git a/ChangeLog b/ChangeLog
index 54d2972..5a11a8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-05-29  Herbert Xu herb...@gondor.apana.org.au
+
+   * Continue after EINTR in read(1) with no pending signals.
+
 2010-05-27  Jilles Tjoelker jil...@stack.nl
 
* Force fork if any trap is set, not just on EXIT.
diff --git a/src/miscbltin.c b/src/miscbltin.c
index 046f2f2..5ab1648 100644
--- a/src/miscbltin.c
+++ b/src/miscbltin.c
@@ -57,6 +57,7 @@
 #include main.h
 #include expand.h
 #include parser.h
+#include trap.h
 
 #undef rflag
 
@@ -158,9 +159,16 @@ readcmd(int argc, char **argv)
backslash = 0;
STARTSTACKSTR(p);
for (;;) {
-   if (read(0, c, 1) != 1) {
-   status = 1;
+   switch (read(0, c, 1)) {
+   case 1:
break;
+   default:
+   if (errno == EINTR  !pendingsigs)
+   continue;
+   /* fall through */
+   case 0:
+   status = 1;
+   goto out;
}
if (c == '\0')
continue;
@@ -181,6 +189,7 @@ put:
 resetbs:
backslash = 0;
}
+out:
STACKSTRNUL(p);
readcmd_handle_line(stackblock(), ap, p + 1 - (char *)stackblock());
return status;

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} herb...@gondor.apana.org.au
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html