From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LWr2C-0006BR-Ea for mharc-grub-devel@gnu.org; Tue, 10 Feb 2009 06:44:12 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LWr29-0006AZ-Mk for grub-devel@gnu.org; Tue, 10 Feb 2009 06:44:09 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LWr28-00069w-7Y for grub-devel@gnu.org; Tue, 10 Feb 2009 06:44:09 -0500 Received: from [199.232.76.173] (port=58159 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LWr27-00069r-TA for grub-devel@gnu.org; Tue, 10 Feb 2009 06:44:07 -0500 Received: from mail-ew0-f20.google.com ([209.85.219.20]:64459) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LWr27-0004Mg-C0 for grub-devel@gnu.org; Tue, 10 Feb 2009 06:44:07 -0500 Received: by ewy13 with SMTP id 13so3503244ewy.18 for ; Tue, 10 Feb 2009 03:44:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:in-reply-to :references:content-type:date:message-id:mime-version:x-mailer; bh=q53OkA03r0dKdFj6Nel3+HOj1+YsSXHkpZrlG0Wc9L0=; b=iUpYdlQOxgG20ixu9zB/82oIn4N26qIzHiKRNrhS4M/b8sXSDDD9QrXCqFyO2qrU9k izwKcPsQvlbaSHg0n5inJdBQhqtKEZLxdEXaa3nzyzuo2LlnsVEjem8OqQOQzSSQzgdX xe6WfpcKvNg4QoiitUfHWd846vCMbKhGNdHHE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id :mime-version:x-mailer; b=eg8gCii1jt5/orWqzzUtHt5AwbLl7zy9vcWgkaBdYqTTCaEHAiadi7WfBg0ANKneUK 59lkF/56lrPjK8TwKjzFdBDNuWDWU2WHNtOM32urIRovMYOZTSYDxqbZMQLyTAwbyfFj 6I5RLFqwEiLa1g1sku6d2G9XnKFhmSm4BtOaU= Received: by 10.210.60.3 with SMTP id i3mr3231858eba.27.1234266245603; Tue, 10 Feb 2009 03:44:05 -0800 (PST) Received: from ?192.168.1.102? ([213.37.137.93]) by mx.google.com with ESMTPS id 7sm3939979eyg.57.2009.02.10.03.44.04 (version=SSLv3 cipher=RC4-MD5); Tue, 10 Feb 2009 03:44:05 -0800 (PST) From: Javier =?ISO-8859-1?Q?Mart=EDn?= To: The development of GRUB 2 In-Reply-To: <1234259444.3416.8.camel@fz.local> References: <1234225160.10940.25.camel@localhost> <1234259444.3416.8.camel@fz.local> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-nAhj1bvw/uFEauIDnmvn" Date: Tue, 10 Feb 2009 12:44:14 +0100 Message-Id: <1234266254.7325.12.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.24.3 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [PATCH] r1986 broke FAT detection X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Feb 2009 11:44:09 -0000 --=-nAhj1bvw/uFEauIDnmvn Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable El mar, 10-02-2009 a las 10:50 +0100, Felix Zielcke escribi=C3=B3: > Am Dienstag, den 10.02.2009, 01:19 +0100 schrieb Javier Mart=C3=ADn: > > At r1985, "sudo ./grub-probe -t fs -d /dev/fd0" outputs "fat" with a > > freshly-formatted VFAT floppy in the drive. At r1986, it spits "error: > > unknown filesystem". The cause is this error, repeated three times: > >=20 > > if (! grub_strncmp(something, "FAT12", 5)) > > goto fail; > >=20 > > Strncmp does not return a boolean result (i.e. matches or doesn't), but > > an _integer_ that is supposed to establish a comparison order between > > strings. Thus, a return value of 0 is actually a match. See why I insis= t > > on treating semantic-ints different than semantic-bools even though the > > language does not? The correction is obvious (a patch is attached): >=20 > Thanks for your patch. Commited. >=20 You're welcome. I see that nevertheless the "0 !=3D " comparisons were substituted for standard C int-to-bool-conversion-based comparisons. Maybe people should know the signature _and_ semantic contract of strncmp, but frequently they don't (I had to look it up in the handbook), and while the code that was committed may look like an "obvious error" to a wanderer (because, of course, comparison functions should return a semantic-bool, shouldn't they?), the version with the explicit "0 !=3D " checks at least looks like it was written like that _on purpose_ (and the actual binary cost should be zero with any sensible compiler), thus making future developers on bug-fixing quests at least scratch their heads before proposing the change to the "if (!strncmp)" error. So, keeping the coding style consistent is important, but I think a balance with readability is in order. Thus, you are the maintainers and you know what you're doing, but I think it's not worth to keep the coding style so strict as to become confusing. -- Lazy Oblivious, Rational Disaster -- Habbit --=-nAhj1bvw/uFEauIDnmvn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iQIcBAABAgAGBQJJkWiDAAoJEKSl+Fbdeo728XsP/2mla9z6kFZCsQ7slKvlGjR7 h0ixX8+HIgksWQwYujJCixacLnvVFv/lnq2I41d7/nKgOFrk1QTMoIST3XTRwIbf CY/YPVSY6h7vzAYJzvwI6n0ATFeySUH5W9YF6XtLeeVM0eBBR1qaJb7VzDNfaIOl zRlW6gGXncJtDVDZyu0uKHILamvWfEE0sKq8TdbvRd3sKJTdkhfg+Tw8e5uXqmX2 BYR6JDbO/Y4NbCJ7uLrP7bvnzhLai3iRLjmow8uLaJlrTB6mK9mwyjsHeD4uG3Mo 7YZGi4MlIAUIyzLJ3eJJ5F1qiLJO8hNrx5vAQwAEti+YxfTrDSXTiWQlgQqkvgFi jGzjckTbqsXNqs9Xb/C1ejp7dWH9iMkMXGkWjGNXbmPLd30jui/gpzY74BiepFpF AXeSi1uUzJ/XgxJ4Bn0JL1/GylwOiCy/N8koNqQbRbm/u9vHoWLeiTodaSnxwNNP jg1Gl5JdnNxuooKLiT3TcpHo6ztG0KIISLpXbt/IcLoesOm9gvb77YwlSrD0p6a1 2/OR9EqRe9WsbeVF3nTl2CdW9bjPXg2UKAyRRg5qm0PHLePdXOF1LsJ6OBGtZuzd pWs6qeGJsgodKjzDIhk1dr2uNwv9VJSOC9tiLfjW1+jSjc8Xe6jPWgKkhQF+/w81 9ur/VDhdhg1LpcV7mTLC =5CvI -----END PGP SIGNATURE----- --=-nAhj1bvw/uFEauIDnmvn--