-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix INI parsing of whitespace preceding config key #3058
Comments
Thank you for submitting the ticket. We will be taking a look. |
I don't actually think this is so simple, I didn't consider nested configurations (i.e., services). I'm curious what you expect is the right behavior here. In this scenario, there is no nested configuration. Are top level properties permitted to be indented? Example:
|
I'm currently under the impression that the whitespaces on the top level properties should be ignored based on some guidelines set across AWS SDKs. We are still investigating so stay tuned. |
Update: We now have an internal ticket to resolve this bug and improve tests to cover edge cases. |
This may take a long time to fix because it's not straight forward. In fact I see many issues with our ini parsing in relation to other SDKs. My best advice would be to fix the config file as this will take some time to change and we'd like to fully align with the specification. I think the Ruby SDKs implementation predates that specification as such. |
I confirmed with the internal specification that this preceding space is NOT part of the specification and this is not a bug. INI specifications are generally not universal. I am closing this. The recommended fix is to fix your formatting as you've already pointed out. We've taken a backlog item to improve other parsing cases outlined in the internal specification not related to this specific issue. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
Whitespace before a key, specifically a key after a profile in the config file, causes the ini parser to fail. Per the TOML spec, whitespace around (before and after) keys and values should be ignores.
This profile works correctly:
This profile fails with
aws-sdk-core-3.197.0/lib/aws-sdk-core/ini_parser.rb:28:in
block in ini_parse': undefined method[]' for nil:NilClass (NoMethodError)
:Expected Behavior
A profile with whitespace before a key should be parsed correctly.
Should be parsed into
Current Behavior
A profile with whitespace before a key is not parsed correctly.
Results in the error
Reproduction Steps
Add a profile to your config file, typically found at
$HOME/.aws/config
. It should contain whitespace before the first key, e.g.Try to call IniParser::ini_parse with the file's contents
Possible Solution
The
item
andprefix
regex patterns can be modified to accommodate whitespace before keys.Can be modified to
Additional Information/Context
No response
Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version
aws-sdk-core 3.197
Environment details (Version of Ruby, OS environment)
Ruby 2.7, MacOS
The text was updated successfully, but these errors were encountered: