Subject: bin/2698: sh is fragile
To: None <gnats-bugs@NetBSD.ORG>
From: Peter Seebach <email@example.com>
Date: 08/14/1996 13:47:37
>Synopsis: sh chokes on \r's.
>Responsible: bin-bug-people (Utility Bug People)
>Arrival-Date: Wed Aug 14 17:35:02 1996
>Originator: Peter Seebach
Peter Seebach - firstname.lastname@example.org - Copyright 1996 Peter Seebach.
C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
Unsolicited email is not welcome, and will be billed for at consulting rates.
The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
System: NetBSD taniemarie 1.2_BETA NetBSD 1.2_BETA (SEEBS) #3: Wed Jul 24 00:10:48 CDT 1996 seebs@taniemarie:/usr/src/sys/arch/amiga/compile/SEEBS amiga
Even the most trivial shell script produces syntax errors if there
are ^M's at the ends of lines. Since ^M is whitespace, this is a
bug. It looks like the source frequently checks for ' ' or '\t'.
It should probably check for isspace(c) && c != '\n'.
's to any simple script, watch sh die.
From looking at the source, fix sh so that it uses a function for all
of those "is this space" commands, and then make '\r' either act
like '\n' or like '\t' - it should definitely be space, and I don't
care much whether it's a line break or a space at the end of a line.
I would probably make it like \t or ' ', so it would be less
intrusive on scripts.