Skip to content
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

Merged

Conversation

asselitx
Copy link
Contributor

@asselitx asselitx commented Sep 26, 2024

Ensure a path separator is added between two components of the new path.

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Cloud-compatibility
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

Tested locally with a bare-metal cluster- a rename through EclWatch

@asselitx asselitx requested a review from jakesmith September 26, 2024 15:35
Copy link

Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-32639

Jirabot Action Result:
Workflow Transition To: Merge Pending
Updated PR

Copy link
Member

@jakesmith jakesmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asselitx - one comment

@@ -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));
Copy link
Member

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));

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@asselitx asselitx requested a review from jakesmith October 1, 2024 22:52
Copy link
Member

@jakesmith jakesmith left a 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

@asselitx asselitx force-pushed the renameBadPath-HPCC-32639 branch from cee6554 to 43dbd4a Compare October 8, 2024 21:06
@asselitx asselitx changed the base branch from candidate-9.8.x to candidate-9.6.x October 8, 2024 21:07
@asselitx asselitx requested a review from jakesmith October 8, 2024 21:07
@asselitx
Copy link
Contributor Author

asselitx commented Oct 8, 2024

@jakesmith and @ghalliday - squashed and rebased to 9.6.x

@asselitx asselitx force-pushed the renameBadPath-HPCC-32639 branch from 43dbd4a to 8a318b0 Compare October 9, 2024 15:47
@asselitx
Copy link
Contributor Author

asselitx commented Oct 9, 2024

re-rebased and pushed to force stalled checks to run

Copy link
Member

@jakesmith jakesmith left a 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.

@asselitx
Copy link
Contributor Author

@ghalliday This is approved and ready to merge.

Copy link
Member

@ghalliday ghalliday left a 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.

inline StringBuffer &appendEnsurePathSepChar(StringBuffer &dest, StringBuffer &newPart, char psc)
{
addPathSepChar(dest, psc);
if (isPathSepChar(newPart.charAt(0)))
Copy link
Member

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>
@asselitx asselitx force-pushed the renameBadPath-HPCC-32639 branch from 8a318b0 to 9293ae5 Compare October 15, 2024 17:01
@asselitx asselitx requested a review from ghalliday October 15, 2024 17:01
@ghalliday ghalliday merged commit 98cf1b2 into hpcc-systems:candidate-9.6.x Oct 16, 2024
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants