-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
internal/ini: INI Parser Fails Subsequent Section Parsing With Missing Right Hand Value in Previous Section #2800
Comments
Reference: aws#2800 ``` --- FAIL: TestParser (0.00s) --- FAIL: TestParser/complex_section_statement#02 (0.00s) ini_parser_test.go:302: expected same length 4, but received 3 ini_parser_test.go:317: expected: 0: {completed_stmt {0 NONE 0 []} false [{section_stmt {1 STRING 0 [100 101 102 97 117 108 116]} true []}]} 1: {skip {0 NONE 0 []} false [{ {4 NONE 0 [61]} true [{expr {1 STRING 0 [115 51]} true []}]}]} 2: {completed_stmt {0 NONE 0 []} false [{section_stmt {1 STRING 0 [97 115 115 117 109 101 114 111 108 101]} true []}]} 3: {expr_stmt {0 NONE 0 []} false [{ {4 NONE 0 [61]} true [{expr {1 STRING 0 [111 117 116 112 117 116]} true []} {expr {1 STRING 0 [106 115 111 110]} true []}]}]} received: 0: {completed_stmt {0 NONE 0 []} false [{section_stmt {1 STRING 0 [100 101 102 97 117 108 116]} true []}]} 1: {skip {0 NONE 0 []} false [{ {4 NONE 0 [61]} true [{expr {1 STRING 0 [115 51]} true []}]}]} 2: {expr_stmt {0 NONE 0 []} false [{ {4 NONE 0 [61]} true [{expr {1 STRING 0 [111 117 116 112 117 116]} true []} {expr {1 STRING 0 [106 115 111 110]} true []}]}]} --- FAIL: TestValidDataFiles (0.01s) walker_test.go:59: could not find profile bar ```
Reference: aws#2800 ``` --- FAIL: TestParser (0.00s) --- FAIL: TestParser/complex_section_statement#02 (0.00s) ini_parser_test.go:302: expected same length 4, but received 3 ini_parser_test.go:317: expected: 0: {completed_stmt {0 NONE 0 []} false [{section_stmt {1 STRING 0 [100 101 102 97 117 108 116]} true []}]} 1: {skip {0 NONE 0 []} false [{ {4 NONE 0 [61]} true [{expr {1 STRING 0 [115 51]} true []}]}]} 2: {completed_stmt {0 NONE 0 []} false [{section_stmt {1 STRING 0 [97 115 115 117 109 101 114 111 108 101]} true []}]} 3: {expr_stmt {0 NONE 0 []} false [{ {4 NONE 0 [61]} true [{expr {1 STRING 0 [111 117 116 112 117 116]} true []} {expr {1 STRING 0 [106 115 111 110]} true []}]}]} received: 0: {completed_stmt {0 NONE 0 []} false [{section_stmt {1 STRING 0 [100 101 102 97 117 108 116]} true []}]} 1: {skip {0 NONE 0 []} false [{ {4 NONE 0 [61]} true [{expr {1 STRING 0 [115 51]} true []}]}]} 2: {expr_stmt {0 NONE 0 []} false [{ {4 NONE 0 [61]} true [{expr {1 STRING 0 [111 117 116 112 117 116]} true []} {expr {1 STRING 0 [106 115 111 110]} true []}]}]} --- FAIL: TestValidDataFiles (0.01s) walker_test.go:59: could not find profile bar ```
Thanks for reporting this issue @bflad, and providing the test cases. I'm able to reproduce the behavior being reported, and we can investigate a solution for this bug. I think this issue is related to the SDK's INI parser parsing nested key/value pairs as a value of a field. While the SDK does not make use of these nested key/value pairs, the AWS CLI commonly will use these in the shared config file, (e.g. aws/aws-sdk-go-v2#345). |
The ini parser incorrectly decided whether a statement should be skipped. As a result, valid statements in the ini files were being squashed. The PR fixes incorrect modifications to the previous token value of the skipper. We also add checks for cases where a skipped statement should be marked as complete and not be ignored. Adds test cases for cases for statements that need to be skipped. Also adds suggested tests from #2801 . Fixes #2800
=== ### Service Client Updates * `service/cloudfront`: Updates service API and documentation * CloudFront adds support for managing the public keys for signed URLs and signed cookies directly in CloudFront (it no longer requires the AWS root account). * `service/ec2`: Updates service API and documentation * instance-storage-info nvmeSupport added to DescribeInstanceTypes API * `service/globalaccelerator`: Updates service API and documentation * `service/glue`: Updates service API and documentation * AWS Glue crawlers now support incremental crawls for the Amazon Simple Storage Service (Amazon S3) data source. * `service/kendra`: Updates service API and documentation * This release adds custom data sources: a new data source type that gives you full control of the documents added, modified or deleted during a data source sync while providing run history metrics. * `service/organizations`: Updates service documentation * AWS Organizations renamed the 'master account' to 'management account'. ### SDK Bugs * `aws/credentials`: Fixed a race condition checking if credentials are expired. ([#3448](#3448)) * Fixes [#3524](#3524) * `internal/ini`: Fixes ini file parsing for cases when Right Hand Value is missed in the last statement of the ini file ([#3596](#3596)) * related to [#2800](#2800)
Release v1.35.12 (2020-10-21) === ### Service Client Updates * `service/cloudfront`: Updates service API and documentation * CloudFront adds support for managing the public keys for signed URLs and signed cookies directly in CloudFront (it no longer requires the AWS root account). * `service/ec2`: Updates service API and documentation * instance-storage-info nvmeSupport added to DescribeInstanceTypes API * `service/globalaccelerator`: Updates service API and documentation * `service/glue`: Updates service API and documentation * AWS Glue crawlers now support incremental crawls for the Amazon Simple Storage Service (Amazon S3) data source. * `service/kendra`: Updates service API and documentation * This release adds custom data sources: a new data source type that gives you full control of the documents added, modified or deleted during a data source sync while providing run history metrics. * `service/organizations`: Updates service documentation * AWS Organizations renamed the 'master account' to 'management account'. ### SDK Bugs * `aws/credentials`: Fixed a race condition checking if credentials are expired. ([#3448](#3448)) * Fixes [#3524](#3524) * `internal/ini`: Fixes ini file parsing for cases when Right Hand Value is missed in the last statement of the ini file ([#3596](#3596)) * related to [#2800](#2800)
Please fill out the sections below to help us address your issue.
Version of AWS SDK for Go?
v1.23.0
Version of Go (
go version
)?go version go1.12.9 darwin/amd64
What issue did you see?
Given an errant
~/.aws/credentials
file such as the following (missing right hand values in the first section):In the AWS Go SDK, attempting to use
bar
credentials fails while usingbaz
credentials works. In the AWS CLI, attempting to usebar
credentials works. Verbose errors from the chain credential provider reports:SharedCredsLoad: failed to load profile, bar.
Any of these INI file fixes/workarounds allow
bar
to work as expected:[bar]
section headerSteps to reproduce
Summed up fairly well downstream in: hashicorp/terraform-provider-aws#9854
The text was updated successfully, but these errors were encountered: