grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] file: ignore host disk in blocklist check
       [not found] <NeKxEDn+XBwvdbqqBiQhSysUtD+GShojRNeZEa2p+r2DbDO2w@mail.gmail.com>
@ 2015-09-18 18:08 ` Andrei Borzenkov
  2015-09-19 12:58   ` Arch Stack
  2015-11-04 11:34   ` Vladimir 'phcoder' Serbinenko
  0 siblings, 2 replies; 3+ messages in thread
From: Andrei Borzenkov @ 2015-09-18 18:08 UTC (permalink / raw
  To: grub-devel; +Cc: Andrei Borzenkov, Arch Stack

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 <archstacker@gmail.com>
Also-By: Arch Stack <archstacker@gmail.com>

---
 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)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] file: ignore host disk in blocklist check
  2015-09-18 18:08 ` [PATCH] file: ignore host disk in blocklist check Andrei Borzenkov
@ 2015-09-19 12:58   ` Arch Stack
  2015-11-04 11:34   ` Vladimir 'phcoder' Serbinenko
  1 sibling, 0 replies; 3+ messages in thread
From: Arch Stack @ 2015-09-19 12:58 UTC (permalink / raw
  To: Andrei Borzenkov; +Cc: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]

It works!
Thank you!

On Sat, Sep 19, 2015 at 2:08 AM, Andrei Borzenkov <arvidjaar@gmail.com>
wrote:

> 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 <archstacker@gmail.com>
> Also-By: Arch Stack <archstacker@gmail.com>
>
> ---
>  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)
>

[-- Attachment #2: Type: text/html, Size: 2098 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] file: ignore host disk in blocklist check
  2015-09-18 18:08 ` [PATCH] file: ignore host disk in blocklist check Andrei Borzenkov
  2015-09-19 12:58   ` Arch Stack
@ 2015-11-04 11:34   ` Vladimir 'phcoder' Serbinenko
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2015-11-04 11:34 UTC (permalink / raw
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1683 bytes --]

Le 18 sept. 2015 8:09 PM, "Andrei Borzenkov" <arvidjaar@gmail.com> a écrit :
>
> 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 <archstacker@gmail.com>
> Also-By: Arch Stack <archstacker@gmail.com>
>
> ---
>  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
I don't particularly like this code but have no better idea. So go ahead,
just add a comment why it's needed
> +     )
>      /* This is a block list.  */
>      file->fs = &grub_fs_blocklist;
>    else
> --
> tg: (c93d3e6..) u/hostfs-windows (depends on: master)
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel

[-- Attachment #2: Type: text/html, Size: 2383 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-04 11:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <NeKxEDn+XBwvdbqqBiQhSysUtD+GShojRNeZEa2p+r2DbDO2w@mail.gmail.com>
2015-09-18 18:08 ` [PATCH] file: ignore host disk in blocklist check Andrei Borzenkov
2015-09-19 12:58   ` Arch Stack
2015-11-04 11:34   ` Vladimir 'phcoder' Serbinenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).