Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Another /bin/sh bug (with patch)

9 views
Skip to first unread message

Michael Haardt

unread,
May 23, 1999, 3:00:00 AM5/23/99
to
I found the following bug in /bin/sh:

case `echo ' '` in
esac

out of string space

This is caused by an endless loop that is fixed with the patch
below. I start to wonder if anybody runs serious scripts with
the Minix shell, because this is already the second bug I found
in the shell trying to run a large script!

Michael "torturing /bin/sh"
----------------------------------------------------------------------
*** sh4.c.orig Sun May 23 15:03:44 1999
--- sh4.c Sun May 23 16:57:21 1999
***************
*** 192,198 ****
for (;;) {
c = subgetc('"', foundequals);
if (c == 0 ||
! f & (DOBLANK && any(c, ifs->value)) ||
(!INSUB() && any(c, "\"'"))) {
scanequals = 0;
unget(c);
--- 192,198 ----
for (;;) {
c = subgetc('"', foundequals);
if (c == 0 ||
! (f & DOBLANK && any(c, ifs->value)) ||
(!INSUB() && any(c, "\"'"))) {
scanequals = 0;
unget(c);

Will Rose

unread,
May 24, 1999, 3:00:00 AM5/24/99
to
Michael Haardt <mic...@moria.de> wrote:
: I found the following bug in /bin/sh:

: case `echo ' '` in
: esac

: out of string space

: This is caused by an endless loop that is fixed with the patch
: below. I start to wonder if anybody runs serious scripts with
: the Minix shell, because this is already the second bug I found
: in the shell trying to run a large script!

I gave up on the standard Minix shell a while back; the problem was
that its behaviour was pretty much undocumented (I couldn't tell bugs
from features), and the code too difficult to read. I wrote a man page
for sh after a lot of experiments, but never tried to fix any of the
problems I found. The newer ash shell seems a better bet if you want
reliability, though I haven't hammered it especially hard.


Will
c...@crash.cts.com


Michael Haardt

unread,
May 24, 1999, 3:00:00 AM5/24/99
to
Will Rose <c...@cts.com> writes:
> I gave up on the standard Minix shell a while back; the problem was
> that its behaviour was pretty much undocumented (I couldn't tell bugs
> from features), and the code too difficult to read. I wrote a man page
> for sh after a lot of experiments, but never tried to fix any of the
> problems I found. The newer ash shell seems a better bet if you want
> reliability, though I haven't hammered it especially hard.

I agree on ash being better, but it should be possibly to debug
/bin/sh enough to run common scripts. I know that there are quite some
differences when it comes to quoting, but the bugs I found so far are
serious internal errors. I will continue fixing them, because after
all, I am running my Minix system just for hack value. :)

Michael

0 new messages