Good catch. From the hostname man page (emphasis ** added): The gethostname() function returns the standard host name for the current processor, as previously set by sethostname(). The namelen argument specifies the size of the name array. The returned name is null-terminated, **unless** insufficient space is provided.
-Nathan HPC-3, LANL On Wed, Oct 09, 2013 at 02:40:28PM +0000, Kevin M. Hildebrand wrote: > Hi, I just noticed a bug in the common logging code in both 1.6.5 and > 1.7.2. For sites with hostnames longer than 32 characters, the > terminating NULL is getting cut off the hostname string. > > > > Here's a simple patch to fix: > > > > diff -c -r1.1 opal/util/output.c > > *** opal/util/output.c 2013/10/09 14:09:47 1.1 > > --- opal/util/output.c 2013/10/09 14:12:06 > > *************** > > *** 140,145 **** > > --- 140,146 ---- > > } > > #endif /* defined(__WINDOWS__) */ > > gethostname(hostname, sizeof(hostname)); > > + hostname[sizeof(hostname)-1] = '\0'; > > verbose.lds_want_stderr = true; > > asprintf(&verbose.lds_prefix, "[%s:%05d] ", hostname, getpid()); > > > > > > > > Thanks! > Kevin > > > > -- > > Kevin Hildebrand > > University of Maryland, College Park > > Division of IT > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users