From owner-svn-src-head@FreeBSD.ORG  Tue Dec 14 18:09:59 2010
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 81BBA106564A;
	Tue, 14 Dec 2010 18:09:59 +0000 (UTC) (envelope-from jilles@stack.nl)
Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107])
	by mx1.freebsd.org (Postfix) with ESMTP id 178C28FC0A;
	Tue, 14 Dec 2010 18:09:59 +0000 (UTC)
Received: by mx1.stack.nl (Postfix, from userid 65534)
	id 730B31DD9F1; Tue, 14 Dec 2010 19:09:58 +0100 (CET)
X-Spam-DCC: : scanner01.stack.nl 1282; Body=1 Fuz1=1 Fuz2=1 
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on scanner01.stack.nl
X-Spam-Level: 
X-Spam-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,
	DNS_FROM_OPENWHOIS,NO_RELAYS autolearn=no version=3.2.5
X-Spam-Relay-Country: _RELAYCOUNTRY_
Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132])
	by mx1.stack.nl (Postfix) with ESMTP id 587501DD62C;
	Tue, 14 Dec 2010 19:09:56 +0100 (CET)
Received: by turtle.stack.nl (Postfix, from userid 1677)
	id 4475C170FB; Tue, 14 Dec 2010 19:08:56 +0100 (CET)
Date: Tue, 14 Dec 2010 19:08:56 +0100
From: Jilles Tjoelker <jilles@stack.nl>
To: Xin LI <delphij@FreeBSD.org>
Message-ID: <20101214180856.GA67294@stack.nl>
References: <201012140021.oBE0LZI9097999@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201012140021.oBE0LZI9097999@svn.freebsd.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r216422 - head/usr.bin/printf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 14 Dec 2010 18:09:59 -0000

On Tue, Dec 14, 2010 at 12:21:35AM +0000, Xin LI wrote:
> Author: delphij
> Date: Tue Dec 14 00:21:34 2010
> New Revision: 216422
> URL: http://svn.freebsd.org/changeset/base/216422

> Log:
>   Make use of EX_USAGE for usage().

> Modified:
>   head/usr.bin/printf/printf.c

> Modified: head/usr.bin/printf/printf.c
> ==============================================================================
> --- head/usr.bin/printf/printf.c	Mon Dec 13 23:53:55 2010	(r216421)
> +++ head/usr.bin/printf/printf.c	Tue Dec 14 00:21:34 2010	(r216422)
[...]
> +	exit(EX_USAGE);
>  }

This does not work properly when printf is an sh builtin. The exit()
call causes sh to exit entirely, rather than the builtin to return to
the shell. The bug can be noticed easily because the test
errors/option-error.0 (from tools/regression/bin/sh) fails.

Please revert to returning the exit status from main(). Although I plan
to clean up usr.bin/printf slightly after the n$ stuff is committed, I
do not plan on adding things to sh that will allow exit() emulation in
builtins.

Other people have already said things about <sysexits.h>.

-- 
Jilles Tjoelker