From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1a8Uy3-0006nE-Rk for mharc-grub-devel@gnu.org; Mon, 14 Dec 2015 10:23:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8Uy0-0006j7-5M for grub-devel@gnu.org; Mon, 14 Dec 2015 10:23:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8Uxw-0002wG-4w for grub-devel@gnu.org; Mon, 14 Dec 2015 10:23:12 -0500 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:38495) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8Uxv-0002vx-Un for grub-devel@gnu.org; Mon, 14 Dec 2015 10:23:08 -0500 Received: by wmpp66 with SMTP id p66so65255422wmp.1 for ; Mon, 14 Dec 2015 07:23:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type; bh=L4MhtptXQK+c4StvspGoIYrfCau/qYBUZR3GnsuRWzI=; b=JlQVbYLk6p9L0VlzdsbSkRx4VJBdpkJehvBxI8Ode5eccGe9SmIxw2LkWkYobm7b5C daaBjd7lqJda6I3h8+AFmWa8ULwLEmZEABccvo1qlSevlpUALhEZ3l6txf2MpZr6RWLo tjVBLP+hQIO4ykPkbgw7I8KXOpfe98pnC4kvs2c2kcIQd+2U0RbfeX7hcGYs7IuIjpwf HJRKk/pM75UJy/mjg5Cjuv5Q9+IkkuhTai9OT/umIdVTRJP1CxFMODKe8+6KFd2kSpC5 KpgivpqRFZr6hhSiji4S5Gb5gOmN0ieOLOJnxY6CVPBaghiqBssAB32HGGPDTt2n+mHz JhYQ== X-Received: by 10.194.115.67 with SMTP id jm3mr38390841wjb.9.1450106563571; Mon, 14 Dec 2015 07:22:43 -0800 (PST) Received: from ?IPv6:2620:0:105f:fd00:a2a8:cdff:fe64:b3b5? ([2620:0:105f:fd00:a2a8:cdff:fe64:b3b5]) by smtp.gmail.com with ESMTPSA id w203sm16503554wmg.15.2015.12.14.07.22.41 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Dec 2015 07:22:41 -0800 (PST) Subject: Re: [PATCH v3 2/3] mkrescue: add argument --fixed-time to get reproducible uuids To: The development of GNU GRUB References: <1449253942-29510-1-git-send-email-lynxis@fe80.eu> <1449253942-29510-3-git-send-email-lynxis@fe80.eu> From: =?UTF-8?Q?Vladimir_'=cf=86-coder/phcoder'_Serbinenko?= X-Enigmail-Draft-Status: N1110 Message-ID: <566EDEB8.6050003@gmail.com> Date: Mon, 14 Dec 2015 16:22:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.3.0 MIME-Version: 1.0 In-Reply-To: <1449253942-29510-3-git-send-email-lynxis@fe80.eu> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="WxlP6fLrxQCTqV5iKOSvMnuHBxKd4AWnH" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::235 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Dec 2015 15:23:13 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WxlP6fLrxQCTqV5iKOSvMnuHBxKd4AWnH Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04.12.2015 19:32, Alexander Couzens wrote: > The uuid generation is based on the time. > --- > util/grub-mkrescue.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) >=20 This breaks uniqueness assumptions for UUID and we use UUID to find the right disk, as it's not possible to rely on passed boot disk on some platforms (I've just documented it in grub.texi and pushed it). Also for mkrescue we always use UUID. We need to find a way to reliably find boot disk without depending on current time. > diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c > index 4511826..1af1da2 100644 > --- a/util/grub-mkrescue.c > +++ b/util/grub-mkrescue.c > @@ -52,6 +52,7 @@ static int xorriso_arg_alloc; > static char **xorriso_argv; > static char *iso_uuid; > static char *iso9660_dir; > +static time_t fixed_time; > =20 > static void > xorriso_push (const char *val) > @@ -110,6 +111,7 @@ static struct argp_option options[] =3D { > {"product-version", OPTION_PRODUCT_VERSION, N_("STRING"), 0, N_("use= STRING as product version"), 2}, > {"sparc-boot", OPTION_SPARC_BOOT, 0, 0, N_("enable sparc boot. Disab= les HFS+, APM, ARCS and boot as disk image for i386-pc"), 2}, > {"arcs-boot", OPTION_ARCS_BOOT, 0, 0, N_("enable ARCS (big-endian mi= ps machines, mostly SGI) boot. Disables HFS+, APM, sparc64 and boot as di= sk image for i386-pc"), 2}, > + {"fixed-time", 0, N_("TIMEEPOCH"), 0, N_("use a fixed timestamp for = uuid generation"), 2}, > {0, 0, 0, 0, 0, 0} > }; > =20 > @@ -153,6 +155,8 @@ enum { > static error_t=20 > argp_parser (int key, char *arg, struct argp_state *state) > { > + char *b; > + > if (grub_install_parse (key, arg)) > return 0; > switch (key) > @@ -212,6 +216,15 @@ argp_parser (int key, char *arg, struct argp_state= *state) > xorriso =3D xstrdup (arg); > return 0; > =20 > + case 't': > + fixed_time =3D strtoll (arg, &b, 10); > + if (*b !=3D'\0') { > + printf (_("invalid fixed time number: %s\n"), arg); > + argp_usage (state); > + exit (1); > + } > + return 0; > + > default: > return ARGP_ERR_UNKNOWN; > } > @@ -431,6 +444,7 @@ main (int argc, char *argv[]) > =20 > pkgdatadir =3D grub_util_get_pkgdatadir (); > =20 > + fixed_time =3D -1; > product_name =3D xstrdup (PACKAGE_NAME); > product_version =3D xstrdup (PACKAGE_VERSION); > xorriso =3D xstrdup ("xorriso"); > @@ -541,7 +555,7 @@ main (int argc, char *argv[]) > { > time_t tim; > struct tm *tmm; > - tim =3D time (NULL); > + tim =3D fixed_time !=3D -1 ? fixed_time : time (NULL); > tmm =3D gmtime (&tim); > iso_uuid =3D xmalloc (55); > grub_snprintf (iso_uuid, 50, >=20 --WxlP6fLrxQCTqV5iKOSvMnuHBxKd4AWnH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iF4EAREKAAYFAlZu3rgACgkQmBXlbbo5nOs51AD/avjyxTmUDW5z72Ym9uOhIjb6 /uB+onqPFgX4QJRQtoIBAIJZtOGqr8houk2za0UjszaYN0jA92Te+yGbTEp69Stk =E4x0 -----END PGP SIGNATURE----- --WxlP6fLrxQCTqV5iKOSvMnuHBxKd4AWnH--