From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OKfDY-0007J0-Gx for mharc-grub-devel@gnu.org; Fri, 04 Jun 2010 18:18:20 -0400 Received: from [140.186.70.92] (port=60106 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKfDU-0007Av-RH for grub-devel@gnu.org; Fri, 04 Jun 2010 18:18:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OKfDQ-0006Pr-BJ for grub-devel@gnu.org; Fri, 04 Jun 2010 18:18:16 -0400 Received: from ey-out-1920.google.com ([74.125.78.145]:1621) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OKfDP-0006PN-Vz for grub-devel@gnu.org; Fri, 04 Jun 2010 18:18:12 -0400 Received: by ey-out-1920.google.com with SMTP id 13so318772eye.34 for ; Fri, 04 Jun 2010 15:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type; bh=lgBP8QcyQfef+Rl4pUhYS5uiNe75DYOP7eprLPqLajg=; b=xfoJK0krv18nvfWPVuVtmSacEtAfCgk8cTF6cmhLzjasMmt8LJmYlPYgTzrvzHB6Be W5ttUPx/C4deNQmT5tpoSvXhOg0wtoBKFmjQ/ysHnkL4xwOVWS9UQ9URw07QO5/QVnH9 VPPgmHTrvhW0QdPxeY5UQKluCW3oYfb3o6szM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; b=bXTm/7jrWEw0uudOooaT5d8W0r7EUaaiNNln5u4QVxvmaqbf08zLDdPwu/fFSM2d2m EmzlMg53UPjNT2P676HBo+AZbJTLBFQPzpOitHw8mkkkOKLMSU6ChtzCCrtk2kLvEnpJ wY6RLUf3mutR7BW4tM3x88n3CehizwfOwk9uU= Received: by 10.213.17.194 with SMTP id t2mr8536628eba.74.1275689890239; Fri, 04 Jun 2010 15:18:10 -0700 (PDT) Received: from debian.bg45.phnet (gprs01.swisscom-mobile.ch [193.247.250.1]) by mx.google.com with ESMTPS id 15sm975625ewy.8.2010.06.04.15.18.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 04 Jun 2010 15:18:08 -0700 (PDT) Message-ID: <4C097B95.8050605@gmail.com> Date: Sat, 05 Jun 2010 00:17:57 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100515 Icedove/3.0.4 MIME-Version: 1.0 To: The development of GNU GRUB References: <20100603192738.3783.6316.reportbug@rangda.seanius.net> <20100604120928.GY21862@riva.ucam.org> In-Reply-To: <20100604120928.GY21862@riva.ucam.org> X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigDFE41EB1C414997E1091BA15" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: =?utf-8?q?Re=3A_Bug=23584474=3A_FTBFS=3A_usbms=2Ec=3A315=3A_erro?= =?utf-8?b?cjogZm9ybWF0IOKAmCUwMnjigJkgZXhwZWN0cyB0eXBlIOKAmHVuc2lnbmVk?= =?utf-8?b?IGludOKAmQ==?= 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 22:18:18 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDFE41EB1C414997E1091BA15 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/04/2010 02:09 PM, Colin Watson wrote: > On Thu, Jun 03, 2010 at 09:27:38PM +0200, sean finney wrote: > =20 >> while investigated an unrelated bug, i noticed that the latest snapsho= t >> uploaded to debian fails with the following error: >> >> gcc-4.4 -Idisk -I/home/seanius/grub2-1.98+20100602/disk -I/home/seaniu= s/grub2-1.98+20100602/include -I. -I./include -Wall -W -ffreestanding -= Os -DGRUB_MACHINE_EMU=3D1 -DMACHINE=3DX86_64_EMU -Wall -W -Wshadow -Wpoin= ter-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes= -g -fno-dwarf2-cfi-asm -m64 -fno-stack-protector -mno-stack-arg-probe -W= error -DGRUB_TARGET_NO_MODULES=3D1 -DUSE_ASCII_FAILBACK=3D1 -DGRUB_FILE=3D= \"disk/usbms.c\" -MD -c -o usbms_mod-disk_usbms.o /home/seanius/grub2-1.9= 8+20100602/disk/usbms.c >> cc1: warnings being treated as errors >> /home/seanius/grub2-1.98+20100602/disk/usbms.c: In function =E2=80=98g= rub_usbms_transfer=E2=80=99: >> /home/seanius/grub2-1.98+20100602/disk/usbms.c:315: error: format =E2=80= =98%02x=E2=80=99 expects type =E2=80=98unsigned int=E2=80=99, but argumen= t 5 has type =E2=80=98grub_size_t=E2=80=99 >> /home/seanius/grub2-1.98+20100602/disk/usbms.c:333: error: format =E2=80= =98%02x=E2=80=99 expects type =E2=80=98unsigned int=E2=80=99, but argumen= t 5 has type =E2=80=98grub_size_t=E2=80=99 >> 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). >> =20 > 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? > > =20 grub_size_t is always of the same length as long. Perhaps we should define it as unsigned long, use "%lx" and get rid of useless difference on 32-bit and 64-bit platforms. Are there any reasons not to do this way? Alternatively %zx can be aliased to %lx in one code line. > (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. > > =3D=3D=3D 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 <=3D 64) > for (i=3D0; i - grub_dprintf ("usb", "0x%02x: 0x%02x\n", i, buf[i]); > + grub_dprintf ("usb", "0x%02zx: 0x%02x\n", i, buf[i]); > else > grub_dprintf ("usb", "Too much data for debug print...\n"); > } > @@ -330,7 +330,7 @@ grub_usbms_transfer (struct grub_scsi *s > /* Debug print of sent data. */ > if (size <=3D 256) > for (i=3D0; i - grub_dprintf ("usb", "0x%02x: 0x%02x\n", i, buf[i]); > + grub_dprintf ("usb", "0x%02zx: 0x%02x\n", i, buf[i]); > else > grub_dprintf ("usb", "Too much data for debug print...\n"); > } > > =3D=3D=3D modified file 'kern/misc.c' > --- kern/misc.c 2010-05-28 13:48:45 +0000 > +++ kern/misc.c 2010-06-04 12:04:11 +0000 > @@ -688,6 +688,7 @@ grub_vsnprintf_real (char *str, grub_siz > int n; > int longfmt =3D 0; > int longlongfmt =3D 0; > + int sizetfmt =3D 0; > int unsig =3D 0; > =20 > if (*fmt && *fmt =3D=3D'-') > @@ -740,6 +741,11 @@ grub_vsnprintf_real (char *str, grub_siz > c =3D *fmt++; > } > } > + else if (c =3D=3D 'z') > + { > + sizetfmt =3D 1; > + c =3D *fmt++; > + } > =20 > switch (c) > { > @@ -770,6 +776,11 @@ grub_vsnprintf_real (char *str, grub_siz > long l =3D va_arg (args, long); > grub_lltoa (tmp, c, l); > } > + else if (sizetfmt) > + { > + grub_size_t sz =3D va_arg (args, grub_size_t); > + grub_lltoa (tmp, c, sz); > + } > else if (unsig) > { > unsigned u =3D va_arg (args, unsigned); > > Thanks, > > =20 --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enigDFE41EB1C414997E1091BA15 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAkwJe50ACgkQNak7dOguQglumwEAlDXrgMUZIjoB90HLdYZp2RC7 1Li4uQbvx9S8WRRzm1sA/RHQjdkD6yAH9Y54wak+KFcvNfHm4cPNJGbqKnN3jMIf =yPMv -----END PGP SIGNATURE----- --------------enigDFE41EB1C414997E1091BA15--