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

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