-
Notifications
You must be signed in to change notification settings - Fork 305
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
HPCC-32639 Correct ECLWatch rename file path #19157
HPCC-32639 Correct ECLWatch rename file path #19157
Conversation
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-32639 Jirabot Action Result: |
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.
@asselitx - one comment
dali/base/dadfs.cpp
Outdated
@@ -4474,7 +4474,12 @@ protected: friend class CDistributedFilePart; | |||
if (isPathSepChar(newPath.charAt(newPath.length()-1))) | |||
newPath.setLength(newPath.length()-1); | |||
newPath.remove(0, myBase.length()); | |||
newdir.append(baseDir).append(newPath); | |||
// Ensure one path separator between baseDir and newPath | |||
newdir.append(addPathSepChar(baseDir, psc)); |
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.
This is potentially altering 'baseDir' (which is used later on line 4499).
It would be better not to alter baseDir (unless there's a reason for it? in which case there should be a comment explaining why). Assuming only a side-effect, better to change to:
newdir.append(baseDir);
addPathSepChar(newdir, psc));
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.
Good point I'll make that change.
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.
The side effect turned out to be necessary- baseDir
is used in that loop to build the path used for the rename operation. The newdir
variable was used to set file directory metadata. I thought this approach using a function was more clear, but if you feel it is overkill I can revert to the previous approach and comment instead.
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.
@asselitx - looks good. Please squash.
Assuming this is also a bug in 9.6 (and a regression from god knows when), I think should rebase onto 9.6.x
cee6554
to
43dbd4a
Compare
@jakesmith and @ghalliday - squashed and rebased to 9.6.x |
43dbd4a
to
8a318b0
Compare
re-rebased and pushed to force stalled checks to run |
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.
@asselitx - looks good. Ready to merge.
@ghalliday This is approved and ready to merge. |
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.
@asselitx picky querstion - just to check e don't introduce a crash.
dali/base/dadfs.cpp
Outdated
inline StringBuffer &appendEnsurePathSepChar(StringBuffer &dest, StringBuffer &newPart, char psc) | ||
{ | ||
addPathSepChar(dest, psc); | ||
if (isPathSepChar(newPart.charAt(0))) |
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.
Is here any potential for newPart to be zero length? (e.g. was '/' before trailing '/' removed? Is so the following could go wrong. (The test would pass, but newPart.str() would return a pointer passed the end of string.
Probably better is to pass newPart.str() as a const char * and then check *part, or also check the length.
Ensure a path separator is added between two components of the new path as it is used to update metadata and rename a file. Signed-off-by: Terrence Asselin <terrence.asselin@lexisnexisrisk.com>
8a318b0
to
9293ae5
Compare
Ensure a path separator is added between two components of the new path.
Type of change:
Checklist:
Smoketest:
Testing:
Tested locally with a bare-metal cluster- a rename through EclWatch