Subject: Re: [PATCH v3 1/3] send-mail: improve checks for valid_fqdn

From: Junio C Hamano <[email-masked]>
Date: Tue, 06 May 2025 10:11:09 -0700

Aditya Garg <[email-masked]> writes:

> I think we can add a minimal check to ensure that there are no two dots together.
> Does that sound fair?

Is it a common misconfiguration in the first place that singling out
a name ending with double dots (which indeed is very likely that
nobody should be relying on getting accepted by sensible SMTP
servers, hence very safe tightening) is worth doing?  If MacBooks as
shipped would by default claim to be "MacBook.." like your example
had (I do not know if that is the case, as I do not live in Apple
ecosystem), it may give us a reason to special case the trailing
double-dots, for example.

I personally feel that "run of at most 63 alnum or dash separated by
a single dot in between" is easy enough to explain, so if I were
doing this change, I would just use the regexp used in posted patch
[*] and if nobody complains, stop right there.  If we get any
complaint, then I'd detect and reject the case where the string ends
with double-dots.

[Footnote]

 * ... but I don't know if your use of negative lookaround
   assersions is correct.  Shouldn't the "a label cannot begin or
   end with dash" be applied not just to the first label but
   consistently to all of the dot-separated labels?