* git-send-email creates duplicate Message-Id's
[not found] <11900179463203-git-send-email-avi@qumranet.com>
@ 2007-09-17 15:59 ` Adrian Bunk
2007-09-17 20:22 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Adrian Bunk @ 2007-09-17 15:59 UTC (permalink / raw)
To: Avi Kivity; +Cc: linux-kernel, git
The following might be a bug in git-send-email (git maintainers Cc'ed
and KVM list removed from Cc):
Patch 54 got the same Message-Id as patch 61 and patch 89 got the same
Message-Id as patch 104.
That's not legal, and users who automatically filter duplicate emails
based on the Message-Id will not see two of the patches.
The emails are:
http://marc.info/?l=linux-kernel&m=119002061330270&w=2
http://marc.info/?l=linux-kernel&m=119002059626434&w=2
http://marc.info/?l=linux-kernel&m=119002060011801&w=2
http://marc.info/?l=linux-kernel&m=119002060318915&w=2
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git-send-email creates duplicate Message-Id's
2007-09-17 15:59 ` git-send-email creates duplicate Message-Id's Adrian Bunk
@ 2007-09-17 20:22 ` Junio C Hamano
2007-09-17 20:47 ` Matti Aarnio
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2007-09-17 20:22 UTC (permalink / raw)
To: Adrian Bunk; +Cc: Avi Kivity, linux-kernel, git
Adrian Bunk <bunk@kernel.org> writes:
> The following might be a bug in git-send-email (git maintainers Cc'ed
> and KVM list removed from Cc):
>
> Patch 54 got the same Message-Id as patch 61 and patch 89 got the same
> Message-Id as patch 104.
> ...
> The emails are:
> http://marc.info/?l=linux-kernel&m=119002061330270&w=2
> http://marc.info/?l=linux-kernel&m=119002059626434&w=2
> http://marc.info/?l=linux-kernel&m=119002060011801&w=2
> http://marc.info/?l=linux-kernel&m=119002060318915&w=2
The old code generated rand(4200) for each message and appended
it to the timestamp. I do not know where the original author
got 4200 from, but I think if you send many messages within a
single second it is possible to get collisions.
I guess something like this patch is an improvement? It
generates a single prefix from timestamp and random, and appends
a number that is incremented for each message.
---
diff --git a/git-send-email.perl b/git-send-email.perl
index dd7560b..e250732 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -477,10 +477,18 @@ sub extract_valid_address {
# We'll setup a template for the message id, using the "from" address:
+my ($message_id_stamp, $message_id_serial);
sub make_message_id
{
- my $date = time;
- my $pseudo_rand = int (rand(4200));
+ my $uniq;
+ if (!defined $message_id_stamp) {
+ $message_id_stamp = sprintf("%s-%s", time, int(rand(4200)));
+ $message_id_serial = 0;
+ }
+ $message_id_serial++;
+
+ $uniq = "$message_id_stamp-$message_id_serial";
+
my $du_part;
for ($sender, $repocommitter, $repoauthor) {
$du_part = extract_valid_address(sanitize_address($_));
@@ -490,8 +498,8 @@ sub make_message_id
use Sys::Hostname qw();
$du_part = 'user@' . Sys::Hostname::hostname();
}
- my $message_id_template = "<%s-git-send-email-$du_part>";
- $message_id = sprintf $message_id_template, "$date$pseudo_rand";
+ my $message_id_template = "<%s-git-send-email-%s>";
+ $message_id = sprintf($message_id_template, $uniq, $du_part);
#print "new message id = $message_id\n"; # Was useful for debugging
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: git-send-email creates duplicate Message-Id's
2007-09-17 20:22 ` Junio C Hamano
@ 2007-09-17 20:47 ` Matti Aarnio
0 siblings, 0 replies; 3+ messages in thread
From: Matti Aarnio @ 2007-09-17 20:47 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Adrian Bunk, Avi Kivity, linux-kernel, git
On Mon, Sep 17, 2007 at 01:22:05PM -0700, Junio C Hamano wrote:
> Adrian Bunk <bunk@kernel.org> writes:
>
> > The following might be a bug in git-send-email (git maintainers Cc'ed
> > and KVM list removed from Cc):
> >
> > Patch 54 got the same Message-Id as patch 61 and patch 89 got the same
> > Message-Id as patch 104.
> > ...
> > The emails are:
> > http://marc.info/?l=linux-kernel&m=119002061330270&w=2
> > http://marc.info/?l=linux-kernel&m=119002059626434&w=2
> > http://marc.info/?l=linux-kernel&m=119002060011801&w=2
> > http://marc.info/?l=linux-kernel&m=119002060318915&w=2
>
> The old code generated rand(4200) for each message and appended
> it to the timestamp. I do not know where the original author
> got 4200 from, but I think if you send many messages within a
> single second it is possible to get collisions.
>
> I guess something like this patch is an improvement? It
> generates a single prefix from timestamp and random, and appends
> a number that is incremented for each message.
Much better. You may also consider a possibility of
letting your local MTA do the Message-ID generation, unless
you are tracking something with it and thus need to know the
generated values. .. but apparently git much prefers sending
email by SMTP, where the message-id must be present, or one
really should block any such emails.. (except that systems
like qmail send error messages without message-id ...)
My own recipe is:
sprintf("%d-%d-%d", time , getpid, ++localsequence)
catenate on that your favourite domain name where that recipe
is likely to be valid, and you are all set.
/Matti Aarnio -- one of <postmaster@vger.kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-09-17 20:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <11900179463203-git-send-email-avi@qumranet.com>
2007-09-17 15:59 ` git-send-email creates duplicate Message-Id's Adrian Bunk
2007-09-17 20:22 ` Junio C Hamano
2007-09-17 20:47 ` Matti Aarnio
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).