-
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-31416 CDistributedSuperFile::querySubFile may return incorrect subfile #18385
Conversation
https://track.hpccsystems.com/browse/HPCC-31416 |
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.
@shamser - looks good, 2 trivial comments
@@ -6271,20 +6271,22 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile> | |||
virtual IDistributedFile &querySubFile(unsigned idx,bool sub) override | |||
{ | |||
CriticalBlock block (sect); | |||
if (sub) { | |||
if (sub) | |||
{ |
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.
trivial: formatting change, now inconsistent with other existing code below.
This style is preferred, but if changing, need to make the rest of the function consistently use it.
dali/base/dadfs.cpp
Outdated
return f; | ||
} | ||
// fall through to error | ||
throw makeStringExceptionV(-1,"CDistributedSuperFile::querySubFile(%u) for superfile %s - subfile doesn't exist ", idx, logicalName.get()); | ||
} | ||
return subfiles.item(idx); |
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.
trivial: let's make it clear that this is an else now, i.e.:
}
else
return subfiles.item(idx);
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.
@shamser - looks good. Please squash.
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.
@shamser - looks good
I do wonder whether this should target 9.4, but it's such an old bug.. that has gone unnoticed until now. The only place that hit it, was related to HPCC-31393, that was fixed in 9.4.
I think it's okay to target 9.6.
@shamser please rebase to 9.4.x since it is a bugfix. |
…ubfile Querying CDistributedSuperFile for a subfile that doesn't exist returned a subfile instead of throwing an exception. By not throwing an error, incorrect code that calls querySubFile may be appear to work. This fix modifies querySubFile so that it throws an exception when the subfile number is not valid. Signed-off-by: Shamser Ahmed <shamser.ahmed@lexisnexis.com>
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.
@ghalliday - ready to merge.
Querying CDistributedSuperFile for a subfile that doesn't exist returned a subfile instead of throwing an exception. By not throwing an error, incorrect code that calls querySubFile may be appear to work. This fix modifies querySubFile so that it throws an exception when the subfile number is not valid.
Type of change:
Checklist:
Smoketest:
Testing: