validate: add root.path validation when platform is windows#472
Merged
Conversation
e17a31d to
e59ea68
Compare
wking
reviewed
Sep 15, 2017
| } | ||
|
|
||
| if v.platform == "windows" { | ||
| if !strings.HasPrefix(v.spec.Root.Path, `\\?\`) { |
Contributor
There was a problem hiding this comment.
We can be stricter than this. The spec links here, which would be a regex like [\][\][?][\]Volume[ {][a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}[}][\]?". The Windows docs say "GUID", I think they mean "UUID", based on their \\?\Volume{26a21bda-a627-11d7-9931-806e6f6e6963}\ example.
Also, unit tests :).
0e1633c to
ec26a84
Compare
wking
reviewed
Sep 18, 2017
| }{ | ||
| {rspec.Spec{Windows: &rspec.Windows{HyperV: &rspec.WindowsHyperV{}}, Root: &rspec.Root{}}, "windows", specerror.RootOnHyperV}, | ||
| {rspec.Spec{Windows: &rspec.Windows{HyperV: &rspec.WindowsHyperV{}}, Root: nil}, "windows", specerror.NonError}, | ||
| {rspec.Spec{Windows: &rspec.Windows{}, Root: &rspec.Root{Path: filepath.Join(tmpBundle, "rootfs")}}, "windows", specerror.PathFormatOnWindows}, |
Contributor
There was a problem hiding this comment.
Can we also check that this passes validation? The regex is large, and a positive match would help convince me that it wasn't broken.
d214edd to
ab58414
Compare
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
ab58414 to
567f1aa
Compare
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
f1104b0 to
1a9532e
Compare
wking
reviewed
Sep 19, 2017
| } | ||
|
|
||
| return nil | ||
| return validate.CapValid(cp, false) |
Contributor
There was a problem hiding this comment.
I like this change, but it seems orthogonal. Can 1a9532e get its own PR?
wking
approved these changes
Sep 19, 2017
Author
|
ping @mrunalp @liangchenye |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
According to the spec.
Signed-off-by: zhouhao zhouhao@cn.fujitsu.com