ash - problem/bug with redirection and internal command

Paul Fox pgf at brightstareng.com
Wed Jul 5 08:47:56 PDT 2006


 > Jean Wolter <jw5 at os.inf.tu-dresden.de> writes:
 > 
 > > the following sequence behaves not as expected:
 > >
 > > # write some file on sysfs
 > > echo "+bond0" > /sys/class/net/bonding_masters
 > > while true; do
 > >       echo "this statement is supposed to be executed endlessly"
 > > done
 > >
 > > After this "true" and every other builtin command return false. The
 > > following diff points to the source of the problem:
 > 
 > This problem is still unsolved, could someone pick up this patch or
 > the suggestion of the original ash maintainer (who essentially simply
 > adds an unconditional clearerr(stdout))?

i'm guessing this problem was introduced when it became possible
to build echo directly into ash, is that right?  if it were a
separate process, clearly the two stdout operations would be
independent.

if that's the case, then i agree that simply clearing the error
is probably the right thing to do.  this is vodz's change, referred
to above:

--- busybox/svn/shell/ash.c	2006-06-15 22:19:41.000000000 -0400
+++ vodz/shell/ash.c	2006-05-05 09:33:54.000000000 -0400
@@ -3473,6 +3459,7 @@
 	flushall();
 cmddone:
 	exitstatus |= ferror(stdout);
+	clearerr(stdout);
 	commandname = savecmdname;
 	exsig = 0;
 	handler = savehandler;

paul

=---------------------
 paul fox, pgf at brightstareng.com


More information about the busybox mailing list