Subject: bug#23432: 25.0.93; Email from Gnus now going out with Message-IDs @gmail.com

From: [email-masked] (N. Jackson)
Date: Tue, 03 May 2016 21:59:56 -0300

At 16:13 -0400 on Tuesday 2016-05-03, Glenn Morris wrote:
>
> Please try edebugging message-make-fqdn to see what is going on.

Thanks Glenn.

* The problem is `system-name'

So it turns out that the change in behaviour is coming from a lower
level, from the function `system-name'

* Message-ID is being set as documented

Emacs is working as documented in (info "(message) News Headers"):

    ‘Message-ID’
         This required header will be generated by Message.  A unique ID
         will be created based on the date, time, user name (for the local
         part) and the domain part.  For the domain part, message will look
         (in this order) at ‘message-user-fqdn’, ‘system-name’,
         ‘mail-host-address’ and ‘message-user-mail-address’ (i.e.,
         ‘user-mail-address’) until a probably valid fully qualified domain
         name (FQDN) was found.

The first thing that looked at for a domain name is
`message-user-fqdn' which is nil on my system. Then `system-name' is
looked at.

On Emacs 24.5 `system-name' returns "moondust.localdomain". This
satisfies the search, and the Message-ID is reported as
[email-masked] (for some value xyz). This is what I have grown
to expect.

On Emacs 25.0.93 `system-name' returns "moondust". This does not satisfy
the search and so `mail-host-address' is looked at, but it is nil.
Finally, `message-user-mail-address' is tried. When Gnus has started,
this evaluates to my default email address "[email-masked]", and
so the Message-ID becomes [email-masked].

* Undesirable behaviour

This is undesirable, and is especially embarrassing when I send mail from
a non-gmail email address through a non-gmail SMTP server -- it still
shows a Message-ID [email-masked]!

* Potential workaround

Naturally, I can work around the change in behaviour by setting
`message-user-fqdn', or possibly (?) by changing my system's host name,
or possibly by setting `mail-host-address'.

* If there is to be no fix, is a NEWS item warranted?

However, if the new behaviour is not going to be "fixed", then I think
the change should be reported in NEWS. After all, this is rather
embarrassing and it is not immediately obvious that there's a problem --
my emails have been going out like that since the end of January and I
only noticed today.

* Is it a bug?

What is not clear to me, is if the new behaviour of `system-name' is a
bug or if it fixes a bug in Emacs 24. After all, IIUC my actual hostname is
moondust, not moondust.localhost. In any case, I expect the change of
behaviour is related to this entry in NEWS:

    ** Function 'system-name' now returns an updated value if the current
    system's name has changed or if the Emacs process has changed systems,
    and to avoid long waits it no longer consults DNS to canonicalize the
    name.  The variable 'system-name' is now obsolete.

* A far worse problem

There is a much much worse consequence, though. If I don't start Gnus,
and send an email directly with message, then
`message-user-mail-address' is nil and `message-make-fqdn' falls through
to its default value for the domain name, and the Message-ID becomes
(IIUC) xyz@i-did-not-set--mail-host-address--so-tickle-me which is far
more embarrassing and unacceptable than [email-masked]! I see this string
emerge for example, if I run report-emacs-bug before starting Gnus.
Emacs 24 was immune to this problem.

N.