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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lf: fix panic error on systems where user is not in /etc/passwd #196614

Merged
merged 2 commits into from
Oct 27, 2022

Conversation

GaetanLepage
Copy link
Contributor

Description of changes

This fixes this issue which happens on systems where the user is not in /etc/passwd.
I submitted a fix upstream (to the lf repository) that solves this problem at the package level.
This PR adds the osusergo build tag to the derivation which ensures that the pure go implementation of os/user is used instead of the one relying on libc.
Indeed, the pure go implementations has a fallback for this case which consists in looking at the $USER and $HOME environment variables.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@dotlambda

@SuperSandro2000
Copy link
Member

SuperSandro2000 commented Oct 25, 2022

darwin fails with:

2022/10/18 16:08:34 user: user: Current requires cgo or $USER set in environment
2022/10/18 16:08:34 $USER variable is empty or not set
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x112ab63]

@GaetanLepage
Copy link
Contributor Author

Oh ! Maybe the MacOS pure-go implementation of os/user cannot do anything more than looking at the $USER env variable...
Is it possible to set this option when not using darwin ?

@GaetanLepage
Copy link
Contributor Author

@SuperSandro2000 I now apply the fix only when not using darwin. Tell me if this works for you :)

@SuperSandro2000
Copy link
Member

I just looked at ofborg and that it failed there.

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

otherwise LGTM

@SuperSandro2000 SuperSandro2000 merged commit 1d3d61b into NixOS:master Oct 27, 2022
@GaetanLepage GaetanLepage deleted the fix-lf-osusergo branch October 27, 2022 12:00
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux and removed 10.rebuild-darwin: 1 10.rebuild-darwin: 1-10 10.rebuild-linux: 1 10.rebuild-linux: 1-10 labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants