Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to INI file parsing in [email protected] and [email protected] #2349

Closed
gdavison opened this issue Nov 3, 2023 · 3 comments · Fixed by #2359
Closed

Change to INI file parsing in [email protected] and [email protected] #2349

gdavison opened this issue Nov 3, 2023 · 3 comments · Fixed by #2359
Assignees
Labels
bug This issue is a bug. p1 This is a high priority issue

Comments

@gdavison
Copy link
Contributor

gdavison commented Nov 3, 2023

Describe the bug

In previous versions, leading whitespace before keys in INI files would be ignored during parsing. A file with leading whitespace such as

	[default]
	retry_mode = standard

would successfully use the RetryMode standard

Staring in v1.21.0 this file would not be parsed and configuration would silently fail.

Expected Behavior

One of two options is expected:

  1. Leading whitespace would continue to be ignored
  2. If the file is not parseable, an error should be returned, or at least a warning should be logged

Current Behavior

The SDK silently ignores the parsing failure

Reproduction Steps

In the test TestParser (

func TestParser(t *testing.T) {
), add a case

		{
			name: "section statement leading whitespace",
			r: bytes.NewBuffer([]byte(
				`	[default]
	region="us-west-2"`)), // Ensure there is leading whitespace on this line
			expectedStack: []AST{
				newCompletedSectionStatement(
					defaultProfileStmt,
				),
				newExprStatement(regionEQRegion),
			},
		},

This will fail with

expected:
0: {completed_stmt {0 NONE 0 []} false [{section_stmt {1 STRING 0 [100 101 102 97 117 108 116]} true []}]}
1: {expr_stmt {0 NONE 0 []} false [{ {4 NONE 0 [61]} true [{expr {1 STRING 0 [114 101 103 105 111 110]} true []} {expr {1 0 [34 117 115 45 119 101 115 116 45 50 34]} true []}]}]}

received:

Possible Solution

No response

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2/config v1.22.0

Compiler and Version used

go version go1.21.0 darwin/arm64

Operating System and version

macOS 13.4.1

@gdavison gdavison added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 3, 2023
@gdavison gdavison changed the title Change to INI file parsing in [email protected] Change to INI file parsing in [email protected] and [email protected] Nov 3, 2023
@lucix-aws lucix-aws added the p1 This is a high priority issue label Nov 6, 2023
@lucix-aws
Copy link
Contributor

Almost certainly a regression from #2226

@isaiahvita
Copy link
Contributor

isaiahvita commented Nov 9, 2023

@gdavison i just put up a PR to resolve this issue. While we would have liked the maintain the old behavior of ignoring the extra whitespace in front of a property definition, this will not be possible in order to support this feature aws/aws-sdk#229

This is because leading whitespace in front of a property definition is now defined as a "sub-property" and subproperties are used to support the feature above. So, we will be throwing a new error as shown in #2359

The added changelog will reflect this breakfix.

Copy link

github-actions bot commented Nov 9, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p1 This is a high priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants