Node and Host Name Sizes on HP-UX: Using the Expanded Capabilities of HP-UX

20
APPENDIX C: Source Code Issues with Expanded Node
and Host Names
This appendix describes potential issues that might need to be addressed in existing programs.
General Program Issues
This section describes problems that application programs might exhibit that require attention from
developers. In most cases the solution is to recompile to the API level that includes the expanded
interfaces (that is, _HPUX_API_LEVEL=20040821). In some cases, the code is not written strictly to
the specification and must be changed before recompilation (such as to use the proper symbolic
constants).
This section is not an exhaustive study of all possible problems. It describes the basic classes of
issues, which software developers can use as models for the situations peculiar to their own products.
Truncated Node or Host Name Fields
With the expanded_node_host_names tunable turned on, the system administrator can set node or
host names up to 255 bytes long. The expanded version of the OS interfaces provides these names,
in their entirety, to their callers.
Any software that still uses the nonexpanded versions of the node name interfaces (functions,
constants, or structures) either gets an EOVERFLOW error or observes that the values set by the
administrator are truncated to the first 8 bytes, depending on the setting of the uname_eoverflow
tunable.
Software that still uses the nonexpanded versions of the host name interfaces (that is,
MAXHOSTNAMELEN) observes that the host name value set by the administrator is truncated to the first
64 bytes.
The truncated names can be confusing if displayed to the user or printed in reports. Log files can be
ambiguous, especially if names on multiple systems have the first 8 or 64 bytes of the names the
same. For this reason, it is advantageous to arrange the naming convention to make the first 8 bytes
as unique as practical.
Because the name is truncated, the program's notion of the local host's name is incorrect. Passing the
truncated name outside of the system (such as passed in a network protocol, or via another
communication media) can cause later attempts by external systems to establish a network connection
to fail (or, perhaps worse, can result in a connection to the wrong host).
Parsing Output of uname(1) or hostname(1) Commands
Scripts or programs that parse or accept the output of the uname(1) or hostname(1) commands
might make assumptions about the width of the fields. These assumptions need to be removed.
Though unlikely, there might also be assumptions that, in the output of uname -a, the node name
field starts in the seventh column. This is already an invalid assumption, because the first field is not
required to be the string “HP-UX(although it usually is). Such an assumption needs to be removed.