Re: [PATCH v2 1/3] Add 'compose' command

Subject: Re: [PATCH v2 1/3] Add 'compose' command

Date: Wed, 18 Apr 2012 20:10:47 +0400

To: Tomi Ollila, Felipe Contreras, Jani Nikula

Cc: Felipe Contreras, notmuch@notmuchmail.org

From: Dmitry Kurochkin


Tomi Ollila <tomi.ollila@iki.fi> writes:

> On Wed, Apr 18 2012, Felipe Contreras <felipe.contreras@gmail.com> wrote:
>
>> On Wed, Apr 18, 2012 at 5:20 PM, Jani Nikula <jani@nikula.org> wrote:
>>> On Wed, 18 Apr 2012 16:34:30 +0300, Felipe Contreras <felipe.contreras@gmail.com> wrote:
>>>> On Wed, Apr 18, 2012 at 4:06 PM, Jani Nikula <jani@nikula.org> wrote:
>>>>
>>>> > Running "notmuch compose" more than once within a second would result in
>>>> > identical message ids for the messages, which is not a good idea. That's
>>>> > not likely in interactive use, but the notmuch cli is highly scriptable,
>>>> > so someone is bound to hit this.
>>>> >
>>>> > Some paranoid might also be worried about "leaking" the time you run
>>>> > "notmuch compose"... which may be different from the actual time you
>>>> > send the message.
>>>>
>>>> It's still better than the current situation; nothing. In any case,
>>>> people that have not needed this would not be affected; their UI would
>>>> override the Message-ID.
>>>>
>>>> So do you have a better suggestion for a Message-ID?
>>>
>>> The easy way would be to just use g_mime_utils_generate_message_id()
>>> [1]. It doesn't give you any control of the part before @, but I'm not
>>> sure if that really matters.
>>
>> This is what gmime does:
>> g_strdup_printf ("%lu.%lu.%lu@%s", (unsigned long int) time (NULL),
>> (unsigned long int) getpid (), count++, fqdn);
>>
>> Which actually has some of the issues you mentioned.
>>
>> I can do the same if you want (add pid and count). The advantage of
>> using our own format is that not only would it be more unique, but it
>> would not have "@fqdn".
>
> getpid() is good. I guess count is useless (always one). Now some ideas
> how to obfuscate time(NULL) (nonce + hash (crc32 good enough?) ?
>

I think the best would be for notmuch to use the gmime function and
change gmime (open a bug, may be provide a patch) to follow the best
practice for Message-ID generation (I guess that would be the document
pointed by Jani [1]).

Regards,
  Dmitry

[1] http://www.jwz.org/doc/mid.html

> Tomi
>
>>
>>> Alternatively you can write your own according to e.g. [2]. Glib appears
>>> to have decent and portable support for pseudo random number
>>> generation. But why bother? I'd go with gmime.
>>
>> But gmime doesn't have anything random. I would actually prefer to
>> have something random though.
>
>
>
>>
>> -- 
>> Felipe Contreras
>> _______________________________________________
>> notmuch mailing list
>> notmuch@notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Thread: