Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Zd05i-0000sr-Ov for mharc-grub-devel@gnu.org; Fri, 18 Sep 2015 14:08:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zd05f-0000rE-P4 for grub-devel@gnu.org; Fri, 18 Sep 2015 14:08:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zd05a-0004cD-PD for grub-devel@gnu.org; Fri, 18 Sep 2015 14:08:55 -0400 Received: from mail-la0-x234.google.com ([2a00:1450:4010:c03::234]:34037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zd05a-0004bz-Hj for grub-devel@gnu.org; Fri, 18 Sep 2015 14:08:50 -0400 Received: by lahg1 with SMTP id g1so35633405lah.1 for ; Fri, 18 Sep 2015 11:08:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EdUmNrfyi2TfO92af80sC0ne4HU/5hlTGEK2jpR1QWA=; b=lgEXcO/DIJTQf0QafxgOKX/CFAhqoVCOpxtveLimj3ZFWEDCZIB3N1Dg/qgGnENdg3 rX3BwySW9kAiOWA5E6NsI+WTkcUsOtIjuT5uuQYoXfWHUhRhdsdGGVcas9RMhu0nF+Tn 9ChtfMuV1tEf4IY+9NlczDkaqbewPxYFs9CN7XVZ6HyxNUuLwrwJP5JgN0JPaTcL2eTc zhrn0YRNfCJi2/1MdZy7JmUhBcjekMfssGNjacpF7WIaQXv3UH2yq5cwP6m8S8dd5/ij plUOW4R1dDYajBqhf+vSwWWaQkkqPwb0FFwORcraQuBGacDSMM4TqEIzdsGo1RynH1up p95w== X-Received: by 10.152.23.234 with SMTP id p10mr3723741laf.21.1442599729698; Fri, 18 Sep 2015 11:08:49 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-142-206.pppoe.mtu-net.ru. [91.76.142.206]) by smtp.gmail.com with ESMTPSA id x1sm1526727lbb.32.2015.09.18.11.08.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Sep 2015 11:08:48 -0700 (PDT) From: Andrei Borzenkov To: grub-devel@gnu.org Subject: [PATCH] file: ignore host disk in blocklist check Date: Fri, 18 Sep 2015 21:08:42 +0300 Message-Id: <1442599722-29899-1-git-send-email-arvidjaar@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::234 Cc: Andrei Borzenkov , Arch Stack 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: Fri, 18 Sep 2015 18:08:56 -0000 It cannot work anyway because host disk cannot be read. This fixes hostfs access on native Windows build where filenames start with '\' or do not have initial separator at all (d:\foo). Issue was observed when running grub-fstest on Windows. On UNIX image name is canonicalized to always start with `/' so this was not noticed. This has side effect of allowing relative path names on host, but this already was the case with `ls' command, so it just extends it to all commands. Reported-By: Arch Stack Also-By: Arch Stack --- grub-core/kern/file.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c index 24da12b..3367485 100644 --- a/grub-core/kern/file.c +++ b/grub-core/kern/file.c @@ -89,7 +89,11 @@ grub_file_open (const char *name) file->device = device; - if (device->disk && file_name[0] != '/') + if (device->disk && file_name[0] != '/' +#if defined(GRUB_UTIL) || defined(GRUB_MACHINE_EMU) + && grub_strcmp (device->disk->name, "host") +#endif + ) /* This is a block list. */ file->fs = &grub_fs_blocklist; else -- tg: (c93d3e6..) u/hostfs-windows (depends on: master)