Updated 2012-07-09 10:36:44 by RFox

[mof:] I found the following issue on tcl 8.5:

One if my windows machines is named "Mof13.somedomain" info hostname returns "mof13.somedomain" (everything lowercase)

As some applications I use with tcl are case sensitive to the hostname and I didn't that this machine had a capital "M", I searched for a bug in my tcl script for 4 hours...

Windows' hostname on cmd.exe returns the correct "MoF13.somedomain", I expect info hostname to do the same. Therfore I think info hostname is not reliable.

A workaround for this ambiguity is to use [exec hostname] on windows, but i guess it's not platform independent...

RFox you only think it's called Mof13.somedomain ;-). The RFC's specify host names consist of dot separated lables that consist of the letters 'a' through 'z' (in a case insensitive manner), the digits '0' through '9' and the hyphen. Specifically this means that Mof13.somedomain is equivalent to mof13.somedomain. It is pretty common practice nowadays. From the Tcl docs for info hostname (http://www.tcl.tk/man/tcl8.5/TclCmd/info.htm#M26):

info hostname Returns the name of the computer on which this invocation is being executed. Note that this name is not guaranteed to be the fully qualified domain name of the host. Where machines have several different names (as is common on systems with both TCP/IP (DNS) and NetBIOS-based networking installed,) it is the name that is suitable for TCP/IP networking that is returned.

Set the last clause of the last sentence. info hostname is acting as specified...thought not as you expected.