[SERVER-55711] Coverity analysis defect 118014: 'state' variable shadowed in checkState() Created: 01/Apr/21  Updated: 29/Oct/23  Resolved: 09/Sep/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.0.4, 5.1.0-rc0

Type: Improvement Priority: Minor - P4
Reporter: Coverity Collector User Assignee: Brett Nawrocki
Resolution: Fixed Votes: 0
Labels: coverity, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Backport Requested:
v5.0
Sprint: Sharding 2021-09-20
Participants:
Story Points: 1

 Description   

Parse warning

A parse warning may reduce maintainability of the code, or it may indicate a serious error. A parse warning from the Coverity parser may indicate a bug, or poor coding practice
/src/mongo/db/s/resharding/resharding_metrics.cpp:181: PW.PARAMETER_HIDDEN 118014 declaration hides parameter "state" (declared at line 174)

https://github.com/mongodb/mongo/blob/d1363de83fa77578720f71849780cedf083cee1b/src/mongo/db/s/resharding/resharding_metrics.cpp#L509



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 21/Sep/21 ]

Author:

{'name': 'Brett Nawrocki', 'email': 'brett.nawrocki@mongodb.com', 'username': 'brettnawrocki'}

Message: SERVER-55711 Rename variable which was shadowing parameter

(cherry picked from commit 075fdb1e7a56285e357fadf1ea69a10f870ba524)
Branch: v5.0
https://github.com/mongodb/mongo/commit/851283f5d6410c7139569c57c5e8406672c967f6

Comment by Githook User [ 09/Sep/21 ]

Author:

{'name': 'Brett Nawrocki', 'email': 'brett.nawrocki@mongodb.com', 'username': 'brettnawrocki'}

Message: SERVER-55711 Rename variable which was shadowing parameter
Branch: master
https://github.com/mongodb/mongo/commit/075fdb1e7a56285e357fadf1ea69a10f870ba524

Comment by Blake Oler [ 26/May/21 ]

Reserving for Matt Walak.

Edit: Matt Walak picked up some other neweng tickets

Comment by Kyle Suarez [ 01/Apr/21 ]

The original state variable is shadowed when building the error string. I filed this as a minor improvement but feel free to close.

Generated at Thu Feb 08 05:37:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.