[GitHub] [spark] attilapiros commented on a diff in pull request #39728: [SPARK-42173][CORE] RpcAddress equality can fail
attilapiros commented on code in PR #39728: URL: https://github.com/apache/spark/pull/39728#discussion_r1087515031 ## core/src/main/scala/org/apache/spark/util/Utils.scala: ## @@ -1118,7 +1118,7 @@ private[spark] object Utils extends Logging { // This means some invalid addresses are treated as v6 addresses, but since they are // not valid hostnames it doesn't matter. // See https://www.rfc-editor.org/rfc/rfc1123#page-13 for context around valid hostnames. -val addressRe = """^\[{0,1}([0-9:]+?:[0-9]+)\]{0,1}$""".r +val addressRe = """^\[{0,1}([0-9:]+?:[0-9]*)\]{0,1}$""".r Review Comment: Absolutely true! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] attilapiros commented on a diff in pull request #39728: [SPARK-42173][CORE] RpcAddress equality can fail
attilapiros commented on code in PR #39728: URL: https://github.com/apache/spark/pull/39728#discussion_r1087250704 ## core/src/main/scala/org/apache/spark/util/Utils.scala: ## @@ -1118,7 +1118,7 @@ private[spark] object Utils extends Logging { // This means some invalid addresses are treated as v6 addresses, but since they are // not valid hostnames it doesn't matter. // See https://www.rfc-editor.org/rfc/rfc1123#page-13 for context around valid hostnames. -val addressRe = """^\[{0,1}([0-9:]+?:[0-9]+)\]{0,1}$""".r +val addressRe = """^\[{0,1}([0-9:]+?:[0-9]*)\]{0,1}$""".r Review Comment: Is there any reason why not use just this tiny regexp: ``` """^\[{0,1}([0-9:]+)\]{0,1}$""" ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] attilapiros commented on a diff in pull request #39728: [SPARK-42173][CORE] RpcAddress equality can fail
attilapiros commented on code in PR #39728: URL: https://github.com/apache/spark/pull/39728#discussion_r1087190921 ## core/src/main/scala/org/apache/spark/util/Utils.scala: ## @@ -1109,6 +1109,24 @@ private[spark] object Utils extends Logging { } } + /** + * Normalize IPv6 IPs and no-op on all other hosts. + */ + private[spark] def normalizeIpIfNeeded(host: String): String = { +// Is this a v6 address. We ask users to add [] around v6 addresses as strs but +// there not always there. If it's just 0-9 and : and [] we treat it as a v6 address. +// This means some invalid addresses are treated as v6 addresses, but since they are +// not valid hostnames it doesn't matter. +// See https://www.rfc-editor.org/rfc/rfc1123#page-13 for context around valid hostnames. +val addressRe = """^\[{0,1}([0-9:]+?:[0-9]+)\]{0,1}$""".r Review Comment: If the v6 address ends with 0's and it is shortened then the regexp will fail, isn't it? ``` scala> "[2:7::]".matches("""^\[{0,1}([0-9:]+?:[0-9]+)\]{0,1}$""") res1: Boolean = false ``` Or the example from [this comment](https://www.reddit.com/r/networking/comments/49eap8/comment/d0r42ww/?utm_source=reddit_medium=web2x=3): ``` scala> "[2600::]".matches("""^\[{0,1}([0-9:]+?:[0-9]+)\]{0,1}$""") res2: Boolean = false ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org