Keep the trailing equals sign out of parsed key names#2017
Open
devops-thiago wants to merge 1 commit into
Open
Keep the trailing equals sign out of parsed key names#2017devops-thiago wants to merge 1 commit into
devops-thiago wants to merge 1 commit into
Conversation
String.split omits empty subsequences by default, so an argument ending in "=" produced a single component. parseKeyValuePairs treated that as a standalone key and stored the whole unsplit argument, leaving the equals sign in the key name: "owner=" became the key "owner=" rather than "owner" with an empty value. The function's documentation states that a standalone key is treated as "key=", so both spellings should produce the same key. Keeping empty subsequences makes them agree. This affects --label and --opt on `container volume create` and `container network create`. Fixes apple#2013
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.
Type of Change
Motivation and Context
Fixes #2013.
Utility.parseKeyValuePairssplits each argument on the first equals sign.String.splitomits empty subsequences by default, so an argument ending in=produces a single component:The count is 1 rather than 2, so the standalone-key branch runs and stores the whole unsplit argument as the key.
--label owner=therefore creates the keyowner=instead ofownerwith an empty value.The doc comment on the function states that a standalone key is treated as
key=, which impliesownerandowner=should produce the same key. Keeping empty subsequences makes the two spellings agree.This affects
--labeland--optoncontainer volume createandcontainer network create.Testing
testKeyWithEmptyValueasserts thatowner=yields the keyownerand that the keyowner=is absent. The existingparseKeyValuePairstests for standalone keys, empty input, and mixed formats continue to pass, so the bare-key behaviour is unchanged.