-
Notifications
You must be signed in to change notification settings - Fork 1k
Rearrange path validation to allow ports #1160
Conversation
Now that this can access an ssh server on an alternative port and run
when the remote outputs prefixing lines that are too short. These all start with Could either skip lines that start with I'm unable to find a solid reference for the on-the-wire protocol for |
Oddly, I don't experience this using the same phabricator instance using rev d3e738d and putting a |
This change addresses it. I'm unsure how to add a test for this, since the current tests use repos that don't exhibit this and I can't find a public phabricator repo that does. |
yeah, testing for some of these sorts of issues can be tough. in my ideal world we actually have tests that dynamically set up local-only network services, but we just haven't gotten that far yet. if you want to work on such a thing, i'd heartily support it 😄 we've had a couple issues related to parsing the output of to that end, i'd prefer we take a stronger approach to validating the inputs than we do today: for each line - and we could probably move to using
that should be in its own PR, though. |
I "fixed" it locally with diff --git a/internal/gps/deduce.go b/internal/gps/deduce.go
index 9b4e49e..86ce4e7 100644
--- a/internal/gps/deduce.go
+++ b/internal/gps/deduce.go
@@ -78,7 +78,7 @@ var (
// Other helper regexes
var (
scpSyntaxRe = regexp.MustCompile(`^([a-zA-Z0-9_]+)@([a-zA-Z0-9._-]+):(.*)$`)
- pathvld = regexp.MustCompile(`^([A-Za-z0-9-]+)(\.[A-Za-z0-9-]+)+(/[A-Za-z0-9-_.~]+)*$`)
+ pathvld = regexp.MustCompile(`^([A-Za-z0-9-]+)(\.[A-Za-z0-9-]+)+(:[0-9]+)?(/[A-Za-z0-9-_.~]+)*$`)
) So that I can have source:
My change seems smaller than this PR, did I break something in my builds by doing it? |
it is strange that git clone url has anything to do with package import path |
indeed it is - I noted as much in the OP.
…On September 18, 2017 5:55:39 AM EDT, Maxim Ivanov ***@***.***> wrote:
it is strange that git clone url has anything to do with package import
path
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#1160 (comment)
|
When I said "wire-protocol", I was referring to the physical, vs logical/presentation, output of On
Results in a directory named This is all kinds of confusing. |
i tried to hint at this, but let me be more explicit: the wire protocol is off-topic for this PR. let's drop it, please.
from the spec:
dep is compiler-like to the extent that it has to decide what constitutes well-formed import paths, which means we're within our our discretion to decide that import paths containing those characters are invalid. our goal is to create code trees that will compile at least on the standard toolchain's compiler. so, we implement the restriction.
this is because of how remote import path deduction rules work with vcs infixes. they're approximately the same in |
What is blocking this PR? |
@sttts i was uncomfortable with a compromise i had to make in order to accomplish the goal (where the alternative was a refactor that wasn't worth it). after that, i just put it down and other things have taken priority. i'm fine with the compromise now, though, at least temporarily. so it's just a question of bringing it up to date. i don't have time for that right now, though, as i'm 💯 focused on docs and this next release. |
#1509 did this. |
What does this do / why do we need it?
Currently, otherwise-valid
source
paths containing ports will be rejected. This occurs because of how root deduction is smooshed together with source type deduction, and the fact that we don't delineate well between the two.What should your reviewer look out for in this PR?
I really don't like that this moves the path validation out to a place where it runs unconditionally on every single
DeduceProjectRoot()
. That's just super-unacceptable, really; it'll have a noticeable performance impact on solving.Do you need help or clarification on anything?
Which issue(s) does this PR fix?
fixes #411