Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OKVia-0005TA-Hh for mharc-grub-devel@gnu.org; Fri, 04 Jun 2010 08:09:44 -0400 Received: from [140.186.70.92] (port=40438 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKViW-0005R4-Je for grub-devel@gnu.org; Fri, 04 Jun 2010 08:09:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OKViO-0003xn-C0 for grub-devel@gnu.org; Fri, 04 Jun 2010 08:09:40 -0400 Received: from smarthost01.mail.zen.net.uk ([212.23.3.140]:37937) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OKViO-0003xb-2S for grub-devel@gnu.org; Fri, 04 Jun 2010 08:09:32 -0400 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost01.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1OKViL-0006Yg-UL; Fri, 04 Jun 2010 12:09:30 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) id 1OKViL-0000RU-00; Fri, 04 Jun 2010 13:09:29 +0100 Date: Fri, 4 Jun 2010 13:09:29 +0100 From: Colin Watson To: The development of GNU GRUB Message-ID: <20100604120928.GY21862@riva.ucam.org> References: <20100603192738.3783.6316.reportbug@rangda.seanius.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20100603192738.3783.6316.reportbug@rangda.seanius.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost01-IP: [82.69.40.219] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: 584474@bugs.debian.org Subject: Re: Bug#584474: FTBFS: =?utf-8?q?usbms=2Ec=3A315=3A_error=3A_form?= =?utf-8?b?YXQg4oCYJTAyeOKAmSBleHBlY3RzIHR5cGUg4oCYdW5zaWduZWQgaW50?= =?utf-8?b?4oCZ?= X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 12:09:42 -0000 On Thu, Jun 03, 2010 at 09:27:38PM +0200, sean finney wrote: > while investigated an unrelated bug, i noticed that the latest snapshot > uploaded to debian fails with the following error: > > gcc-4.4 -Idisk -I/home/seanius/grub2-1.98+20100602/disk -I/home/seanius/grub2-1.98+20100602/include -I. -I./include -Wall -W -ffreestanding -Os -DGRUB_MACHINE_EMU=1 -DMACHINE=X86_64_EMU -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g -fno-dwarf2-cfi-asm -m64 -fno-stack-protector -mno-stack-arg-probe -Werror -DGRUB_TARGET_NO_MODULES=1 -DUSE_ASCII_FAILBACK=1 -DGRUB_FILE=\"disk/usbms.c\" -MD -c -o usbms_mod-disk_usbms.o /home/seanius/grub2-1.98+20100602/disk/usbms.c > cc1: warnings being treated as errors > /home/seanius/grub2-1.98+20100602/disk/usbms.c: In function ‘grub_usbms_transfer’: > /home/seanius/grub2-1.98+20100602/disk/usbms.c:315: error: format ‘%02x’ expects type ‘unsigned int’, but argument 5 has type ‘grub_size_t’ > /home/seanius/grub2-1.98+20100602/disk/usbms.c:333: error: format ‘%02x’ expects type ‘unsigned int’, but argument 5 has type ‘grub_size_t’ > make[1]: *** [usbms_mod-disk_usbms.o] Error 1 > > the two lines in question are both debug printf type statements. > therefore, instead of doing something complicated to get the format > string to match with the size of grub_size_t (which i'm guessing could > vary based on the platform), i have created a patch that simply casts the > parameter in question as unsigned to match the format string instead (which > only shows two digits anyway). As Vladimir pointed out on IRC: no, that's a minimum field width, not a precision. It shows *at least* two digits. I think I'd prefer to add a grub_printf length modifier to print grub_size_t values. 'z' is standard for size_t, so it seems reasonable to use that, it can be done in very little code, and it saves on ugly and inaccurate casts. Vladimir, what do you think? (If this is unacceptable for whatever reason, then the proper fix would be to cast to (unsigned long long) and to use %02llx - but I prefer having an accurate length modifier, really.) 2010-06-04 Colin Watson * kern/misc.c (grub_vsnprintf_real): Support 'z' length modifier, for grub_size_t. * disk/usbms.c (grub_usbms_transfer): Use it. === modified file 'disk/usbms.c' --- disk/usbms.c 2010-06-01 00:10:19 +0000 +++ disk/usbms.c 2010-06-04 12:04:11 +0000 @@ -312,7 +312,7 @@ grub_usbms_transfer (struct grub_scsi *s grub_dprintf ("usb", "buf:\n"); if (size <= 64) for (i=0; i