forked from facebook/watchman
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libart: better defined behavior when a full prefix key is encountered
Summary: a facet of the libart implementation that is undocumented except for a series of issues (linked below) is this: an inserted key must not be a full prefix of another key that is already stored in the tree. The recommendation is to store keys that have a terminator character. armon/libart#4 armon/libart#12 armon/libart#14 armon/libart#17 Our usage in watchman can't guarantee to provide a NUL-terminated input, so this diff adjusts the key comparison routines to generate an implicit or synthetic NUL terminator character when comparing one character beyond the end of a key, and by asserting (or allowing ASAN to complain) if we try to look more than 1 character beyond the end. I also tidied up the function signatures of a couple of matching functions so that the semantics are clearer (return boolean true for success rather than integer 0) and removed some redundant casts when invoking callbacks. Test Plan: added an explicit test for the full-prefix issue. Built with -fsanitize=address and ran the integration tests as well as the sparse/unsparse checks I've been using for the pending list changes.
- Loading branch information
Showing
6 changed files
with
204 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.