Bug/misfeature in 4bsd /bin/sh (minor followup/correction)

Mark Bartelt mark at sickkids.UUCP
Sun Dec 4 00:22:23 AEST 1988


In article <117 at sickkids.UUCP> mark at sickkids.UUCP (Mark Bartelt -- Hey!
That's me!) writes:

[  Complaints about the behaviour of the 4bsd /bin/sh, specifically
   the non-deterministic (or, at least, peculiar and hard to predict)
   exit status of a pipeline, followed by example of proper behaviour
   under other UNIXes, and a quote from the sh(1) man page ...  ]

>      The exit status of a pipeline is the exit status
>      of the last command.  [ By which it's clear that
>      they mean the last command in the list, not the
>      last command to exit. ]

[  More flaming about the absurd/bizarre exit status that pipelines
   produce under 4bsd, followed by ...  ]

> Eh?  I notice also that the Berkeley folks have removed the above
> sentence from the sh(1) man page.

Guy Harris, Henry Spencer, and a couple other people corrected me
regarding the above incorrect factoid, pointing out that the 4bsd
Bourne shell is essentially the Seventh Edition shell, with minor
changes, and that the V7 shell exhibited the same problem.

The really amusing/annoying thing is that the sh(1) manual page,
describing the && and || operators, refers to the value returned
by a pipeline, as if that value ought to be a rationally arrived
at entity.

So I still consider it a bug.  As bengsig at orcenl.uucp (Bjorn Engsig)
writes:

> The SysV behaviour is the only acceptable one.

In a piece of e-mail (without a "Message-ID:", or even so much as a
"To:" line!  How did it even get *delivered* to me?), research!norman
(Norman Wilson) sums it all up rather nicely:

> Wrong; Berkeley didn't take it out of the manual page.  [...]  [T]he
> exit status of a pipeline is specified in neither the V7 man page nor
> the Vol 2 sh paper.  I wouldn't be surprised if the mysterious, broken
> behaviour of BSD sh was borrowed from V7 as well.  [...]  Berkeley's
> sin [...] is one of omission rather than commission.  Not like sendmail
> at all.

Mark Bartelt                          UUCP: {utzoo,decvax}!sickkids!mark
Hospital for Sick Children, Toronto   BITNET: mark at sickkids.utoronto
416/598-6442                          INTERNET: mark at sickkids.toronto.edu



More information about the Comp.unix.wizards mailing list