Xref: utzoo comp.bugs.4bsd:1124 comp.unix.questions:10477 comp.unix.wizards:13133 Path: utzoo!attcan!lsuc!sickkids!mark From: mark@sickkids.UUCP (Mark Bartelt) Newsgroups: comp.bugs.4bsd,comp.unix.questions,comp.unix.wizards Subject: Re: Bug/misfeature in 4bsd /bin/sh (minor followup/correction) Message-ID: <125@sickkids.UUCP> Date: 3 Dec 88 14:22:23 GMT References: <117@sickkids.UUCP> <474@auspex.UUCP> <1988Nov19.235444.29764@utzoo.uucp> <193.nlunix6@orcenl.uucp> Reply-To: mark@sickkids.UUCP (Mark Bartelt) Organization: Hospital for Sick Children, Toronto Lines: 48 In article <117@sickkids.UUCP> mark@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@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@sickkids.utoronto 416/598-6442 INTERNET: mark@sickkids.toronto.edu