grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Mate Kukri <mate.kukri@canonical.com>
To: Daniel Kiper <dkiper@net-space.pl>
Cc: grub-devel@gnu.org, Julian Andres Klode <julian.klode@canonical.com>
Subject: Re: [PATCH v3] grub-install: Delay copying files to {grubdir, platdir} after install_device was validated.
Date: Thu, 23 Nov 2023 21:29:18 +0000	[thread overview]
Message-ID: <CAAfJHtobqWyKBokWuxdYiuQLc2Y+VJ59tnMv+k1f_8YjdQYkdw@mail.gmail.com> (raw)
In-Reply-To: <20231123183622.jllet5m2kizmt7gl@tomti.i.net-space.pl>

I believe this to be accidental, as the patch was developed in two
steps with one hunk added later. I believe it shouldn't make a
difference in functionality, but it is unnecessary and I will send
patch v4 tomorrow with the hunks in the original order.

On Thu, Nov 23, 2023 at 6:36 PM Daniel Kiper <dkiper@net-space.pl> wrote:
>
> On Wed, Nov 22, 2023 at 11:53:13AM +0000, Mate Kukri wrote:
> > Previously grub-install copied modules to grubdir before doing any validation on
> > the install_device.
> >
> > When grub-install was called with an invalid install_device, modules
> > were already copied to /boot before it found out and was forced to rely
> > on atexit rollback.
> >
> > This patch delays copying the modules after at least some install_device
> > validation was done, and thus reduces reliance on successful rollback.
> >
> > Signed-off-by: Mate Kukri <mate.kukri@canonical.com>
> > Reviewed-by: Julian Andres Klode <julian.klode@canonical.com>
> > ---
> >  util/grub-install.c | 38 ++++++++++++++++++++------------------
> >  1 file changed, 20 insertions(+), 18 deletions(-)
> >
> > diff --git a/util/grub-install.c b/util/grub-install.c
> > index 1ad04db36..8838fb677 100644
> > --- a/util/grub-install.c
> > +++ b/util/grub-install.c
> > @@ -1291,13 +1291,6 @@ main (int argc, char *argv[])
> >       }
> >      }
> >
> > -  grub_install_copy_files (grub_install_source_directory,
> > -                        grubdir, platform);
> > -
> > -  char *envfile = grub_util_path_concat (2, grubdir, "grubenv");
> > -  if (!grub_util_is_regular (envfile))
> > -    grub_util_create_envblk_file (envfile);
> > -
> >    size_t ndev = 0;
> >
> >    /* Write device to a variable so we don't have to traverse /dev every time.  */
> > @@ -1384,18 +1377,7 @@ main (int argc, char *argv[])
> >                      t);
> >      free (t);
> >    }
> > -  load_cfg = grub_util_path_concat (2, platdir,
> > -                               "load.cfg");
> > -
> > -  grub_util_unlink (load_cfg);
> >
> > -  if (debug_image && debug_image[0])
> > -    {
> > -      load_cfg_f = grub_util_fopen (load_cfg, "wb");
> > -      have_load_cfg = 1;
> > -      fprintf (load_cfg_f, "set debug='%s'\n",
> > -           debug_image);
> > -    }
> >    char *prefix_drive = NULL;
> >    char *install_drive = NULL;
> >
> > @@ -1419,6 +1401,26 @@ main (int argc, char *argv[])
> >       }
> >      }
> >
> > +  load_cfg = grub_util_path_concat (2, platdir,
> > +                                  "load.cfg");
> > +
> > +  grub_util_unlink (load_cfg);
> > +
> > +  if (debug_image && debug_image[0])
> > +    {
> > +      load_cfg_f = grub_util_fopen (load_cfg, "wb");
> > +      have_load_cfg = 1;
> > +      fprintf (load_cfg_f, "set debug='%s'\n",
> > +              debug_image);
> > +    }
> > +
> > +  grub_install_copy_files (grub_install_source_directory,
> > +                           grubdir, platform);
> > +
> > +  char *envfile = grub_util_path_concat (2, grubdir, "grubenv");
> > +  if (!grub_util_is_regular (envfile))
> > +    grub_util_create_envblk_file (envfile);
> > +
>
> I think changed order of hunks in this patch requires at least short
> explanation in the commit message.
>
> Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

      reply	other threads:[~2023-11-23 21:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 11:53 [PATCH v3] grub-install: Delay copying files to {grubdir, platdir} after install_device was validated Mate Kukri
2023-11-23 18:36 ` Daniel Kiper
2023-11-23 21:29   ` Mate Kukri [this message]

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=CAAfJHtobqWyKBokWuxdYiuQLc2Y+VJ59tnMv+k1f_8YjdQYkdw@mail.gmail.com \
    --to=mate.kukri@canonical.com \
    --cc=dkiper@net-space.pl \
    --cc=grub-devel@gnu.org \
    --cc=julian.klode@canonical.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).