Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2013-11-12
12:40 • Closed ticket [3541452fff]: info hostname does not observe case sensitivity</i... artifact: ceabccacbf user: dkf
2012-07-10
15:29 • Pending ticket [3541452fff]. artifact: 93bddcc520 user: dkf
01:23 • Ticket [3541452fff]: 4 changes artifact: 170d817bca user: bz-mof
01:02 • Ticket [3541452fff]: 4 changes artifact: 96fb1a7ff6 user: bz-mof
00:39 • Ticket [3541452fff]: 4 changes artifact: 05552b0176 user: mic42
2012-07-08
22:31 • New ticket [3541452fff]. artifact: 31fdf86912 user: bz-mof

[info hostname] does not observe case sensitivity

Closed / Invalid3541452fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 13 years ago
Descriptionplain2012-07-08 22:31:01
OS: Windows XP, Windows 7

Problem Behavior: A windows' machines hostname is "Mof13.somedomain". But [info hostname] returns "mof13.somedomain" (with a lower-case "m"), which can cause problems if the hostname is passed to other applications that need the string in correct case.

Platform-dependant workaround is [exec hostname], in my case.

Expected Behavior: [info hostname] should return the hostname with unchanged upper and lower case.
mic42plain2012-07-10 00:39:49
Technically DNS hostnames are case insensitive, see http://en.wikipedia.org/wiki/Hostname for an overview and RFC1123 for details.

The docs for [info hostname] state that a hostname useable for TCP/IP Networking is returned, which is the case. So this is not really a bug in Tcl's hostname function.

Even Microsoft states in various places that hostnames are case insensitive, e.g. in KB http://support.microsoft.com/kb/909264.

The relevant docs should probably be:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724220(v=vs.85).aspx

So file a bug with your other application, it should not depend on the exact case of a DNS name.

You can also use the twapi package to get platform specific hostnames/names, see: http://twapi.magicsplat.com/osinfo.html#get_computer_netbios_name
bz-mofplain2012-07-10 01:02:59
Well, you are right.

I just found out that it is PVM (Parallel Virtual Machine) by Oak Ridge National Laboratory (http://www.csm.ornl.gov/pvm/pvm_home.html) that has the case sensitivity in the hostname, which is possibly a bug.

So I confirm it's not a bug in tcl, but couldn't it be a feature? Providing the hostname in "correct" case should not break anything...


Thank you very much for the hint to twapis get_computer_netbios_name!
bz-mofplain2012-07-10 01:23:38
edit: Unfortunately ::twapi::get_computer_netbios_name and ::twapi::get_computer_name respond with all-upper-case strings
dkfplain2012-07-10 15:29:02
Tcl converts the result of the GetComputerName() Win32/Win64 call to lower case (as NetBIOS names are always uppercase and the case _shouldn't matter_) but otherwise does nothing with returned cases. In particular, it never messes with names retrieved from DNS or from the Unix gethostname() call.

If you've got a deployment where you've got critical case sensitivity in DNS names, You're Doing It Wrong.
dkf Closed ticket [3541452fff]. [History diff]2013-11-12 12:40:19
Log in (anonymous is fine) to add a comment.