-
Notifications
You must be signed in to change notification settings - Fork 568
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
osutils: deal with ENOENT in UserMaybeSudoUser() #11275
Conversation
When the `sssd` package is installed on a Ubuntu system the
`TestUserMaybeSudoUser` test will fail because then `user.Lookup`
returns a generic error
```
user: lookup username guy: no such file or directory
```
because in the go layer the getpw{uid,nam}_r() returned ENOENT.
This is already reported upstream as
golang/go#40334
This commit works around this upstream issue by checking for
ENOENT on the error from user.Lookup(). It's not nice but the
best I could come up to to handle this case. On my 21.10 system
sssd is installed as part of `ubuntu-desktop-minimal`.
Codecov Report
@@ Coverage Diff @@
## master #11275 +/- ##
==========================================
- Coverage 78.36% 78.35% -0.01%
==========================================
Files 927 927
Lines 105700 105710 +10
==========================================
- Hits 82832 82830 -2
- Misses 17719 17728 +9
- Partials 5149 5152 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a unit test failure FAIL: runner_test.go:1498: runnerSuite.TestRepairModesAndBases, but it seems unrelated to the PR
…t() and simply code a little bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
When the
sssdpackage is installed on a Ubuntu system theTestUserMaybeSudoUsertest will fail because thenuser.Lookupreturns a generic error
because in the go layer the getpw{uid,nam}_r() returned ENOENT.
This is already reported upstream as
golang/go#40334
This commit works around this upstream issue by checking for
ENOENT on the error from user.Lookup(). It's not nice but the
best I could come up to to handle this case. On my 21.10 system
sssd is installed as part of
ubuntu-desktop-minimal.