grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH] normalize default prefix in grub-mkimage
Date: Tue, 21 Jan 2014 08:19:24 +0100	[thread overview]
Message-ID: <52DE1F7C.3080809@gmail.com> (raw)
In-Reply-To: <1388166076-10718-1-git-send-email-arvidjaar@gmail.com>

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

On 27.12.2013 18:41, Andrey Borzenkov wrote:
> This fixes bogus "C:\boot\grub" at runtime for Windows build as well as
> the case when /boot is on separate mount point for other systems.
> 
grub-mkimage shouldn't perform any FS-based resolving, that's job of the
caller. This default should either be hardwired to
"/"GRUB_BOOT_DIR_NAME"/"GRUB_DIR_NAME
or perhaps even to "/boot/grub" or default should be killed altogether.
> ---
>  util/grub-mkimage.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c
> index a2bd4c1..4d54f0a 100644
> --- a/util/grub-mkimage.c
> +++ b/util/grub-mkimage.c
> @@ -84,6 +84,7 @@ static struct argp_option options[] = {
>    { 0, 0, 0, 0, 0, 0 }
>  };
>  
> +static char *default_prefix;
>  #pragma GCC diagnostic ignored "-Wformat-nonliteral"
>  
>  static char *
> @@ -94,7 +95,7 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
>      case 'd':
>        return xasprintf (text, grub_util_get_pkglibdir ());
>      case 'p':
> -      return xasprintf (text, DEFAULT_DIRECTORY);
> +      return xasprintf (text, default_prefix);
>      case 'O':
>        {
>  	char *formats = grub_install_get_image_targets_string (), *ret;
> @@ -245,6 +246,7 @@ main (int argc, char *argv[])
>  
>    grub_util_host_init (&argc, &argv);
>  
> +  default_prefix = grub_make_system_path_relative_to_its_root (DEFAULT_DIRECTORY);
>    memset (&arguments, 0, sizeof (struct arguments));
>    arguments.comp = GRUB_COMPRESSION_AUTO;
>    arguments.modules_max = argc + 1;
> @@ -252,6 +254,7 @@ main (int argc, char *argv[])
>  			     * sizeof (arguments.modules[0]));
>    memset (arguments.modules, 0, (arguments.modules_max + 1)
>  	  * sizeof (arguments.modules[0]));
> +  arguments.prefix = xstrdup (default_prefix);
>  
>    if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0)
>      {
> @@ -287,8 +290,7 @@ main (int argc, char *argv[])
>        strcpy (ptr, dn);
>      }
>  
> -  grub_install_generate_image (arguments.dir,
> -			       arguments.prefix ? : DEFAULT_DIRECTORY, fp,
> +  grub_install_generate_image (arguments.dir, arguments.prefix, fp,
>  			       arguments.output, arguments.modules,
>  			       arguments.memdisk, arguments.pubkeys,
>  			       arguments.npubkeys, arguments.config,
> @@ -298,6 +300,8 @@ main (int argc, char *argv[])
>    grub_util_file_sync  (fp);
>    fclose (fp);
>  
> +  free (default_prefix);
> +
>    if (arguments.dir)
>      free (arguments.dir);
>  
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 274 bytes --]

  reply	other threads:[~2014-01-21  8:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-27 17:41 [PATCH] normalize default prefix in grub-mkimage Andrey Borzenkov
2014-01-21  7:19 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2014-01-21 16:48   ` Andrey Borzenkov
2014-01-22 15:07     ` Vladimir 'φ-coder/phcoder' Serbinenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52DE1F7C.3080809@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).