Skip to contentSkip to conversation

grub-probe without arguments

PATCH Robert Millan 3 participants 6 messages May 7, 2007 – May 9, 2007

lore
Share & tools
lore
#0 lore raw

I think it would be reasonable to allow grub-probe to work without arguments. Any comments?

Signature · 4 lines
Robert Millan

My spam trap is [email protected].  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.

Index: util/i386/pc/grub-probe.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probe.c,v retrieving revision 1.4

i386/pc/grub-probe.c +8 -6
diff -u -r1.4 grub-probe.c
@@ -229,17 +252,19 @@
   /* Obtain PATH.  */
   if (optind >= argc)
     {
-      fprintf (stderr, "No path is specified.\n");
-      usage (1);
+      path = DEFAULT_DIRECTORY;
+    }
+  else
+    {
+      path = argv[optind];
+      optind++;
     }
 
-  if (optind + 1 != argc)
+  if (optind != argc)
     {
-      fprintf (stderr, "Unknown extra argument `%s'.\n", argv[optind + 1]);
+      fprintf (stderr, "Unknown extra argument `%s'.\n", argv[optind]);
       usage (1);
     }
-
-  path = argv[optind];
   
   /* Initialize the emulated biosdisk driver.  */
   grub_util_biosdisk_init (dev_map ? : DEFAULT_DEVICE_MAP);
#1 lore raw
Quoted 2 lines · Robert Millan

I think it would be reasonable to allow grub-probe to work without arguments. Any comments?

Why do you think so? If you want to omit the argument, I think the Unix way is to default to current dir.

Okuji

#2 lore raw
Quoted 5 lines · Yoshinori K. Okuji
Quoted 2 lines · Robert Millan

I think it would be reasonable to allow grub-probe to work without arguments. Any comments?

Why do you think so?

Because it's commonly invoked while debugging. The uninitiated might have some trouble figuring out the right parameter (specialy if they're not debugging themselves, but providing information for someone else to debug e.g. via BTS).

Quoted 2 lines

If you want to omit the argument, I think the Unix way is to default to current dir.

I think that would make it even worse, because user might be in a directory that belongs to another filesystem and have no idea what is going on.

Signature · 4 lines
Robert Millan

My spam trap is [email protected].  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.
#3 lore raw
Quoted 11 lines · Robert Millan
Quoted 5 lines · Yoshinori K. Okuji
Quoted 2 lines · Robert Millan

I think it would be reasonable to allow grub-probe to work without arguments. Any comments?

Why do you think so?

Because it's commonly invoked while debugging. The uninitiated might have some trouble figuring out the right parameter (specialy if they're not debugging themselves, but providing information for someone else to debug e.g. via BTS).

The right parameter depends on system status. For instance, if you are trying to install GRUB from an installer, and a boot partition is mounted at somewhere else (e.g. /mnt/boot), it won't work correctly, anyway. I prefer that grub-probe gets an argument explicitly, so that the user can at least understand that grub-probe probes a certain directory.

Okuji

#4 lore raw
Quoted 13 lines · Yoshinori K. Okuji
Quoted 11 lines · Robert Millan
Quoted 5 lines · Yoshinori K. Okuji
Quoted 2 lines · Robert Millan

I think it would be reasonable to allow grub-probe to work without arguments. Any comments?

Why do you think so?

Because it's commonly invoked while debugging. The uninitiated might have some trouble figuring out the right parameter (specialy if they're not debugging themselves, but providing information for someone else to debug e.g. via BTS).

Quoted 5 lines

The right parameter depends on system status. For instance, if you are trying to install GRUB from an installer, and a boot partition is mounted at somewhere else (e.g. /mnt/boot), it won't work correctly, anyway. I prefer that grub-probe gets an argument explicitly, so that the user can at least understand that grub-probe probes a certain directory.

I agree on that with Okuji. It'll get messy and difficult to guess if the calling result is right or not.

Signature · 8 lines
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: [email protected]      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."
#5 lore raw
In reply to Yoshinori K. Okuji
Quoted 13 lines · Yoshinori K. Okuji
Quoted 11 lines · Robert Millan
Quoted 5 lines · Yoshinori K. Okuji
Quoted 2 lines · Robert Millan

I think it would be reasonable to allow grub-probe to work without arguments. Any comments?

Why do you think so?

Because it's commonly invoked while debugging. The uninitiated might have some trouble figuring out the right parameter (specialy if they're not debugging themselves, but providing information for someone else to debug e.g. via BTS).

Quoted 5 lines

The right parameter depends on system status. For instance, if you are trying to install GRUB from an installer, and a boot partition is mounted at somewhere else (e.g. /mnt/boot), it won't work correctly, anyway. I prefer that grub-probe gets an argument explicitly, so that the user can at least understand that grub-probe probes a certain directory.

Ah, ok. I understand.

Signature · 4 lines
Robert Millan

My spam trap is [email protected].  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.