-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix for colon split for windows paths #364
Conversation
This would break providing a hostname |
The hostname has already been parsed when my change is executed. The |
Only if it's a v6 IP, this doesn't have tests. |
Signed-off-by: Marco Boi <marco.boi@collibra.com>
Hi Brian, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is getting a bit complicated. It'd be easier to require all parameters to be set if you want to use a colon.
|
||
private static final String IPV6_REGEX = "((\\[.*\\]+):)"; | ||
private static final String DNS_IPV4_REGEX = "(((\\w+\\.)+\\w+):)"; | ||
private static final String PORT_REGEX = "(([0-9]+):)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does java support port names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by port names?
If you meant group names, yes, java does support them but only starting from version 7 while the pom file in the project specifies java 6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http
is 80 for example, from /etc/services
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically, if you use HTTP and you don't specify a port, the default one would be taken, which is 80. Same for HTTPS; 443 would be your default port if you don't specify a custom one.
I don't see how that's relevant to the arg parsing tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point is that the string http
is equivalent to 80
, and both are valid ports. You're only matching numbers.
static final String DEFAULT_HOST = "0.0.0.0"; | ||
|
||
private static final String IPV6_REGEX = "((\\[.*\\]+):)"; | ||
private static final String DNS_IPV4_REGEX = "(((\\w+\\.)+\\w+):)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about DNS is v4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I get your question there.
The DNS_IPV4_REGEX
means that regex applies to both DNS names and ipv4 addresses.
Hi Brian, requiring to pass all parameters will not solve the issue as long as you blindly split on colons. I would maintain the parsing system I'm proposing here is more rational and, importantly, isolates a parsing method that can be tested separately. |
I mean from an end-user standpoint. I'd rather not have such a complex parsing system. |
The end user (which in our case is the user that passes the args) should not know about the parsing logic. As I was trying to explain above, the only part he/she's concerned with is how those args should be passed.
So to your point, the parsing system is no concern for the end user. If you say you'd rather have a different parsing system, can you please specify what that should look like? |
I'm proposing that if you want to use a colon in the file, you must specify the host. |
About your proposal to force the user to specify a host if they want to pass a path that contains colons, that alone will not solve the issue.
So the parsing logic of what happens needs to be changed there in any case. |
If all you want is a simple solution and you don't mind changing the parameters syntax i propose:
|
Hi Brian, any updates on this? |
Obsoleted by #371 |
Fix for bug in arguments parsing.
On windows systems, paths will contain the colon character, which will be misinterpreted by the Agent as a separator.
This fix limit the splitting of the string to the first occurrence of the colon sign, leaving the path intact.