-
Notifications
You must be signed in to change notification settings - Fork 52
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: clean paths after reading config #341
Conversation
Signed-off-by: German Lashevich <[email protected]>
d5ebf42
to
80a2003
Compare
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.
Reducing paths to their most minimal form before processing them makes sense too me 🚀
This is something we could throw a test in for. Maybe a vendir with something like files/..
.
This looks otherwise good to me!
@@ -278,3 +280,12 @@ func (c Config) checkOverlappingPaths() error { | |||
|
|||
return nil | |||
} | |||
|
|||
func (c *Config) cleanPaths() { |
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.
Since we are change the configuration directly will this have any impact on the lazy feature?
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.
I'm not sure I understand the question.
Paths are clean up right after reading the config, so after that any operation uses so to say "canonical" path, including the lock file and lazy functionality.
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.
But if the lock file already exists, the path might be different correct?
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.
But if the lock file already exists, the path might be different correct?
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.
Yes, the current vendir behavior is to copy paths from the config to the lock file literally. With the cleanup logic, paths can differ between the config and the lock file. It is basically the same as changing vendor/
to vendor
in the config and run sync. The lock file will be updated with the new path.
So, yes, if this is merged, the next sync with the new version of vendir will invalidate the "lazy cache" in some cases. But I don't think that can be an issue.
Signed-off-by: German Lashevich <[email protected]>
It seems that in the community meeting we agreed to proceed with this idea. I'll add some e2e tests tomorrow. |
Signed-off-by: German Lashevich <[email protected]>
0346e6c
to
52843a3
Compare
The test has landed, please, review. NOTE: I intentionally did not add test cases with destructive or insecure paths (e.g. |
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.
LGTM
LGTM |
This PR adds mandatory processing of directory and content paths with the
filepath.Clean
function. It allows to avoid problems with paths containing..
and.
. This, in turn, fixes the lazy functionality. At the moment, pathsfoo
andfoo/
(or evenfoo//
) are treated as different destinations and are re-downloaded.Fixes #347
Fixes #348