All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] allow ls to handle device names containing '/' characters
@ 2004-09-14  0:56 Hollis Blanchard
  2004-09-14  9:01 ` Yoshinori K. Okuji
  0 siblings, 1 reply; 4+ messages in thread
From: Hollis Blanchard @ 2004-09-14  0:56 UTC (permalink / raw)
  To: The development of GRUB 2

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

I don't know if there are other commands that need to be modified in a 
similar manner; I have only tried ls.

2004-09-13	Hollis Blanchard	<hollis@penguinppc.org>

	* commands/ls.c (grub_ls_list_files): skip past ')' before searching 
for '/' as a
	filesystem path

-Hollis

[-- Attachment #2: 05-ls-slash.diff --]
[-- Type: application/octet-stream, Size: 490 bytes --]

Index: commands/ls.c
===================================================================
RCS file: /cvsroot/grub/grub2/commands/ls.c,v
retrieving revision 1.2
diff -u -r1.2 ls.c
--- commands/ls.c	4 Apr 2004 13:46:00 -0000	1.2
+++ commands/ls.c	14 Sep 2004 00:38:50 -0000
@@ -177,7 +177,8 @@
     goto fail;
 
   fs = grub_fs_probe (dev);
-  path = grub_strchr (dirname, '/');
+  path = grub_strchr (dirname, ')');
+  path = grub_strchr (path, '/');
 
   if (! path && ! device_name)
     {

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

* Re: [patch] allow ls to handle device names containing '/' characters
  2004-09-14  0:56 [patch] allow ls to handle device names containing '/' characters Hollis Blanchard
@ 2004-09-14  9:01 ` Yoshinori K. Okuji
  2004-09-14 14:58   ` Hollis Blanchard
  0 siblings, 1 reply; 4+ messages in thread
From: Yoshinori K. Okuji @ 2004-09-14  9:01 UTC (permalink / raw)
  To: The development of GRUB 2

On Tuesday 14 September 2004 02:56, Hollis Blanchard wrote:
> I don't know if there are other commands that need to be modified in
> a similar manner; I have only tried ls.

Your patch will fail if the name does not contain a device part. 
Shouldn't it be like this:

path = grub_strchr (dirname, ')');
if (! path)
  path = dirname;

Okuji



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

* Re: [patch] allow ls to handle device names containing '/' characters
  2004-09-14  9:01 ` Yoshinori K. Okuji
@ 2004-09-14 14:58   ` Hollis Blanchard
  2004-09-15  3:55     ` Hollis Blanchard
  0 siblings, 1 reply; 4+ messages in thread
From: Hollis Blanchard @ 2004-09-14 14:58 UTC (permalink / raw)
  To: The development of GRUB 2

On Sep 14, 2004, at 4:01 AM, Yoshinori K. Okuji wrote:

> On Tuesday 14 September 2004 02:56, Hollis Blanchard wrote:
>> I don't know if there are other commands that need to be modified in
>> a similar manner; I have only tried ls.
>
> Your patch will fail if the name does not contain a device part.
> Shouldn't it be like this:

Sorry, didn't realize that was possible. I haven't used GRUB much... :)

> path = grub_strchr (dirname, ')');
> if (! path)
>   path = dirname;
else
   path++;

With that else addition, it makes sense to me. If you can test that and 
check it in I would appreciate it, otherwise I will have to test it 
tonight.

-Hollis




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

* Re: [patch] allow ls to handle device names containing '/' characters
  2004-09-14 14:58   ` Hollis Blanchard
@ 2004-09-15  3:55     ` Hollis Blanchard
  0 siblings, 0 replies; 4+ messages in thread
From: Hollis Blanchard @ 2004-09-15  3:55 UTC (permalink / raw)
  To: The development of GRUB 2

On Sep 14, 2004, at 4:01 AM, Yoshinori K. Okuji wrote:
>
> Your patch will fail if the name does not contain a device part.

Here is the updated (and tested) patch.

2004-09-14	Hollis Blanchard	<hollis@penguinppc.org>

	* commands/ls.c (grub_ls_list_files): use the string following the 
initial ')', if present,
	as the filesystem path

-Hollis

Index: commands/ls.c
===================================================================
RCS file: /cvsroot/grub/grub2/commands/ls.c,v
retrieving revision 1.2
diff -u -r1.2 ls.c
--- commands/ls.c       4 Apr 2004 13:46:00 -0000       1.2
+++ commands/ls.c       15 Sep 2004 03:44:11 -0000
@@ -100,7 +100,7 @@
  {
    char *device_name;
    grub_fs_t fs;
-  char *path;
+  const char *path;
    grub_device_t dev;

    static int print_files (const char *filename, int dir)
@@ -177,7 +177,11 @@
      goto fail;

    fs = grub_fs_probe (dev);
-  path = grub_strchr (dirname, '/');
+  path = grub_strchr (dirname, ')');
+  if (! path)
+    path = dirname;
+  else
+    path++;

    if (! path && ! device_name)
      {




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

end of thread, other threads:[~2004-09-15  4:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-14  0:56 [patch] allow ls to handle device names containing '/' characters Hollis Blanchard
2004-09-14  9:01 ` Yoshinori K. Okuji
2004-09-14 14:58   ` Hollis Blanchard
2004-09-15  3:55     ` Hollis Blanchard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.