Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bc8mp-00076F-R4 for mharc-grub-devel@gnu.org; Tue, 23 Aug 2016 06:18:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bc8mn-00074H-I5 for grub-devel@gnu.org; Tue, 23 Aug 2016 06:18:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bc8mf-00050r-JY for grub-devel@gnu.org; Tue, 23 Aug 2016 06:18:25 -0400 Received: from smtp205.alice.it ([82.57.200.101]:53578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bc8mf-0004ue-6r for grub-devel@gnu.org; Tue, 23 Aug 2016 06:18:17 -0400 Received: from jcn (82.51.74.25) by smtp205.alice.it (8.6.060.28) id 57B41B310194079F; Tue, 23 Aug 2016 12:18:09 +0200 Received: from ao2 by jcn with local (Exim 4.87) (envelope-from ) id 1bc8mW-0004ta-8I; Tue, 23 Aug 2016 12:18:08 +0200 From: Antonio Ospite To: grub-devel@gnu.org Cc: Antonio Ospite Subject: [RFC PATCH 0/2] grub-probe: improve message when disk cannot be opened Date: Tue, 23 Aug 2016 12:17:26 +0200 Message-Id: <20160823101728.18774-1-ao2@ao2.it> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: Quoted-Printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.101 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: Tue, 23 Aug 2016 10:18:26 -0000 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 =E2=80=94now more informative=E2=80=94 = message from grub_disk_open(). Before these changes I was getting this output when running grub-probe with insufficient permissions: $ LANG=3DC ./grub-probe / ./grub-probe: warning: disk does not exist, so falling back to partitio= n device /dev/sda1. ./grub-probe: warning: disk does not exist, so falling back to partitio= n device /dev/sda1. ./grub-probe: warning: disk does not exist, so falling back to partitio= n device /dev/sda1. ./grub-probe: error: disk `hostdisk//dev/sda1' not found. After the patches the reason of the failure is clearer: $ LANG=3DC ./grub-probe / ./grub-probe: warning: cannot open `/dev/sda': Permission denied, so fa= lling back to partition device /dev/sda1. ./grub-probe: warning: cannot open `/dev/sda': Permission denied, so fa= lling back to partition device /dev/sda1. ./grub-probe: warning: cannot open `/dev/sda': Permission denied, so fa= lling 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(-) --=20 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?