Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try USER variable to retrieve the username. #282

Conversation

iwanders
Copy link
Contributor

馃 Bug fix

Summary

This resolves a situation where gazebo is endlessly spamming:

Error getting username: no matching password record.

In our case, this triggered because a system was configured with ldap, but at runtime the libnss_systemd library wasn't available. This meant the user name lookup through ldap failed, and the fallback by reading it from /etc/passwd didn't work as the user wasn't present there. It can probably be reproduced by making the getpwuid_r always fail.

Basically, all this complexity can be removed by just checking the $USER environment variable. That is unlikely to fail on any linux system. I left the old behaviour in place as a fallback for if USER is not set, but I can't think of a situation where that would be.

Checklist

  • Signed all commits for DCO
  • Added tests -> there's one that checks if the user name is empty here
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@osrf-triage osrf-triage added this to Inbox in Core development Dec 17, 2021
@github-actions github-actions bot added the 馃彲 fortress Ignition Fortress label Dec 17, 2021
@chapulina chapulina moved this from Inbox to In review in Core development Dec 17, 2021
src/NetUtils.cc Outdated Show resolved Hide resolved
@iwanders iwanders force-pushed the SES-2685-fix-username-lookup-spam-ign-transport11 branch from 8d09ed2 to 54d9b66 Compare December 20, 2021 17:03
@codecov
Copy link

codecov bot commented Dec 21, 2021

Codecov Report

Merging #282 (be37fcc) into ign-transport11 (f3c8f8b) will decrease coverage by 0.01%.
The diff coverage is 66.66%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           ign-transport11     #282      +/-   ##
===================================================
- Coverage            89.07%   89.06%   -0.02%     
===================================================
  Files                   51       51              
  Lines                 4769     4772       +3     
===================================================
+ Hits                  4248     4250       +2     
- Misses                 521      522       +1     
Impacted Files Coverage 螖
src/NetUtils.cc 72.56% <66.66%> (-0.17%) 猬囷笍

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update f3c8f8b...be37fcc. Read the comment docs.

Copy link
Contributor

@caguero caguero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me, thanks for the patch!

Copy link
Contributor

@caguero caguero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, one little request. Could you rename user_variable to userVariable to be consistent with our style?

Signed-off-by: Ivor Wanders <ivor@iwanders.net>
@iwanders iwanders force-pushed the SES-2685-fix-username-lookup-spam-ign-transport11 branch from 54d9b66 to be37fcc Compare December 31, 2021 17:50
@iwanders
Copy link
Contributor Author

@caguero, certainly, I've pushed a new commit where we use userVariable instead of user_variable. So used to the ros styleguide that I didn't even think of checking whether the variable name I used matched the style guide. Sorry about that.

@iwanders iwanders requested a review from caguero January 7, 2022 13:51
@caguero caguero merged commit e02bd8b into gazebosim:ign-transport11 Jan 7, 2022
Core development automation moved this from In review to Done Jan 7, 2022
@j-rivero j-rivero removed this from Done in Core development May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃彲 fortress Ignition Fortress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants