Re: [Ksummit-discuss] Allowing something Change-Id (or something like it) in kernel commits

Greg Kroah-Hartman
2019-08-25T03:11:46Z

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

On Sat, Aug 24, 2019 at 07:04:47PM -0400, Theodore Y. Ts'o wrote:
> On Sat, Aug 24, 2019 at 11:11:32AM -0700, Linus Torvalds wrote:
> > The first time it gets magically and reliably created for you without
> > you having to do a single thing. The second time, you just look it up.
>
> Also, if you don't want to look it up, and want to have it generated
> "locally", the Message-Id is generated locally by git send-email.
> (That's right, Message-Id's are just as easy to generate locally as
> UUID's.) It will look like this:
>
> Message-Id: <20190824223355.12947-1-tytso@mit.edu>

I know we are getting "off-topic" here, but as people are sharing
scripts, it turns out that I have been generating my own "message-ids"
for the emails my scripts send out for accepted patches for years with
the attached simple script.

Odds are it was based on a bash script from akpm, but maybe it came from
somewhere else, I've had it around for so long the history of it is
long-lost.

> So if someone wants to make life easier for people who want to send
> out the V2 version of the patch, it would be possible for someone to
> write some tooling which saves the generated Message-Id by git
> send-email (and if you generate the message id and drop it into the
> files generated by git format-patch, git send-email will use the
> generated message id), so that can get used for the git commit
> description for the next version of the commit, this can be done in a
> completely automated way, without having to do any kind of lookups.

When accepting patches from people, my old scripts used to do this
properly and reply to the sent message-id. Now that I use git, that's
lost, except that I now am generating Link: tags in the commit message
itself, like:
Link: https://lore.kernel.org/r/20190822213659.5501-1-hsiangkao@aol.com

Hm, I guess I do now keep that info, and I can fix my scripts to
properly thread things, let me go work on that later today...

> As far as I'm concerned, Message-Id's or Link's are both strictly
> superior than a random 16-byte Change-Id UUID.

I totally agree, there's more data in a message-id than a change-id by
far.

Sorry Doug, but this thread turned out kind of like I expected it to,
hopefully you have been convinced better than I did when we spoke in
person :)

thanks,

greg k-h

[-- Attachment #2: make_message_id --]
[-- Type: text/plain, Size: 659 bytes --]

#!/usr/bin/perl

# we make a "fake" message id by taking the current number of seconds
# since the beginning of Unix time and tacking on two random numbers to
# the end, in case we are called quicker than 1 second since the last
# time we were called.

use strict;

my $date = `date "+\%s"`;
my $hostname = `hostname -d`;
chomp($date);
chomp($hostname);

my $pseudo_rand;

open FILE, "<:raw", "/dev/urandom" or die "Couldn't open /dev/urandom !";

sysread(FILE, $pseudo_rand, 1);
my $rand1 = ord($pseudo_rand);

sysread(FILE, $pseudo_rand, 1);
my $rand2 = ord($pseudo_rand);

my $message_id = "$date$rand1$rand2\@$hostname";
print "$message_id";

close FILE;