🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #78

Re: Bourne Shell Programming Considered Harmful

#78
From: D. Jason Penney
Date: Wed, 04 Nov 1992 22:16
146 lines
5889 bytes
In <1992Nov4.170123.27061@slc.com> penneyj@slc.com (D. Jason Penney) writes:

[snip]
>As a matter of fact, DEC has done absolutely nothing to fix the hideous
>atrocities they have committed to /bin/sh.  As a consequence of DEC's
>unspeakable hairballs in this area, Servio now ships a copy of bash as a
>courtesy to all of our Unix customers.  A descriptive list of the obscenities
>present in DEC's /bin/sh is also shipped.

>Note that Sun's /bin/sh is only slightly better.  It has no "ulimit" command,
>and the environment table handling is STILL broken (ever since 4.0).

>I could carp about the problems with other vendors' implementations of "Bourne"
>shell, but DEC by far has the worst.

By popular demand, for your amusement and disgust, here is my list of
known problems.  Note this list is not complete.  Basically, after I got
to this point, I abandoned the vendor's Bourne shells completely.

--J
--------------

This list is part of:
! $Id: upgrade30.txt,v 1.3.1.66 1992/08/19 16:49:47 otisa Exp $

II.3 /bin/sh Abandoned

Due to serious neglect and even malicious damage by operating systems vendors,
GemStone no longer uses /bin/sh in its shell scripts.  Instead, the Gnu shell
(bash, copyright 1992 by the Free Software Foundation) is being shipped with
this release.  Both the source and an executable are shipped.

-------------------------------------------------------------------------------
| GemStone is NOT WARRANTED to run properly with /bin/sh.  This is ESPECIALLY |
| true if you are running Ultrix, AIX, or NEWS-OS.                            |
-------------------------------------------------------------------------------

Servio does not support bash.  Servio warrants bash only to the extent that it
correctly executes the shell scripts that we ship with GemStone.
"Bash is ultimately intended to be a faithful implementation of the IEEE
Posix Shell and Tools specification (IEEE Working Group 1003.2)."

[snip]

[I expand each of the error reports with examples for the net's bemusement...]
---------------------

o syntax error on "set --" (Ultrix),

This is very straightforward.  "set -- xx xy xz foobar" is supposed to set
$1 ... so that you can replace your positional arguments.  This generates
a syntax error on ultrix: "--: bad option(s)".  How sweet.

---------------------
o no "unset" intrinsic (Ultrix),

"X=" is *not" the same as "unset X".  How are you supposed to remove
 environment variables?

---------------------
o inability to pipe the output of "set" and other shell intrinsics (Ultrix),

"set | more" will blast all your environment variables to the screen, then
open more on an empty stream.

If that isn't enough,

    echo "foo  bar  rab" >foo
    read f1 f2 f3 <foo

generates the message "illegal io".

---------------------
o empty strings erroneously returned from "read" (Ultrix),

Try the following:

    echo "foo  bar  rab" >foo
    # read f1 f2 f3 <foo	# won't work, see previous problem
    cat foo | ( read f1 f2 f3 ; echo \"$f1\" ; echo \"$f2\"; echo \"$f3\" )

A normal Bourne shell sets f1 to foo, f2 to bar, and f3 to rab.

On Ultrix 4.1, it sets
    f1 to "foo"
    f2 to ""
    f3 to "bar  rab"

It evidently is not regarding multiple blanks as a single field separator.]

---------------------
o malloc problems that cause /usr/ucb/vi and other vendor executables to core
  dump if your environment table size is in a certain range (SunOS),

I can't find the paperwork on this, but all the old-time engineers here know
and love this well.  If your environment table is between a certain range of
sizes (1300 to 1800?  Sorry, I can't recall), /bin/sh will pass a corrupted
environment table to programs that it launches.  "vi" in particular will
typically core dump when this happens.

Note that /bin/csh also has this problem.  This problem has been visible on
sparcStations ever since SunOS 4.0 was released.  Sun has acknowledged the
problem, and indicates absolutely no interest in maintaining /bin/sh.

As a workaround, just keep typing

  x1=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  x2=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
....

until your environment table gets over about 2K in size, and the problem will
disappear.

---------------------
o no "test -x" (Ultrix),

"test: argument expected"

---------------------
o no "test -L" (SunOS, AIX, Ultrix),

OK, so it's a little too new and POSIX for older implementations to have it.
But darn is it useful!

---------------------
o no "echo -n" (AIX),

Up until the latest release of AIX, one had to append "\c" to an echoed string
in order to suppress newline generation.  The latest version of AIX seems
to have fixed this, though.

---------------------
o no shell functions (NEWS-OS)

(since NEWS-OS is BSD derived)

---------------------
o no "ulimit" command (SunOS)

Do a "man 2 getrlimit" and read the section on "BUGS" to get a giggle on this.

---------------------
-- 
D. Jason Penney           Ph: (503) 629-8383
Beaverton, OR 97006       uucp: ...uunet!servio!penneyj (penneyj@slc.com)
"Talking about music is like dancing about architecture." -- Steve Martin
Technical Details
Message-ID: <1992Nov4.221655.29699@slc.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!psgrain!neon!pail!servio!penneyj
References: <Bx4Myp.Czr@unix.amherst.edu> <1992Nov3.125655.16320@prl.dec.com> <1992Nov3.191253*Harald.Eikrem@delab.sintef.no> <1992Nov4.170123.27061@slc.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!psgrain!neon!pail!servio!penneyj
From: penneyj@slc.com (D. Jason Penney)
Newsgroups: comp.unix.shell,comp.unix.questions
Subject: Re: Bourne Shell Programming Considered Harmful
Message-ID: <1992Nov4.221655.29699@slc.com>
Date: 4 Nov 92 22:16:55 GMT
Article-I.D.: slc.1992Nov4.221655.29699
References: <Bx4Myp.Czr@unix.amherst.edu> <1992Nov3.125655.16320@prl.dec.com> <1992Nov3.191253*Harald.Eikrem@delab.sintef.no> <1992Nov4.170123.27061@slc.com>
Distribution: na
Organization: Servio Corp, Beaverton Oregon, US
Lines: 146