From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1U0ula-00067O-7H for mharc-grub-devel@gnu.org; Thu, 31 Jan 2013 09:05:26 -0500 Received: from eggs.gnu.org ([208.118.235.92]:33195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0ulX-00066z-Mg for grub-devel@gnu.org; Thu, 31 Jan 2013 09:05:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U0ulW-0000Y1-3Z for grub-devel@gnu.org; Thu, 31 Jan 2013 09:05:23 -0500 Received: from service87.mimecast.com ([91.220.42.44]:39506) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0ulV-0000Xt-RC for grub-devel@gnu.org; Thu, 31 Jan 2013 09:05:22 -0500 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 31 Jan 2013 14:05:07 +0000 Received: from [10.1.79.85] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 31 Jan 2013 14:04:58 +0000 Message-ID: <510A7A09.5090307@arm.com> Date: Thu, 31 Jan 2013 14:04:57 +0000 From: Leif Lindholm User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: Andrey Borzenkov Subject: Re: Trunk fails to build with -O References: <51096747.8080100@arm.com> <20130130234121.69db8dbb@opensuse.site> In-Reply-To: <20130130234121.69db8dbb@opensuse.site> X-OriginalArrivalTime: 31 Jan 2013 14:04:59.0025 (UTC) FILETIME=[F489C810:01CDFFBB] X-MC-Unique: 113013114050743801 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 91.220.42.44 Cc: The development of GNU GRUB X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 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: Thu, 31 Jan 2013 14:05:25 -0000 On 30/01/13 19:41, Andrey Borzenkov wrote: > =F7 Wed, 30 Jan 2013 18:32:39 +0000 > Leif Lindholm =D0=C9=DB=C5=D4: > >> Our Ubuntu (12.04/12.10) build environment defaults configuring with >> CFLAGS containing -O2. Trunk currently does not build successfully with >> this on either my ARM platform or my x86_64 desktop. > > I wonder why it did not happen before. Apparently, empty locale.h is > present since 2010-04-10 (rev 2311). Removing it fixes the problem, but > I presume it should not be empty in the first place. Thank you - I can confirm that this resolves the "gettext" portion of my=20 issue. Combined with the below (not suggested as a patch, simply to display the=20 issue clearly), trunk now builds with -O2 again. Regards, Leif =3D=3D=3D modified file 'grub-core/lib/crypto.c' --- grub-core/lib/crypto.c 2013-01-11 20:32:42 +0000 +++ grub-core/lib/crypto.c 2013-01-31 13:41:36 +0000 @@ -461,7 +461,8 @@ } else tty_changed =3D 0; - fgets (buf, buf_size, stdin); + if (fgets (buf, buf_size, stdin) =3D=3D NULL) + return 0; ptr =3D buf + strlen (buf) - 1; while (buf <=3D ptr && (*ptr =3D=3D '\n' || *ptr =3D=3D '\r')) *ptr-- =3D 0; =3D=3D=3D modified file 'util/ieee1275/ofpath.c' --- util/ieee1275/ofpath.c 2013-01-13 21:45:16 +0000 +++ util/ieee1275/ofpath.c 2013-01-31 13:49:44 +0000 @@ -143,7 +143,8 @@ size =3D st.st_size; of_path =3D xmalloc (size + MAX_DISK_CAT + 1); memset(of_path, 0, size + MAX_DISK_CAT + 1); - read(fd, of_path, size); + if (read(fd, of_path, size) < 1) + return NULL; close(fd); trim_newline(of_path); @@ -354,7 +355,8 @@ grub_util_error (_("cannot open `%s': %s"), path, strerror (errno)); memset (phy, 0, sizeof (phy)); - read (fd, phy, sizeof (phy)); + if (read (fd, phy, sizeof (phy)) < 1) + grub_util_warn (_("cannot read `%s': %s"), path, strerror (errno)); sscanf (phy, "%d", tgt); / Leif