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
git: fix the "perlSupport = false" configuration #74213
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wmertens
approved these changes
Nov 26, 2019
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 - but I propose you change the target branch to staging
.
When perlSupport = false, we will set NO_PERL=1, and build Git without Perl support. This is a build option that Git supports. However, Git's test suite still requires a Perl to be available to run the tests, and we did not provide one. The tests respect PERL_PATH, and if it is not set, they default to /usr/bin/perl. Before this commit, if we set "perlSupport = false", then no Perl would be available to the package, and so the tests would default to /usr/bin/perl. When building without a sandbox, that could still work, even though there is no "perl" on the path, because the tests defaulted to an absolute path. You can reproduce this issue as follows: nix-build -E 'let pkgs = (import ./default.nix) {}; in pkgs.git.override { perlSupport = false; }' I just ran into this when trying to build pkgs.git from an old version of Nixpkgs that I was able to build just fine in the past, and today it would not build any more, complaining when running the tests: make -C t/ all make[1]: Entering directory '/build/git-2.18.0/t' rm -f -r 'test-results' /nix/store/czx8vkrb9jdgjyz8qfksh10vrnqa723l-bash-4.4-p23/bin/bash: /usr/bin/perl: No such file or directory In the past the sandbox was not enabled by default, so then it worked for me. But now that it is enabled, my host's (not NixOS) /usr/bin/perl is no longer accessible, and the build fails. The solution is to explicitly set PERL_PATH when running the tests. This *almost* works, except that there appears to be a bug in the test for "git request-pull". That command is a Bash script that calls Perl at some point, so it requires Perl, and therefore it cannot be supported when NO_PERL=1. But that particular test does not check whether Git was compiled with Perl support (other tests do include that check), and that makes the test fail: t5150-request-pull.sh .............................. not ok 4 - pull request after push not ok 5 - request asks HEAD to be pulled not ok 6 - pull request format not ok 7 - request-pull ignores OPTIONS_KEEPDASHDASH poison not ok 9 - pull request with mismatched object not ok 10 - pull request with stale object Dubious, test returned 1 (wstat 256, 0x100) Failed 6/10 subtests This output makes sense if you look at t5150-request-pull.sh. Test 1 and 2 are setup steps. Test 3 does call request-pull, but it expects the command to fail, and it cannot distinguish between the command exiting with a nonzero exit code, or failing to start it at all. So test 3 passes for the wrong reasons. Test 4 through 10 all call request-pull, so they fail. The quick workaround here is to disable the test. I will look into upstreaming a patch that makes the test skip itself when Perl is disabled.
ruuda
force-pushed
the
fix-git-perl-support
branch
from
November 27, 2019 18:24
895108c
to
2163fc7
Compare
Thanks for having a look! I rebased this on top of |
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When
perlSupport = false
, we will setNO_PERL=1
, and build Git without Perl support. This is a build option that Git supports. However, Git's test suite still requires a Perl to be available to run the tests, and we did not provide one. The tests respectPERL_PATH
, and if it is not set, they default to/usr/bin/perl
.Before this commit, if we set
perlSupport = false
, then no Perl would be available to the package, and so the tests would default to/usr/bin/perl
. When building without a sandbox, that could still work,even though there is no
perl
on the path, because the tests defaulted to an absolute path.You can reproduce this issue as follows:
I just ran into this when trying to build
pkgs.git
from an old version of Nixpkgs that I was able to build just fine in the past, and today it would not build any more, complaining when running the tests:In the past the sandbox was not enabled by default, so then it worked for me. But now that it is enabled, my host's (not NixOS)
/usr/bin/perl
is no longer accessible, and the build fails.The solution is to explicitly set
PERL_PATH
when running the tests. This almost works, except that there appears to be a bug in the test forgit request-pull
. That command is a Bash script that calls Perl at some point, so it requires Perl, and therefore it cannot be supported whenNO_PERL=1
. But that particular test does not check whether Git was compiled with Perl support (other tests do include that check), and that makes the test fail:This output makes sense if you look at
t5150-request-pull.sh
. Test 1 and 2 are setup steps. Test 3 does call request-pull, but it expects the command to fail, and it cannot distinguish between the command exiting with a nonzero exit code, or failing to start it at all. So test 3 passes for the wrong reasons. Test 4 through 10 all call request-pull, so they fail.The quick workaround here is to disable the test. I will look into upstreaming a patch that makes the test skip itself when Perl is disabled.
Motivation for this change
Without sandbox, setting
perlSupport = false
creates an implicit dependency on the host system. With sandbox, building withperlSupport = false
fails.Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)I also verified that this does not introduce a Perl dependency in the closure with
nix-store -qR
.Notify maintainers
cc @peti @the-kenny @wmertens @globin
Also, @bgamari, as the author of
perlSupport
, you might be interested in this.