From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1a8rnr-0007Rr-UC for mharc-grub-devel@gnu.org; Tue, 15 Dec 2015 10:46:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8rnp-0007RF-F7 for grub-devel@gnu.org; Tue, 15 Dec 2015 10:46:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8rnm-0002Lp-81 for grub-devel@gnu.org; Tue, 15 Dec 2015 10:46:13 -0500 Received: from mail-lf0-x230.google.com ([2a00:1450:4010:c07::230]:33281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8rnl-0002Ld-Si for grub-devel@gnu.org; Tue, 15 Dec 2015 10:46:10 -0500 Received: by mail-lf0-x230.google.com with SMTP id p203so9618329lfa.0 for ; Tue, 15 Dec 2015 07:46:09 -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=fVwFfbeHOmN6isK84/QPo2wmGqwCJ5VnYHVeo948SdM=; b=x9E4RVRDho1xq8oZd1tV1WN8Je8olkdGnUYbXs5WD2H5RYqc52wnNcj/nPECk3P05Q gcrHKDqM6XsEGG4rUwTct1BFvnFrAZObbnDwZaNs3QsYNiks+mzXVygTgzv99QeRLZl5 Qaupqh6yHyEnRi/mvxcWgEb03zG8w9s6i0T/lTG1g2JzRYFG9ywA498lNb6obGd7ijcK qSg6W/KExxoraOw0oNY9qJ23xHQc+XkLXMWwdUJ1miBi4scI4exPcYU7VanlJT3/fMwS 20THeglO6Q8Bi2ZgfJzi9/ojDbMYlZCKGh7J5XMlS81V4VOD267cV5d8WeVKr1WPrKw7 pBRQ== X-Received: by 10.25.33.149 with SMTP id h143mr6765758lfh.61.1450194368959; Tue, 15 Dec 2015 07:46:08 -0800 (PST) Received: from [192.168.1.41] (ppp91-76-25-247.pppoe.mtu-net.ru. [91.76.25.247]) by smtp.gmail.com with ESMTPSA id li2sm292304lbc.29.2015.12.15.07.46.07 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 15 Dec 2015 07:46:08 -0800 (PST) Subject: Re: [PATCH v3 2/3] mkrescue: add argument --fixed-time to get reproducible uuids To: grub-devel@gnu.org References: <1449253942-29510-1-git-send-email-lynxis@fe80.eu> <1449253942-29510-3-git-send-email-lynxis@fe80.eu> <566EDEB8.6050003@gmail.com> From: Andrei Borzenkov X-Enigmail-Draft-Status: N1110 Message-ID: <567035BB.7050204@gmail.com> Date: Tue, 15 Dec 2015 18:46:03 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <566EDEB8.6050003@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="iO9xdBn1Tehaf8CO8PsLcTXR85DTm1Ovl" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::230 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: Tue, 15 Dec 2015 15:46:14 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --iO9xdBn1Tehaf8CO8PsLcTXR85DTm1Ovl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 14.12.2015 18:22, Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0=B8= =D1=88=D0=B5=D1=82: > 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(-) >> > 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 fo= r > mkrescue we always use UUID. We need to find a way to reliably find boo= t > disk without depending on current time. Well, UUID of isofs used by GRUB is not unique in any sense, so it is not really much worse than it was before. Having reliable way to identify boot device imply some unique property of boot device which automatically conflict with idea of identical images= =2E But I am not sure we should stretch reproducible builds that far. ISO image created by grub-mkrescue is not binary. It even does not have well defined content, user is free to change modules list and other files that are part of ISO. >> 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_("us= e STRING as product version"), 2}, >> {"sparc-boot", OPTION_SPARC_BOOT, 0, 0, N_("enable sparc boot. Disa= bles HFS+, APM, ARCS and boot as disk image for i386-pc"), 2}, >> {"arcs-boot", OPTION_ARCS_BOOT, 0, 0, N_("enable ARCS (big-endian m= ips machines, mostly SGI) boot. Disables HFS+, APM, sparc64 and boot as d= isk 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_stat= e *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 >=20 >=20 >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >=20 --iO9xdBn1Tehaf8CO8PsLcTXR85DTm1Ovl 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.0.22 (GNU/Linux) iEYEARECAAYFAlZwNb4ACgkQR6LMutpd94wG9ACgzehfKAkg8ydrBPoEy0k+tId+ bkUAnjuYXc5oxAKNffpQyBlks9pUhfDk =Fbv2 -----END PGP SIGNATURE----- --iO9xdBn1Tehaf8CO8PsLcTXR85DTm1Ovl--