octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #51830] uname nodename sometimes gives "localh


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #51830] uname nodename sometimes gives "localhost" instead of pc name
Date: Wed, 30 Aug 2017 08:46:45 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #13, bug #51830 (project octave):

Responding to comment #7:  Mike, you are right that uname uses gethostname,
but gnulib also provides a wrapper for that.  But ultimately, it does call the
Windows gethostname function from -lws2_32.  So either that function is
returning localhost, or it is failing.  You could maybe use the debugger or
insert some print statements to figure out which.

However, the info from comment #8 makes me think that gethostname is just
failing, because "unknown" is what Octave's wrapper for gethostname
(octave::sys::get_host_name) will return if the system's gethostname function
fails.

So in any case, I don't see how this is an Octave bug unless we are calling
gethostname incorrectly.  Otherwise, we are calling a function that is
supposed to return the hostname and it fails.  Fix that function and Octave
will do what you want.

We have updated gnulib since Octave 4.2 was released.  Have there been any
changes in gnulib that could cause this failure to happen more often now?  The
code for gnulib's gethostname replacement on Windows systems is:


rpl_gethostname (char *name, size_t len)
{
  int r;

  if (len > INT_MAX)
    len = INT_MAX;
  gl_sockets_startup (SOCKETS_1_1);
  r = gethostname (name, (int) len);
  if (r < 0)
    set_winsock_errno ();

  return r;
}


It doesn't look like this has changed since 4.2.  What happens in
gl_sockets_startup?  That function also appears to be unchanged since 4.2, but
is it possible that it fails to initialize something such that gethostname
subsequently fails?

Can you create a simpler example program that just uses the gnulib functions
independently from Octave that also demonstrates this problem?


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51830>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]