Repository navigation
Fix install script to change directory before cleanup - #1728
Sven Giermann (Giermann) wants to merge 2 commits into
Conversation
Kaniska (v-Kaniska244)
left a comment
There was a problem hiding this comment.
Thank you for the contribution. Would it be possible to merge this change with the #1729 PR change as both are realted to the same go feature. Please let me know in case of any concern with that.
It should fine to merge this change along with the other PR #1729 , provided the other PR #1729 description is also updated with this change. This is considering that the fix in #1728 is in fact a simple one. |
|
Abdurrahmaan Iqbal (@abdurriq) already merged #1729 without f400959 now - should I have changed anything before that? |
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.