Skip to content

Commit db738cd

Browse files
committed
cmdlib.sh: only chown compose.json if it exists
It only gets actually written in `cosa build`, so we need to handle the `cosa fetch` case where this path is also taken. Fixes 40a2027 ("cmdlib: also chown back `compose.json` in privileged path").
1 parent 40a2027 commit db738cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/cmdlib.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,9 @@ runcompose_tree() {
566566
# with a consistent value, regardless of the environment
567567
(umask 0022 && sudo -E "$@")
568568
sudo chown -R -h "${USER}":"${USER}" "${tmprepo}"
569-
sudo chown "${USER}":"${USER}" "${composejson}"
569+
if [ -f "${composejson}" ]; then
570+
sudo chown "${USER}":"${USER}" "${composejson}"
571+
fi
570572
else
571573
runvm_with_cache -- "$@" --repo "${repo}" --write-composejson-to "${composejson}"
572574
fi

0 commit comments

Comments
 (0)