Received: from list by lists.gnu.org with archive (Exim 4.71) id 1buJYz-0008MR-Oa for mharc-grub-devel@gnu.org; Wed, 12 Oct 2016 09:27:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buJYx-0008Kp-2O for grub-devel@gnu.org; Wed, 12 Oct 2016 09:27:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buJYs-0000OT-PW for grub-devel@gnu.org; Wed, 12 Oct 2016 09:27:14 -0400 Received: from ao2.it ([92.243.12.208]:33175) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buJYs-0000LN-JY for grub-devel@gnu.org; Wed, 12 Oct 2016 09:27:10 -0400 Received: from localhost ([::1] helo=jcn) by ao2.it with smtp (Exim 4.84_2) (envelope-from ) id 1buJYk-0005dQ-Le; Wed, 12 Oct 2016 15:27:02 +0200 Date: Wed, 12 Oct 2016 15:27:01 +0200 From: Antonio Ospite To: grub-devel@gnu.org Cc: Antonio Ospite Subject: Re: [RFC PATCH 0/2] grub-probe: improve message when disk cannot be opened Message-Id: <20161012152701.bb0e3aceae6df7a6ac7c1afd@ao2.it> In-Reply-To: <20160905214030.a28026a19199c9c0eccd5870@ao2.it> References: <20160823101728.18774-1-ao2@ao2.it> <20160905214030.a28026a19199c9c0eccd5870@ao2.it> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 92.243.12.208 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 13:27:16 -0000 On Mon, 5 Sep 2016 21:40:30 +0200 Antonio Ospite wrote: > Ping. > > two weeks ago I sent the patches referenced in the message below and > I haven't received a reply yet. > Hi, another month has passed, has anyone had a chance to take a look? As said in the original message quoted below the issue is also described in https://savannah.gnu.org/bugs/?42409 Thanks, Antonio > > On Tue, 23 Aug 2016 12:17:26 +0200 > Antonio Ospite wrote: > > > Hi, > > > > right now when running grub-probe and the disk cannot be opened the > > error message can be misleading, it always says "disk not found" but in > > some case the disk may exist but the user has no permissions to open > > it, see https://savannah.gnu.org/bugs/?42409 > > > > The message can be improved by propagating informations about the cause > > of the failure from the bottom layers. > > > > Please take a look at the patches in this series, I marked them RFC > > because I am new to grub code and I am not sure that all the error paths > > set a meaningful message, but I wanted some code to base the discussion > > on. > > > > Patch 1/2 aims to prevent overriding the error messages from the > > disk->open() methods called in grub_disk_open(). > > > > Patch 2/2 exposes to the user the —now more informative— message from > > grub_disk_open(). > > > > Before these changes I was getting this output when running grub-probe > > with insufficient permissions: > > > > $ LANG=C ./grub-probe / > > ./grub-probe: warning: disk does not exist, so falling back to partition device /dev/sda1. > > ./grub-probe: warning: disk does not exist, so falling back to partition device /dev/sda1. > > ./grub-probe: warning: disk does not exist, so falling back to partition device /dev/sda1. > > ./grub-probe: error: disk `hostdisk//dev/sda1' not found. > > > > > > After the patches the reason of the failure is clearer: > > > > $ LANG=C ./grub-probe / > > ./grub-probe: warning: cannot open `/dev/sda': Permission denied, so falling back to partition device /dev/sda1. > > ./grub-probe: warning: cannot open `/dev/sda': Permission denied, so falling back to partition device /dev/sda1. > > ./grub-probe: warning: cannot open `/dev/sda': Permission denied, so falling back to partition device /dev/sda1. > > ./grub-probe: error: cannot open `/dev/sda1': Permission denied. > > > > > > As I said, this is the final effect I am aiming for but I am not 100% > > sure my solution is complete. > > > > Thanks, > > Antonio > > > > > > Antonio Ospite (2): > > * grub-core/kern/disk.c: don't override grub_errmsg when > > grub_disk_open fails > > * util/getroot.c: improve error message when a disk cannot be opened > > > > grub-core/kern/disk.c | 3 +-- > > util/getroot.c | 15 +++++++++------ > > 2 files changed, 10 insertions(+), 8 deletions(-) > > > -- Antonio Ospite https://ao2.it https://twitter.com/ao2it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing?