You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2010/06/28 23:27:20 UTC

DO NOT REPLY [Bug 49513] New: does not correctly set hostname when ip is link-local

https://issues.apache.org/bugzilla/show_bug.cgi?id=49513

           Summary: <hostinfo> does not correctly set hostname when ip is
                    link-local
           Product: Ant
           Version: nightly
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: jks@iname.com


Created an attachment (id=25651)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25651)
Patch to fix the problem

My computer has a 192.168.x.x IP.  It also has a vibr0 bridge with an ip of
192.168.122.1.  As it happens when HostInfo tries to find the "best" ip to use
for hostname setting purposes it find vibr0 first, and I end up with DOMAIN set
to "168.122.1" and NAME set to "192"

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49513] does not correctly set hostname when ip is link-local

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49513

jks@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #25651|0                           |1
        is obsolete|                            |

--- Comment #2 from jks@iname.com 2010-08-29 13:30:47 EDT ---
Created an attachment (id=25958)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25958)
Second patch

This patch also prefers ip addresses with a hostname, and if the best ip
address ends up not having a hostname doesn't set the host and domain to "1"
and "2.3.4" which does not make any sense.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49513] does not correctly set hostname when ip is link-local

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49513

--- Comment #1 from J.M. (Martijn) Kruithof <jk...@apache.org> 2010-08-29 04:11:43 EDT ---
getLocalHost() is only specified to return an address of the machine. There is
no reason that in general the one or the other address selected by this method
is better than any other address available on the system. While in your case
apparently the selected address of getLocalHost is "better" there is no
guarantee that this is the case for others, or will remain true in the future.

Please also see
http://stackoverflow.com/questions/901755/how-to-get-the-ip-of-the-computer-on-linux-through-java
for a more elaborate explanation.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49513] does not correctly set hostname when ip is link-local

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49513

J.M. (Martijn) Kruithof <jk...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
           Severity|normal                      |enhancement

--- Comment #4 from J.M. (Martijn) Kruithof <jk...@apache.org> 2010-08-29 17:15:33 EDT ---
I've modified the sources according to the following specification:

If two addresses have the same scope, the address with a hostname prevails over
the address without a hostname attached.

For local lookup, no IP address will be put anymore in NAME / DOMAIN.

For remote lookup, if a host name was provided and only an IP address is found,
the IP address will no longer overwrite the host name provided to the task.

Committed to revision 990653: http://svn.apache.org/viewvc?rev=990653&view=rev
Diff:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/HostInfo.java?rev=990653&r1=990652&r2=990653&view=diff

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 49513] does not correctly set hostname when ip is link-local

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49513

--- Comment #3 from jks@iname.com 2010-08-29 13:32:40 EDT ---
In my ex(In reply to comment #1)
> getLocalHost() is only specified to return an address of the machine. There is
> no reason that in general the one or the other address selected by this method
> is better than any other address available on the system. While in your case
> apparently the selected address of getLocalHost is "better" there is no
> guarantee that this is the case for others, or will remain true in the future.
> 
> Please also see
> http://stackoverflow.com/questions/901755/how-to-get-the-ip-of-the-computer-on-linux-through-java
> for a more elaborate explanation.

In my experience what getLocalHost() returns is consistent with what `hostname`
returns on Linux machines.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.