-
Notifications
You must be signed in to change notification settings - Fork 119
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
bug: IsParent doesn't handle the case where paths are empty properly #1116
Comments
hey @HarikrishnanBalagopal, i would like to work on this issue. can you please assign this to me |
Do I need to make changes throughout the entire repository where the |
Not only the places where There are a few places where relative paths may be necessary but I can't recall right now where that is. |
func IsParent(child, parent string) bool {
var err error
child, err = filepath.Abs(child)
if err != nil {
logrus.Fatalf("Failed to make the path %s absolute. Error: %s", child, err)
}
parent, err = filepath.Abs(parent)
if err != nil {
logrus.Fatalf("Failed to make the path %s absolute. Error: %s", parent, err)
}
if parent == "/" {
return true
} |
because that's the bug. The path in the calling context is a relative path (or empty string) and the path inside the In general we try to use only absolute paths in all the internal functions to avoid these sort of conversions and associated bugs. |
@akagami-harsh are you working it? |
@satyampsoni Go for it. |
Bug
Overview
move2kube/common/utils.go
Line 1078 in e88cece
When path is relative it joins with the current working.
In WASM the current working directory is
/
and we hit this if conditionmove2kube/common/utils.go
Lines 1088 to 1090 in e88cece
so it returns true.
And because
IsParent
returns true, we try to make a path relative to an empty string''
and hit this errormove2kube/environment/environment.go
Lines 272 to 274 in e88cece
Fix
if parent == "" || child == "" { return false; }
in theIsParent
functionThe text was updated successfully, but these errors were encountered: