runfinch / finch

The Finch CLI is an open source client for container development
https://www.runfinch.com
Apache License 2.0
3.51k stars 90 forks source link

fix: Use LimaUser method instead of host user name #712

Closed w-haibara closed 10 months ago

w-haibara commented 10 months ago

Issue #, if available: #399

Description of changes: In nerdctl_config_applier.go, editing .bashrc uses a file path based on the host's username. However, if the host's username contains . or @, lima uses lima as the username instead of the host's username. (ref: https://github.com/lima-vm/lima/blob/a8c703bf8b66d213d00542ef68271cd7b73612ef/pkg/osutil/user.go#L114-L119) Therefore, if the host's user name contains . or @, editing .bashrc fails. This PR fixes this so that you can get the actual username from LimaWrapper.LimaUser().

Testing done: yes

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

w-haibara commented 10 months ago

@vsiravar Thanks for review! I added a test in nerdctl_config_applier_test.go when local user is not a valid linux username.

I have also made additional changes. I would appreciate it if you would review again.

w-haibara commented 10 months ago

Thank you for merge it!