From f4b96a21c8386ed76193292d928c68221d82838c Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Fri, 25 Jun 2021 11:00:06 +0200 Subject: go-bootstrap: Increase environment variable size (#24508) When having a few packages loaded, installing go-bootstrap will fail because the `PATH` variable is truncated at 4096 bytes. Increase the limit to 128 KiB to make longer paths fit. --- .../repos/builtin/packages/go-bootstrap/package.py | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/go-bootstrap/package.py b/var/spack/repos/builtin/packages/go-bootstrap/package.py index 672a50b04d..95dbdf4094 100644 --- a/var/spack/repos/builtin/packages/go-bootstrap/package.py +++ b/var/spack/repos/builtin/packages/go-bootstrap/package.py @@ -35,17 +35,24 @@ class GoBootstrap(Package): depends_on('git', type=('build', 'link', 'run')) - # NOTE: Older versions of Go attempt to download external files that have - # since been moved while running the test suite. This patch modifies the - # test files so that these tests don't cause false failures. - # See: https://github.com/golang/go/issues/15694 - @when('@:1.4.3') def patch(self): - test_suite_file = FileFilter(join_path('src', 'run.bash')) - test_suite_file.filter( - r'^(.*)(\$GOROOT/src/cmd/api/run.go)(.*)$', - r'# \1\2\3', - ) + if self.spec.satisfies('@:1.4.3'): + # NOTE: Older versions of Go attempt to download external files that have + # since been moved while running the test suite. This patch modifies the + # test files so that these tests don't cause false failures. + # See: https://github.com/golang/go/issues/15694 + test_suite_file = FileFilter(join_path('src', 'run.bash')) + test_suite_file.filter( + r'^(.*)(\$GOROOT/src/cmd/api/run.go)(.*)$', + r'# \1\2\3', + ) + + # Go uses a hardcoded limit of 4096 bytes for its printf functions. + # This can cause environment variables to be truncated. + filter_file('char buf[4096];', + 'char buf[131072];', + 'src/cmd/dist/unix.c', + string=True) def install(self, spec, prefix): env['CGO_ENABLED'] = '0' -- cgit v1.2.3-60-g2f50