[SERVER-8816] Audit all uses of strstr in the code Created: 01/Mar/13  Updated: 19/Apr/22  Resolved: 19/Apr/22

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Billy Donahue
Resolution: Done Votes: 0
Labels: move-sa, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-8814 Inserts into any namespace ending in ... Closed
Sprint: Service Arch 2022-05-02
Participants:

 Description   

We use strstr in many places, often incorrectly (see SERVER-8814). We should go through and look at (and probably change) all uses of strstr in our code.



 Comments   
Comment by Billy Donahue [ 19/Apr/22 ]

I don't find the claim that it is used "often incorrectly" to be supported in the remaining uses. I see some were cleaned up.

SERVER-8814 seems to have been about mishandling NamespaceString strings by doing a strstr search on them instead of using the NamespaceString class and there were some cargo-cult instances of strstr used for that purpose but they were all fixed.

All remaining uses of strstr in the codebase are correct as far as I can tell.
I don't think it's known as being particularly error-prone. But you have to know when a substring search is the correct match to use. If you spell it as strstr or as something else.

Comment by Andrew Morrow (Inactive) [ 22/Jun/19 ]

This seems like it could clearly go to a future quick wins bucket, so putting back for scheduling.

Generated at Thu Feb 08 03:18:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.