From: Andrei Borzenkov <arvidjaar@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH v3 2/3] mkrescue: add argument --fixed-time to get reproducible uuids
Date: Tue, 15 Dec 2015 18:46:03 +0300 [thread overview]
Message-ID: <567035BB.7050204@gmail.com> (raw)
In-Reply-To: <566EDEB8.6050003@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3591 bytes --]
14.12.2015 18:22, Vladimir 'φ-coder/phcoder' Serbinenko пишет:
> 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 for
> mkrescue we always use UUID. We need to find a way to reliably find boot
> 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.
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;
>>
>> static void
>> xorriso_push (const char *val)
>> @@ -110,6 +111,7 @@ static struct argp_option options[] = {
>> {"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. Disables HFS+, APM, ARCS and boot as disk image for i386-pc"), 2},
>> {"arcs-boot", OPTION_ARCS_BOOT, 0, 0, N_("enable ARCS (big-endian mips machines, mostly SGI) boot. Disables HFS+, APM, sparc64 and boot as disk 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}
>> };
>>
>> @@ -153,6 +155,8 @@ enum {
>> static error_t
>> 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 = xstrdup (arg);
>> return 0;
>>
>> + case 't':
>> + fixed_time = strtoll (arg, &b, 10);
>> + if (*b !='\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[])
>>
>> pkgdatadir = grub_util_get_pkgdatadir ();
>>
>> + fixed_time = -1;
>> product_name = xstrdup (PACKAGE_NAME);
>> product_version = xstrdup (PACKAGE_VERSION);
>> xorriso = xstrdup ("xorriso");
>> @@ -541,7 +555,7 @@ main (int argc, char *argv[])
>> {
>> time_t tim;
>> struct tm *tmm;
>> - tim = time (NULL);
>> + tim = fixed_time != -1 ? fixed_time : time (NULL);
>> tmm = gmtime (&tim);
>> iso_uuid = xmalloc (55);
>> grub_snprintf (iso_uuid, 50,
>>
>
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2015-12-15 15:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 16:10 [PATCH 0/3] reproducible builds Alexander Couzens
2015-12-04 16:10 ` [PATCH 1/3] mkstandalone: add argument --fixed-time to override mtime of files Alexander Couzens
2015-12-04 18:00 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-12-05 6:35 ` Andrei Borzenkov
2015-12-04 16:10 ` [PATCH 2/3] mkrescue: add argument --fixed-time to get reproducible uuids Alexander Couzens
2015-12-04 16:10 ` [PATCH 3/3] Makefile: use FIXED_TIMESTAMP for mkstandalone if set Alexander Couzens
2015-12-04 16:48 ` Alexander Couzens
2015-12-04 17:09 ` [PATCH] Makefile/coreboot use SOURCE_DATE_EPOCH as time source " Alexander Couzens
2015-12-04 18:01 ` [PATCH 3/3] Makefile: use FIXED_TIMESTAMP for mkstandalone " Vladimir 'φ-coder/phcoder' Serbinenko
2015-12-04 18:32 ` [PATCH v3 0/3] reproducible builds Alexander Couzens
2015-12-05 6:28 ` Andrei Borzenkov
2015-12-05 11:43 ` Alexander Couzens
2015-12-04 18:32 ` [PATCH v3 1/3] mkstandalone: add argument --fixed-time to override mtime of files Alexander Couzens
2015-12-14 14:47 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-12-04 18:32 ` [PATCH v3 2/3] mkrescue: add argument --fixed-time to get reproducible uuids Alexander Couzens
2015-12-14 15:22 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-12-15 15:46 ` Andrei Borzenkov [this message]
2015-12-15 16:02 ` Vladimir 'phcoder' Serbinenko
2015-12-15 16:48 ` Thomas Schmitt
2015-12-04 18:32 ` [PATCH v3 3/3] Makefile/coreboot use SOURCE_DATE_EPOCH as time source if set Alexander Couzens
2015-12-14 15:23 ` 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=567035BB.7050204@gmail.com \
--to=arvidjaar@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).