You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "attilapiros (via GitHub)" <gi...@apache.org> on 2023/01/25 21:24:10 UTC
[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&utm_medium=web2x&context=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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org