Blame SOURCES/0044-do-not-set-default-prefix-in-grub-mkimage.patch

d41074
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
a85e8e
From: Andrey Borzenkov <arvidjaar@gmail.com>
a85e8e
Date: Sat, 25 Jan 2014 19:54:51 +0400
d41074
Subject: [PATCH] do not set default prefix in grub-mkimage
a85e8e
a85e8e
Default prefix is likely wrong on Unix and completely wrong on Windows.
a85e8e
Let caller set it explicitly to avoid any ambiguity.
a85e8e
---
a85e8e
 util/grub-mkimage.c | 16 +++++++++++-----
d41074
 ChangeLog           |  4 ++++
a85e8e
 2 files changed, 15 insertions(+), 5 deletions(-)
a85e8e
a85e8e
diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c
d41074
index a2bd4c196e5..1e0bcf1bf4f 100644
a85e8e
--- a/util/grub-mkimage.c
a85e8e
+++ b/util/grub-mkimage.c
a85e8e
@@ -64,7 +64,7 @@ static struct argp_option options[] = {
a85e8e
   {"directory",  'd', N_("DIR"), 0,
a85e8e
    /* TRANSLATORS: platform here isn't identifier. It can be translated.  */
a85e8e
    N_("use images and modules under DIR [default=%s/<platform>]"), 0},
a85e8e
-  {"prefix",  'p', N_("DIR"), 0, N_("set prefix directory [default=%s]"), 0},
a85e8e
+  {"prefix",  'p', N_("DIR"), 0, N_("set prefix directory"), 0},
a85e8e
   {"memdisk",  'm', N_("FILE"), 0,
a85e8e
    /* TRANSLATORS: "memdisk" here isn't an identifier, it can be translated.
a85e8e
     "embed" is a verb (command description).  "*/
a85e8e
@@ -93,8 +93,6 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
a85e8e
     {
a85e8e
     case 'd':
a85e8e
       return xasprintf (text, grub_util_get_pkglibdir ());
a85e8e
-    case 'p':
a85e8e
-      return xasprintf (text, DEFAULT_DIRECTORY);
a85e8e
     case 'O':
a85e8e
       {
a85e8e
 	char *formats = grub_install_get_image_targets_string (), *ret;
a85e8e
@@ -268,6 +266,15 @@ main (int argc, char *argv[])
a85e8e
       exit(1);
a85e8e
     }
a85e8e
 
a85e8e
+  if (!arguments.prefix)
a85e8e
+    {
a85e8e
+      char *program = xstrdup(program_name);
a85e8e
+      printf ("%s\n", _("Prefix not specified (use the -p option)."));
a85e8e
+      argp_help (&argp, stderr, ARGP_HELP_STD_USAGE, program);
a85e8e
+      free (program);
a85e8e
+      exit(1);
a85e8e
+    }
a85e8e
+
a85e8e
   if (arguments.output)
a85e8e
     {
a85e8e
       fp = grub_util_fopen (arguments.output, "wb");
a85e8e
@@ -287,8 +294,7 @@ main (int argc, char *argv[])
a85e8e
       strcpy (ptr, dn);
a85e8e
     }
a85e8e
 
a85e8e
-  grub_install_generate_image (arguments.dir,
a85e8e
-			       arguments.prefix ? : DEFAULT_DIRECTORY, fp,
a85e8e
+  grub_install_generate_image (arguments.dir, arguments.prefix, fp,
a85e8e
 			       arguments.output, arguments.modules,
a85e8e
 			       arguments.memdisk, arguments.pubkeys,
a85e8e
 			       arguments.npubkeys, arguments.config,
d41074
diff --git a/ChangeLog b/ChangeLog
d41074
index e149d8ef33d..b405b7ee5bd 100644
d41074
--- a/ChangeLog
d41074
+++ b/ChangeLog
d41074
@@ -1,3 +1,7 @@
d41074
+2014-01-25  Andrey Borzenkov <arvidjaar@gmail.com>
d41074
+
d41074
+	* util/grub-mkimage.c: Make prefix argument mandatory.
d41074
+
d41074
 2014-01-24  Vladimir Serbinenko  <phcoder@gmail.com>
d41074
 
d41074
 	Fix several translatable strings.