tags 409862 - wontfix tags 409862 + patch thanks Hi Martin
Thanks for the explanation. On Fri, Feb 09, 2007 at 12:04:17AM +0000, Martin wrote: > > 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. Well we have the POSIX standard as well... > 3. Follow the DNS world and allow lengths of 2 to 63 inclusive. This is what I was referring to, but in a very vauge statement and without really checking the standard. > 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. > > :-) As it is actually the POSIX standard that I have to follow in this case I opt to change this actually. The other reason are practical, on how to enfoce the user to have a correct hostname. I need a way to tell the user not to have a hostname with a- or -a as name... I can not really see the regex for that... :( On the other hand that may be something that the user can live with. In option two case I think the following would be an ok regex: ([a-z0-9_-]*)[a-z0-9]) or [a-z0-9]([a-z0-9_-]*)) But if you know a good way to accept x xa x-a but not x- -a as hostname, that would be great. I can do a second matching, but that is not really what I want. I want to do a glob regex at once. Regards, // Ola > Cheers, > - Martin > > > -- --- Ola Lundqvist systemkonsult --- M Sc in IT Engineering ---- / [EMAIL PROTECTED] Annebergsslingan 37 \ | [EMAIL PROTECTED] 654 65 KARLSTAD | | http://opalsys.net/ Mobile: +46 (0)70-332 1551 | \ gpg/f.p.: 7090 A92B 18FE 7994 0C36 4FE4 18A1 B1CF 0FE5 3DD9 / --------------------------------------------------------------- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]