From owner-freebsd-stable@FreeBSD.ORG Sun Jul 6 11:15:14 2008 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 636721065673 for ; Sun, 6 Jul 2008 11:15:14 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (meestal-mk5.stack.nl [IPv6:2001:610:1108:5010::149]) by mx1.freebsd.org (Postfix) with ESMTP id 1FA648FC17 for ; Sun, 6 Jul 2008 11:15:14 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id A311A3F67B; Sun, 6 Jul 2008 13:15:11 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 8F5B9228D0; Sun, 6 Jul 2008 13:15:11 +0200 (CEST) Date: Sun, 6 Jul 2008 13:15:11 +0200 From: Jilles Tjoelker To: Alexandre Sunny Kovalenko Message-ID: <20080706111511.GA68941@stack.nl> References: <1214770585.1079.13.camel@RabbitsDen> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="9zSXsLTf0vkW971A" Content-Disposition: inline In-Reply-To: <1214770585.1079.13.camel@RabbitsDen> X-Operating-System: FreeBSD 7.0-STABLE i386 User-Agent: Mutt/1.5.17 (2007-11-01) Cc: stable@freebsd.org Subject: Re: expand_number(3) silently truncates numeric part of the argument to 32 bit on i386, light impact on gjournal X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2008 11:15:14 -0000 --9zSXsLTf0vkW971A Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Jun 29, 2008 at 04:16:25PM -0400, Alexandre Sunny Kovalenko wrote: > I honestly don't know whether it should or should not do it, and if it > should not, what errno should be set to. Program below gives following > output on RELENG_7 as of June 28th: > sunny:RabbitsDen>./expand_number 5368709120k > Result is 1099511627776 > sunny:RabbitsDen>./expand_number 5120G > Result is 5497558138880 > sunny:RabbitsDen> > One of the more interesting manifestations in the userland is that > gjournal label -s 5368709120 -f /dev/da0s1a > quietly gives you 1G of the journal in the resulting file system. > [snip program calling expand_number(3)] This happens because src/lib/libutil/expand_number.c does not include the necessary header for calling strtoimax(3). The file is compiled without compiler warnings, so the bug shows up as wrong behaviour. Adding #include fixes it. The file is slightly changed in CURRENT but the same patch should apply. -- Jilles Tjoelker --9zSXsLTf0vkW971A Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="expand_number.patch" --- src/lib/libutil/expand_number.c.orig 2007-09-05 16:27:13.000000000 +0200 +++ src/lib/libutil/expand_number.c 2008-07-06 13:11:02.766238000 +0200 @@ -33,6 +33,7 @@ #include #include #include +#include /* * Convert an expression of the following forms to a int64_t. --9zSXsLTf0vkW971A--