Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NCK3B-0008FY-Hl for mharc-grub-devel@gnu.org; Sun, 22 Nov 2009 16:32:53 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCK39-0008Be-A1 for grub-devel@gnu.org; Sun, 22 Nov 2009 16:32:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCK34-00086i-Lq for grub-devel@gnu.org; Sun, 22 Nov 2009 16:32:50 -0500 Received: from [199.232.76.173] (port=49762 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCK34-00086P-Cu for grub-devel@gnu.org; Sun, 22 Nov 2009 16:32:46 -0500 Received: from xvm-190-8.ghst.net ([217.70.190.8]:41757 helo=aybabtu.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NCK33-0001yQ-Th for grub-devel@gnu.org; Sun, 22 Nov 2009 16:32:46 -0500 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtp (Exim 4.69) (envelope-from ) id 1NCK30-0006Ny-Vj for grub-devel@gnu.org; Sun, 22 Nov 2009 22:32:44 +0100 Received: from rmh by thorin with local (Exim 4.69) (envelope-from ) id 1NCK2y-0003Rb-Sq for grub-devel@gnu.org; Sun, 22 Nov 2009 22:32:40 +0100 Date: Sun, 22 Nov 2009 22:32:40 +0100 From: Robert Millan To: The development of GNU GRUB Message-ID: <20091122213240.GA13203@thorin> References: <20091122171919.GD11942@pina.cat> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091122171919.GD11942@pina.cat> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: errno handling 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: Sun, 22 Nov 2009 21:32:51 -0000 On Sun, Nov 22, 2009 at 05:19:19PM +0000, Carles Pina i Estany wrote: > > Hello, > > Last night I spent some time with a confussion that maybe it can be > avoided (or maybe not). > > Let's say that a module calls grub_file_open and it fails (file doesn't > exist or whatever). grub_errno is setted up. > > This module is not resetting grub_errno and makes another call to > grub_file_open with a valid file. But grub_file_open does: In theory, each layer should check errno after a call that may be setting it. It's up to the layer whether errno has to be ignored (and reset), handled or passed to the upper layer. If it's completely unchecked (i.e. not even reset), I think this is a bug. As you observed, it's a bit nasty; it can cause a routine to fail with an error that's completely unrelated to what the routine itself does. Help is much welcome on cleaning this kind of problems up. But it needs to be done carefully; it's very easy to unadvertedly work around the problem instead of fixing it (this happened sometimes in the past when sorting out errno handling problems). -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."