Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bgzl9-0002fY-2C for mharc-grub-devel@gnu.org; Mon, 05 Sep 2016 15:40:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgzl6-0002de-Hm for grub-devel@gnu.org; Mon, 05 Sep 2016 15:40:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgzl1-0001Hb-E2 for grub-devel@gnu.org; Mon, 05 Sep 2016 15:40:43 -0400 Received: from ao2.it ([92.243.12.208]:42766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgzl1-0001EM-7b for grub-devel@gnu.org; Mon, 05 Sep 2016 15:40:39 -0400 Received: from localhost ([::1] helo=jcn) by ao2.it with smtp (Exim 4.84_2) (envelope-from ) id 1bgzkt-0003rn-0L; Mon, 05 Sep 2016 21:40:31 +0200 Date: Mon, 5 Sep 2016 21:40:30 +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: <20160905214030.a28026a19199c9c0eccd5870@ao2.it> In-Reply-To: <20160823101728.18774-1-ao2@ao2.it> References: <20160823101728.18774-1-ao2@ao2.it> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.30; 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: Mon, 05 Sep 2016 19:40:46 -0000 Ping. two weeks ago I sent the patches referenced in the message below and I haven't received a reply yet. Maybe sending them in the middle of August was not the best choice. :) Can anyone please take a look? Thanks. Ciao, 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 http://ao2.it 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?