This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libgcj/24583] [4.0 only] InetAddress.getLocalHost() returns broken InetAddress object when local hostname cannot be resolved
- From: "greenrd at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Oct 2005 12:00:51 -0000
- Subject: [Bug libgcj/24583] [4.0 only] InetAddress.getLocalHost() returns broken InetAddress object when local hostname cannot be resolved
- References: <bug-24583-11308@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from greenrd at gcc dot gnu dot org 2005-10-30 12:00 -------
The real problem here was that I had a typo in my /etc/hosts, so the hostname
could not be resolved. I've updated the bug summary.
GNU classpath 0.18 implements the correct behaviour:
$ jamvm TestAddr
java.net.UnknownHostException: lcoyle1
at java.net.VMInetAddress.getHostByName (Native Method)
at java.net.InetAddress.getAllByName (InetAddress.java:667)
at java.net.InetAddress.getByName (InetAddress.java:622)
at java.net.InetAddress.getLocalHost (InetAddress.java:777)
at TestAddr.main (TestAddr.java:7)
--
greenrd at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|InetAddress.getLocalHost() |[4.0 only]
|returns broken InetAddress |InetAddress.getLocalHost()
|object when run in chroot |returns broken InetAddress
| |object when local hostname
| |cannot be resolved
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24583