Skip to content

Commit

Permalink
cmdlib.sh: only chown compose.json if it exists
Browse files Browse the repository at this point in the history
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").
  • Loading branch information
jlebon committed Nov 22, 2024
1 parent 40a2027 commit db738cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,9 @@ runcompose_tree() {
# with a consistent value, regardless of the environment
(umask 0022 && sudo -E "$@")
sudo chown -R -h "${USER}":"${USER}" "${tmprepo}"
sudo chown "${USER}":"${USER}" "${composejson}"
if [ -f "${composejson}" ]; then
sudo chown "${USER}":"${USER}" "${composejson}"
fi
else
runvm_with_cache -- "$@" --repo "${repo}" --write-composejson-to "${composejson}"
fi
Expand Down

0 comments on commit db738cd

Please sign in to comment.