-
Notifications
You must be signed in to change notification settings - Fork 98
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
Add a homeDir field in LocalFileSystem for removefile to check #4543
base: master
Are you sure you want to change the base?
Conversation
679049a
to
00c5853
Compare
b3203e6
to
8a42558
Compare
b97e001
to
e40d223
Compare
Benchmark ResultMaster commit hash:
|
f748cb1
to
681381f
Compare
3c5bb2b
to
8a31a89
Compare
Benchmark ResultMaster commit hash:
|
Benchmark ResultMaster commit hash:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4543 +/- ##
==========================================
+ Coverage 87.34% 87.36% +0.02%
==========================================
Files 1348 1349 +1
Lines 56508 56639 +131
Branches 7112 7131 +19
==========================================
+ Hits 49357 49484 +127
- Misses 6981 6983 +2
- Partials 170 172 +2 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
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.
Let's also add some tests.
auto subStr = subPath.generic_string(); | ||
|
||
// Check if subStr starts with baseStr and ensure proper boundaries | ||
return subStr.starts_with(baseStr) && |
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 don't think the string based comparison is safe?
I will let @mewim comment on this
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 think we already guaranteed the path is a standard form absolute path that contains no ..
or .
, also checked the length of two path and their ending characters?
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.
Changed to a safer solution , which uses filesystem::relative to check the relation between two absolute dirs, should be safe enough
Benchmark ResultMaster commit hash:
|
6a06a2a
to
6c089de
Compare
3e0e0f0
to
ec6fd02
Compare
Benchmark ResultMaster commit hash:
|
f33c7c1
to
3019481
Compare
a0c2d49
to
dab9e8c
Compare
7961376
to
e488e21
Compare
Benchmark ResultMaster commit hash:
|
Tests are added via c api |
|
||
// Cleanup: Remove directories after the test | ||
std::filesystem::remove_all("/tmp/test2"); | ||
std::filesystem::remove_all("/tmp/dbHome/test2"); |
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.
Can you also add those test cases:
- Delete directories with edge cases.
- Test whether it works as expected on windows since windows paths can have a mixture of '\' and '/'.
For example: homedir: "C:\Desktop\dir"
Path to delete: "C:\Desktop/dir/test1" - Test whether we error in wild card pattern paths. (e.g. path to delete: '/tmp/kuzu*.test')
- Test when we delete a path with homedirectory symbol (e.g. path to delete "~/test")
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.
added more tests, we do not support wild card patter for safety.
aa25126
to
3572b8a
Compare
dac964e
to
a54fa52
Compare
698804b
to
f6e7168
Compare
Benchmark ResultMaster commit hash:
|
2cf9207
to
50b7e91
Compare
995bcf4
to
7955894
Compare
Benchmark ResultMaster commit hash:
|
a3870c9
to
f78dd3c
Compare
d564220
to
6ff8697
Compare
Benchmark ResultMaster commit hash:
|
Description
Added this for
removeFileIfExists(const std::string& path)
to only remove the files under our DBpathFixes #4529
Contributor agreement