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

24
Scripts
Scripts that use the uname(1) or hostname(1) command typically do not have problems with long
node or host names. Yet, problems can occur.
The script might parse the output of the uname(1) command to obtain a desired field. This is very
unlikely because the uname(1) command provides options to obtain the individual argument,
making parsing unnecessary. Furthermore, any parsing scheme must already deal with the variability
of individual field widths. Given this, problems should not exist with parsing of the command output,
except in the unlikely case that the node name is explicitly expected to not be more than 8 bytes.
A script might attempt to store a node or host name in a variable that is defined to hold only 8 or 64
bytes, respectively. This is also unlikely.
It is safest to scan product scripts for references to the node and host name-related commands.
However, it is very unusual to find any issues that need to be addressed in support of long names.
Tools to Help
The following script can help to scan application source code for dependencies on node and/or host
names or on related symbols:
#!/bin/ksh
#
# Script to search source files for dependencies on node/host
# name size.
# Accepts a list of text file names for the arguments. (Does not
# support embedded spaces or other special characters in the
# names.)
#
# This script can only help to identify sources which need
# additional investigation per the advice of the HP documentation.
#
# Some programs that have dependencies on the size of node
# or host names will not be detected by this script
#
# Search for the obvious symbolic references. Also search for
# “char” arrays sized by the literal equivalents for
# UTSLEN (9 or 8) and MAXHOSTNAMELEN (64).
#
grep E e uname e utsname e nodename \
e SYS_NMLN e SNLEN e UTSLEN \
-e hostname e MAXHOSTNAMELEN \
–e ‘char.*\[([89]|64)\]’ $@
Testing Tips
Any application enhanced to accommodate expanded node and/or host names should be subjected
to the same qualification procedures as for any product update. In addition, the test procedures
should set up an environment where the node and host names are set to long values.