-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix for Issue #104 #107
Fix for Issue #104 #107
Conversation
This changes our logic for detecting duplicate definitions on case-sensitive file-systems to only operate on files of interest and to fix this detection logic per issue OpenCyphal#104. If globular searches find duplicates we do not waste time detecting this until/unless these duplicates are actually considered when parsing target definitions.
found = list(filter(lambda d: d.full_name == full_name and d.version == version, self._lookup_definitions)) | ||
found = list( | ||
filter( | ||
lambda d: d.full_name.lower() == full_name.lower() and d.version == version, self._lookup_definitions |
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 seems to make the search case-insensitive, why? In the Spec we state that identifiers are case-sensitive, but it is still considered a collision if identifiers differ by letter case only. Does this change allow the following:
# Foo.1.0.dsdl
bar.1.0 bar # Will "bar.1.0" name "Bar.1.0"?
@sealed
# Bar.1.0.dsdl
@sealed
If yes, then it seems to be a problem.
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.
Since Bar.1.0.dsdl
and bar.1.0.dsdl
will both be accepted by this filter the later logic that requires only 1 result will raise the appropriate collision exception.
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.
Okay but I'm not talking about collisions here, but rather the selectivity of the search. If I only have Bar.1.0.dsdl
and I can name it bar.1.0.dsdl
, we have a problem, right?
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.
You don't if only 1 dsdl file is found. If two are found then it is a collision caused either by case-sensitivity issues or by multiple paths to the same definition in different files. So selectivity doesn't matter since we never select one of multiple values returned from this filter.
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.
ping?
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.
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 we please extend the test for issue 104 with another definition that contains the following field definition and ensure that it fails to parse:
a.b.thing.Thingtype.1.0 thing
Promoting case-sensitivity issue from assertion error to DataTypeNameCollisionError
We good now? |
Ping? I have another PR parked behind this one too. |
Apologies for the delay, things pile up. |
Co-authored-by: Pavel Kirienko <[email protected]>
This changes our logic for detecting duplicate definitions on case-sensitive file-systems to only operate on files of interest and to fix this detection logic per issue #104.
If globular searches find duplicates we do not waste time detecting this until/unless these duplicates are actually considered when parsing target definitions.