From owner-svn-src-head@FreeBSD.ORG Tue Dec 18 21:02:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7671DB10; Tue, 18 Dec 2012 21:02:39 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3FBB48FC0A; Tue, 18 Dec 2012 21:02:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBIL2dN2027598; Tue, 18 Dec 2012 21:02:39 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBIL2cqj027595; Tue, 18 Dec 2012 21:02:38 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212182102.qBIL2cqj027595@svn.freebsd.org> From: Eitan Adler Date: Tue, 18 Dec 2012 21:02:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244407 - in head: tools/regression/usr.bin/printf usr.bin/printf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 21:02:39 -0000 Author: eadler Date: Tue Dec 18 21:02:38 2012 New Revision: 244407 URL: http://svnweb.freebsd.org/changeset/base/244407 Log: POSIX requires that non-existent or null arguments be treated as if a zero argument were supplied. Add a regression test to catch this case as well. PR: bin/174521 Submitted by: Daniel Shahaf (pr) Submitted by: Mark Johnston (initial patch) Reviewed by: jilles Approved by: cperciva (implicit) MFC after: 3 weeks Added: head/tools/regression/usr.bin/printf/regress.zero.out (contents, props changed) Modified: head/tools/regression/usr.bin/printf/regress.sh head/usr.bin/printf/printf.c Modified: head/tools/regression/usr.bin/printf/regress.sh ============================================================================== --- head/tools/regression/usr.bin/printf/regress.sh Tue Dec 18 20:47:23 2012 (r244406) +++ head/tools/regression/usr.bin/printf/regress.sh Tue Dec 18 21:02:38 2012 (r244407) @@ -2,7 +2,7 @@ REGRESSION_START($1) -echo '1..11' +echo '1..12' REGRESSION_TEST(`b', `printf "abc%b%b" "def\n" "\cghi"') REGRESSION_TEST(`d', `printf "%d,%5d,%.5d,%0*d,%.*d\n" 123 123 123 5 123 5 123') @@ -15,5 +15,6 @@ REGRESSION_TEST(`m3', `printf "%%%s\n" a REGRESSION_TEST(`m4', `printf "%d,%f,%c,%s\n"') REGRESSION_TEST(`m5', `printf -- "-d\n"') REGRESSION_TEST(`s', `printf "%.3s,%-5s\n" abcd abc') +REGRESSION_TEST('zero', `printf "%u%u\n" 15') REGRESSION_END() Added: head/tools/regression/usr.bin/printf/regress.zero.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/printf/regress.zero.out Tue Dec 18 21:02:38 2012 (r244407) @@ -0,0 +1 @@ +150 Modified: head/usr.bin/printf/printf.c ============================================================================== --- head/usr.bin/printf/printf.c Tue Dec 18 20:47:23 2012 (r244406) +++ head/usr.bin/printf/printf.c Tue Dec 18 21:02:38 2012 (r244407) @@ -473,7 +473,7 @@ getnum(intmax_t *ip, uintmax_t *uip, int int rval; if (!*gargv) { - *ip = 0; + *ip = *uip = 0; return (0); } if (**gargv == '"' || **gargv == '\'') {