[ 
https://issues.apache.org/jira/browse/HADOOP-6682?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jakob Homan updated HADOOP-6682:
--------------------------------

    Attachment: HADOOP-6682.patch

Patch for trunk.  Same as Y20 patch.  Just changes the base to 10 rather than 
16.  

Hong, I like your approach and will open another JIRA to address the general 
shortcoming of the normalizeHostname function.  For this one I'd like to take 
as little risk as possible.

I considered writing a unit test for the fix that would try to normalize some 
host name that starts with an offending hostname (ask.com), but this would 
violate the unit-test-shouldn't-talk-to-outside-resources guideline, and 
couldn't think of a better way to test it.  If someone has one, let me and I'll 
add it.  Otherwise, I think it's good to go without one.

> NetUtils:normalizeHostName does not process hostnames starting with [a-f] 
> correctly
> -----------------------------------------------------------------------------------
>
>                 Key: HADOOP-6682
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6682
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: io
>            Reporter: Jakob Homan
>         Attachments: HADOOP-6682-Y20.patch, HADOOP-6682.patch
>
>
>   public static String normalizeHostName(String name) {
>     if (Character.digit(name.charAt(0), 16) != -1) {
>       return name;
> This code is attempting to short-circuit the hostname->ip resolution on the 
> assumption that if name starts with a digit, it's already an ip address.  
> This is of questionable value, but because it checks for a hex digit, it will 
> fail on names starting with [a-f].  Such names will not be converted to an ip 
> address, but be returned unchanged.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to