Opened 16 years ago
Closed 16 years ago
#3186 closed bug (fixed)
BDirectory::Contains() is broken for certain cases of similar paths
Reported by: | anevilyak | Owned by: | axeld |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | Kits/Storage Kit | Version: | R1/pre-alpha1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description (last modified by )
Steps to reproduce:
- Create a directory called New Folder.
- Create a directory called New Folder 2.
- Get a BDirectory object for New Folder, a BEntry for New Folder 2, and call BDirectory::Contains() on the resulting entry. It will (incorrectly) return true, because Contains currently compares the paths of the two up to the length of the directory itself. Attached please find a patch intended to fix the situation by comparing the path components individually.
Attachments (1)
Change History (7)
comment:1 by , 16 years ago
Description: | modified (diff) |
---|
comment:2 by , 16 years ago
Description: | modified (diff) |
---|
comment:3 by , 16 years ago
comment:4 by , 16 years ago
Updated patch attached, let me know if you see any problems with it, or perhaps a better way to accomplish it, otherwise I can commit that.
comment:5 by , 16 years ago
Isn't that a bit too complicated? I think all that's missing is a check if the other path actually ends at that point, ie. has a '/' at that position or not.
comment:6 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Indeed, you're right, thanks for reviewing! Sometimes it's easy to miss the obvious :) Fixed in hrev28754.
Note:
See TracTickets
for help on using tickets.
On second thought, that patch is flawed also, give me some time to rework.