On Thu, 2007-02-08 at 22:42 +0100, Ola Lundqvist wrote: > tags 409862 + wontfix <snip> > > Line 235 has the regex > > > > [a-z0-9]*([a-z0-9_-])[a-z0-9]) > > > > which looks a little odd to my eyes, perhaps: > > > > [a-z0-9]*([a-z0-9_-]*)[a-z0-9]+) > > No this is actually intentional. One can argue that a single > character is valid for a hostname, but it is not my view. > If you give me a good reason I can change my mind though. <pedant> The two standards that come to mind are POSIX and the DNS RFCs. POSIX says there is a platform dependant upper limit (MAXHOSTNAME i.e. 64 i/c \0 on the Linux infront of me):
http://www.opengroup.org/onlinepubs/009695399/functions/uname.html http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/utsname.h.html but there is no mention of a lower limit - thus I conclude that by POSIX I'm allowed to have one character hostnames. DNS is a lot less clear. The current guidance on handling DNS addresses doesn't mention lower limits: ftp://ftp.is.co.za/rfc/rfc3696.txt ( from http://www.dns.net/dnsrd/rfc/ ) (although operationally TLDs do not assign single character second level domains). A more comprehensive discussion is given here: http://www.imc.org/idn/mail-archive/msg04905.html So, I'd suggest there are three possible alternative: 1. If it is two characters minimum because that's what makes you happy - then keep it like that. 2. Follow the POSIX/Linux world and allow lengths of 1 to 63 inclusive. 3. Follow the DNS world and allow lengths of 2 to 63 inclusive. You're the programmer; I'm the user - it's your call as far as I'm concerned (althought I'll probably keep a private patched copy because I need single letter hostnames for one of our servers). </pedant> <nopedant> OK </nopedant> > However I think that the regex maybe should look like: > [a-z0-9]([a-z0-9_-]*)[a-z0-9]) In option 1, yes. :-) Cheers, - Martin -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]