Subject: Re: NetBSD master CVS tree commits
To: Christos Zoulas <christos@deshaw.com>
From: Greg A. Woods <woods@kuma.web.net>
List: current-users
Date: 06/05/1996 15:02:49
[ On Tue, June  4, 1996 at 11:24:45 (-0400), Christos Zoulas wrote: ]
> Subject: Re: NetBSD master CVS tree commits
>
> On Jun 4, 10:51am, woods@kuma.web.net (Greg A. Woods) wrote:
> -- Subject: Re: NetBSD master CVS tree commits
> 
> | [ On Mon, June  3, 1996 at 08:30:03 (-0400), The Source of All Evil wrote: ]
> | > Subject: NetBSD master CVS tree commits
> | >
> | > christos
> | > Mon Jun  3 08:21:19 EDT 1996
> | > Update of /a/cvsroot/src/bin/sh
> | > In directory pain.lcs.mit.edu:/a/tmp/cvs-serv12085
> | > 
> | > Modified Files:
> | > 	eval.c 
> | > Log Message:
> | > Fix PR/2504: return with no args returns 0 instead of the return value of
> | > the previous command in functions
> |  
> | I think this PR was in error.
> | 
> | >From P1003.2/D11.2 section 3.9.5, p. 276:
> | 
> |  Exit_Status
> | 
> |  The exit status of a function definition shall be zero if the function
> |  was declared successfully; otherwise, it shall be greater than zero.  The
> |  exit status of a function invocation shall be the exit status of the last
> |  command executed by the function.
> 
> The PR/ and the fix are correct I think. My commit comment leaves a lot
> to be desired... It used to always return 0, and now it returns the value
> of the previous command.

You are correct.  I interpreted the "Log Message" in the reverse sense
to what it really meant, assuming it described the fix, not the problem!

However, as per P1003.2/D11.2, shell functions *should* exit with the
status of the last command executed by the funtion, so I don't think
your fix leaves anything to be desired (assuming it operates as
described) -- all requirements have been met, no?

-- 
							Greg A. Woods

+1 416 443-1734			VE3TCP			robohack!woods
Planix, Inc. <woods@planix.com>; Secrets Of The Weird <woods@weird.com>