[orchagent] Fix getopt string for -R option (ring_thread_enabled regression)#4207
Merged
prsunny merged 5 commits intosonic-net:masterfrom Feb 23, 2026
Merged
Conversation
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
prsunny
reviewed
Feb 10, 2026
Collaborator
prsunny
left a comment
There was a problem hiding this comment.
D is added for delay. @dgsudharsan , please review
dgsudharsan
approved these changes
Feb 11, 2026
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
@Chiranjeevi-U-ML Don't we have a UT in buildimage or vstest to catch these failures? If possible can we add UT? |
dgsudharsan
requested changes
Feb 11, 2026
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Chiranjeevi U <chiranjeevi.uddanti@xoriant.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
Author
|
@dgsudharsan Added an integration test |
Collaborator
|
@dgsudharsan , can you sign off? |
dgsudharsan
approved these changes
Feb 11, 2026
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
ksravani-hcl
pushed a commit
to ksravani-hcl/sonic-swss
that referenced
this pull request
Feb 25, 2026
…ession) (sonic-net#4207) What I did Fixed a typo in the getopt option string in orchagent/main.cpp where the -R option was incorrectly defined as requiring a mandatory argument (R:) instead of being a simple flag (R). The fix changes line 403 from: while ((opt = getopt(argc, argv, "b:m:r:f:j:d:i:hsz:k:q:c:t:v:I:R:D:M")) != -1) to: while ((opt = getopt(argc, argv, "b:m:r:f:j:d:i:hsz:k:q:c:t:v:I:RD:M")) != -1) Why I did it When ring_thread_enabled is set to true in DEVICE_METADATA, orchagent fails to start with the error: /usr/bin/orchagent: option requires an argument -- 'R' This bug was introduced in PR sonic-net#3814 (specifically, commit 5de5922) when the -D option was added. The getopt string was changed from I:R to I:R:D: instead of the correct I:RD:. This accidentally added a colon after R, making it require a mandatory argument.
ksravani-hcl
pushed a commit
to ksravani-hcl/sonic-swss
that referenced
this pull request
Feb 26, 2026
…ession) (sonic-net#4207) What I did Fixed a typo in the getopt option string in orchagent/main.cpp where the -R option was incorrectly defined as requiring a mandatory argument (R:) instead of being a simple flag (R). The fix changes line 403 from: while ((opt = getopt(argc, argv, "b:m:r:f:j:d:i:hsz:k:q:c:t:v:I:R:D:M")) != -1) to: while ((opt = getopt(argc, argv, "b:m:r:f:j:d:i:hsz:k:q:c:t:v:I:RD:M")) != -1) Why I did it When ring_thread_enabled is set to true in DEVICE_METADATA, orchagent fails to start with the error: /usr/bin/orchagent: option requires an argument -- 'R' This bug was introduced in PR sonic-net#3814 (specifically, commit 5de5922) when the -D option was added. The getopt string was changed from I:R to I:R:D: instead of the correct I:RD:. This accidentally added a colon after R, making it require a mandatory argument.
ksravani-hcl
pushed a commit
to ksravani-hcl/sonic-swss
that referenced
this pull request
Feb 27, 2026
…ession) (sonic-net#4207) What I did Fixed a typo in the getopt option string in orchagent/main.cpp where the -R option was incorrectly defined as requiring a mandatory argument (R:) instead of being a simple flag (R). The fix changes line 403 from: while ((opt = getopt(argc, argv, "b:m:r:f:j:d:i:hsz:k:q:c:t:v:I:R:D:M")) != -1) to: while ((opt = getopt(argc, argv, "b:m:r:f:j:d:i:hsz:k:q:c:t:v:I:RD:M")) != -1) Why I did it When ring_thread_enabled is set to true in DEVICE_METADATA, orchagent fails to start with the error: /usr/bin/orchagent: option requires an argument -- 'R' This bug was introduced in PR sonic-net#3814 (specifically, commit 5de5922) when the -D option was added. The getopt string was changed from I:R to I:R:D: instead of the correct I:RD:. This accidentally added a colon after R, making it require a mandatory argument.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
Fixed a typo in the getopt option string in
orchagent/main.cppwhere the-Roption was incorrectly defined as requiring a mandatory argument (R:) instead of being a simple flag (R).The fix changes line 403 from:
to:
Why I did it
When ring_thread_enabled is set to true in DEVICE_METADATA, orchagent fails to start with the error:
/usr/bin/orchagent: option requires an argument -- 'R'This bug was introduced in PR #3814 (specifically, commit 5de5922) when the -D option was added.
The getopt string was changed from
I:RtoI:R:D:instead of the correctI:RD:.This accidentally added a colon after R, making it require a mandatory argument.
How I verified it
I did a code review and verified that the -R case handler does not use
optargand simply setsgRingMode = true. Also, I have checked the git history and traced the bug introduction to PR #3814 and confirmed the original implementation in PR #3242 was correct.Check the code lines here:
Original PR link:
https://github.com/sonic-net/sonic-swss/pull/3242/changes#diff-3cba33a216c0ea2b942dc03b2638fa27a40a8b6eb81abf9f83f13e1ee7831ac4R360
Bug Link:
https://github.com/sonic-net/sonic-swss/pull/3814/changes#diff-3cba33a216c0ea2b942dc03b2638fa27a40a8b6eb81abf9f83f13e1ee7831ac4R373
Details if related
Fixes: sonic-net/sonic-buildimage#25366