Skip Menu |

This queue is for tickets about the Sys-Hostname-Long CPAN distribution.

Report information
The Basics
Id: 7717
Status: resolved
Priority: 0/
Queue: Sys-Hostname-Long

People
Owner: Nobody in particular
Requestors: SAPER [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.2
Fixed in: (no value)



Subject: `hostname --fqdn` isn't portable
The hostname(1) command doesn't behave the same way on different Unix systems. Therefore, executing `hostname --fqdn`without checking the current system is quite hazardous. The problem is that on Solaris systems hostname(1) does not expect any options at all and take the first argument it sees as the new hostname. So, `hostname --fqdn` will set the hostname to "--fqdn", which has some infortunate consequences. hostname(1) on Solaris behaves this way from at least SunOS 2.6 to 2.9. FYI, on Mac OS X/Darwin, hostname(1) will always returns the FQDN unless called with the option -s. Option --fqdn does not generate an error though. On IRIX (5.3 to 6.3) hostname(1) behaves the same way (prints the FQDN unless given the -s option), but I can't say if it will just silently drop the --fqdn option.
From: saper [...] cpan.org
I forgot to add: you should probably use the same way that Sys::Hostname does; first try using syscall(), then check the system and try hostname(1).
From: jaearick [...] colby.edu
[SAPER - Mon Sep 20 19:47:34 2004]: Show quoted text
> The hostname(1) command doesn't behave the same way on different Unix > systems. Therefore, executing `hostname --fqdn`without checking the > current system is quite hazardous. > > The problem is that on Solaris systems hostname(1) does not expect any > options at all and take the first argument it sees as the new > hostname. So, `hostname --fqdn` will set the hostname to "--fqdn", > which has some infortunate consequences. hostname(1) on Solaris > behaves this way from at least SunOS 2.6 to 2.9. > > FYI, on Mac OS X/Darwin, hostname(1) will always returns the FQDN > unless called with the option -s. Option --fqdn does not generate > an error though. On IRIX (5.3 to 6.3) hostname(1) behaves the same > way (prints the FQDN unless given the -s option), but I can't say > if it will just silently drop the --fqdn option.
This is a really nasty bug if you are using Kerberos on Solaris. Once the hostname gets changed, then Kerberos can't find the machine name in its key table -- and then nobody can login to the Solaris box. Ouch.
From: Stoaty
This is an incredibly annoying and now long-lived bug. It produces many problems for anti-spam solutions and other things on Solaris, so is there any chance it will be fixed?