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
[shared defaults] unable to locate files when environment variables are not set #4444
Comments
pending fix: |
Please see comments in PR. |
|
|
This line addresses your concern, were you reading the fix out of context? |
I was referring to this comment, which has since been addressed. Thank you for the fix. |
Describe the bug
The defaults for
SharedCredentialsFilename()
andSharedConfigFilename()
ininternal/shareddefaults/shared_config.go
rely onUserHomeDir()
to return the home directory of the current user:When either environment variable is not set,
SharedCredentialsFilename()
returns".aws/credentials"
, andSharedConfigFilename()
returns".aws/config"
- relative paths that can not be found.Expected Behavior
Certain test environments, such as e.g. bazel, clear the
HOME
environment variable, causing tests that rely on the Golang v1 SDK to fail.The situation is similar for Windows.
Other AWS SDKs (botocore, AWS C++ SDK >= 1.9) are resilient against changes in the environment, by looking up user information based on the UID of the user, rather than from the environment.
Current Behavior
Clearing
$HOME
on Linux, or running withinbazel test
causes the look-up of credential/configuration files~/.aws/{credentials,config}
to fail.Reproduction Steps
Run code compiled against the Golang v1 SDK by clearing the
$HOME
variable:unset HOME
orenv -i ./path/to/golang/executable
.Possible Solution
The standard library in
os/user
providesuser.Current()
, which provides theHomeDir
field.Additional Information/Context
Problem is also present in the Golang v2 SDK (same code) -- will create an issue there and refer to here.
SDK version used
v1.44.28
Environment details (Version of Go (
go version
)? OS name and version, etc.)Independent of Go version (= all versions).
The text was updated successfully, but these errors were encountered: