-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate Octal and Hexadecimal notation in ip""? #9187
Comments
This is intended. Numbers with leading
|
I realized I misspoke. Rather than following an RFC, we follow the behavior of inet_aton: http://man7.org/linux/man-pages/man3/inet_aton.3.html Looking back at this I wonder if that was the correct decision. Might be better to throw an error rather than interpret is as octal. Hmm... |
As a datapoint, quoting from https://tools.ietf.org/html/draft-main-ipaddr-text-rep-02
which is dotted decimal notation. So I guess the two options here are:
In the latter case, we probably also want to deprecate all non-dotted decimal variants of an ipv4 spelling. |
Hard to say. inet_aton is pretty standard. Then again just sticking with dotted decimal does reduce the possibility of confusion. |
We're talking about IPv4 addresses only, right? Canonical IPv6 is in hex. |
Yes, that's right. |
My two cents (since I'm the originator of #9321): String constructors for IPv4 should be assumed to be in base 10 and should not error on leading |
As it stands, the leading |
I've not seen octal octets in dotted-quad notation designed for human consumption in the 20+ years I've been doing this. I realize this is just one anecdatum, but I can point to many instances where network equipment represents decimal dotted quad with 0-padding. (A google search for |
As another suggestion: allow octal but require 4 digits per octet: a leading 0 plus 3 significant digits (the same way we'd require 2 digits for hex). |
When I said common, I didn't necessarily mean in output, but in tools that use is as their input. I'd also be weary of introducing another format that does something different from everything else. |
The issue is that there is no "everything else". At the very least, there are two camps: devices that interpret any length octet that leads with 0 as an octal, and devices that don't. Of the devices that don't, some significant subset actually promote 0-padded decimal octets. My brain hurts. |
Yes, I agree that there is the two cases you mentioned. But wouldn't having |
I don't think so: see, e.g., https://en.wikipedia.org/wiki/IPv4#Address%20representations. |
That pages cites inet(3) which precisely has |
I get it. If we follow inet(3) all it means is that the string constructor (from the referenced PR) would need to do some (relatively) fairly complex validation. I guess that's unavoidable. I still think we ought to consider warnings whenever a string contains something that will not be interpreted as decimal octets.... |
|
Yes. I think IPv4 addresses should be interpreted consistent with inet(3). I'd keep doing that without any flag, but possibly raise a warning if the string is interpreted as anything other than decimal octet. I am not in favor of adding a flag that allows fixed-width decimal dot, because then the representation of the object will not match its intrinsic value. Down that road lies madness. |
I'm not sure I see the value of a warning; this would be data-dependent and you wouldn't see it until your code happens to get input in a certain format. To avoid the warning, you'd have to write your own quasi-parser. |
Just to close out my thoughts on this with another data point: the
|
I tested this address: julia> ip"042.042.0042.0042"
ip"34.34.34.34" $ ping 042.042.0042.0042
PING 042.042.0042.0042 (34.34.34.34) 56(84) bytes of data. My personal opinion is: this is broken. So I would like to see this behavior: julia> ip"042.042.0042.0042"
ip"42.42.34.34" How ever, mixing formats should probably triger a warning. EDIT: cleared the late night misstake of 008 |
Octal digits are 0-7 inclusive. |
ah, it is getting late. |
I'd blame Julia's 1-indexing for that mistake :) |
Remove octal/hexadecimal parsing from IPv4. Fixes #9187
🎉 this was one of my first issues 🎉 |
@Keno "As a datapoint, quoting from https://tools.ietf.org/html/draft-main-ipaddr-text-rep-02" I think we should follow section 3 (and 4.1 Be Stringent in What You Accept) fully. I see from tests e.g. this was allowed: [I'm sorry, tried to quote code, but ``` made worse..]
no longer, but also not useful, but still e.g. allowed:
|
Please quote your code. |
@PallHaraldsson: is this a bug report on the deprecation of this being broken? |
Hi all
I noticed, that julia does some funny stuff in the REPL when you enter the folowing:
julia> ip"001.021.201.012"
the Answer:
ip"1.17.201.10"
Regards
The text was updated successfully, but these errors were encountered: