Fix install script to change directory before cleanup - #1728
Open
Sven Giermann (Giermann) wants to merge 1 commit into
Open
Fix install script to change directory before cleanup#1728Sven Giermann (Giermann) wants to merge 1 commit into
Sven Giermann (Giermann) wants to merge 1 commit into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two related fixes in the Go feature's "install tools" block.
After installing the Go tools, the script never leaves
${GOPATH}(a temp dir, default /tmp/gotools) before removing it with
rm -rf "${GOPATH}". The shell's cwd is left pointing at a deleteddirectory for the rest of the script. The two
findcalls thatfollow then fail while resolving their own initial working
directory:
This is silent on filesystems/kernels where a process may keep
using a cwd after it's been unlinked, but fails hard on at least
some overlay2 configurations (reproduced on a Synology DSM host,
kernel 4.4). Explicitly cd-ing to a directory that's guaranteed to
still exist before the rm -rf makes this deterministic regardless
of filesystem/kernel.
Because of (1), the piped
xargs -n 1 -0 chmod g+sreceived emptyinput and (GNU xargs' documented default without -r) still ran
chmod g+sonce with no arguments:Independently of fix (1),
-r/--no-run-if-emptybelongs on theseinvocations regardless: chmod should never be invoked at all when
find legitimately produces no output.