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

rcs: fix darwin build #59702

Merged
merged 1 commit into from Jun 11, 2019
Merged

rcs: fix darwin build #59702

merged 1 commit into from Jun 11, 2019

Conversation

thefloweringash
Copy link
Member

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@matthewbauer
Copy link
Member

@GrahamcOfBorg build rcs

@thefloweringash
Copy link
Member Author

I've pushed a the corrected hardening configuration, but haven't yet managed to reproduce the t999 failure seen in ofborg.

@LnL7
Copy link
Member

LnL7 commented Apr 17, 2019

@GrahamcOfBorg build rcs

@thefloweringash
Copy link
Member Author

thefloweringash commented Apr 18, 2019

I'll see if I can get the test case to print what failed, and then we can see what is failing under ofborg.

@thefloweringash thefloweringash force-pushed the darwin-rcs branch 2 times, most recently from 858b25d to f11fd5d Compare April 18, 2019 15:07
@thefloweringash
Copy link
Member Author

This latest version includes verbose reporting on test failure. Let's see what's happening.

@strager
Copy link
Contributor

strager commented Apr 20, 2019

Interesting: for commit f11fd5d4e8801df18e8a5a8a823332b16b700a3c, on my macOS 10.12 machine, I observed the following:

[1] with both sandbox=true and sandbox=false
[2] but then fails when installing, which is normal

@thefloweringash
Copy link
Member Author

thefloweringash commented Apr 20, 2019

I have found reason the tests fail: there's an observable difference in the build environment.

The difference can be seen with

nix-build --expr 'with (import ./. {}); runCommand "test-getlogin" {} 
    "${ruby}/bin/ruby -r etc -e \"puts Etc.getlogin\" "'

Where rcs tests pass, this returns nixbld1, and where rcs tests fail, this returns root. I don't know the cause of the difference.

The test failure is a result of two different methods of determining the username. In rcs, it looks at, in order, $LOGNAME, $USER, getlogin, getpwnam(ruid()). The test scripts look at, in order, id -un, whoami, $LOGNAME and $USER. In the build environments I inspected, LOGNAME and USER are unset. Ultimately rcs binaries use getlogin, and the test driver uses id -un. When it comes to testing expectations, the file is expected to be locked by the current user "nixbld1", but instead is locked by "root". We can make rcs build by setting USER to the result of id -un.

This exact situation appears to have been observed in 2014: https://lists.gnu.org/archive/html/hydra-users/2014-12/msg00002.html

@strager
Copy link
Contributor

strager commented Apr 20, 2019

We can make rcs build by setting USER to the result of id -un.

Possible upstreamable solution: Remove the call to getlogin_r in getusername (src/b-excwho.c). This could fix other cases too, like 'sudo -u anotheruser rcs ...'. (Or maybe not, and it'll break other things. I didn't look or think too carefully. =X)

I'm glad you were able to find the cause for the build weirdness. I guess nix-shell --pure isn't so pure after all. ;P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants