visualizations.sh: use cp;rm instead of mv in /tmp

mktemp creates a file with mode 0600 and group wheel (inherited from
/tmp/). The command mv is then not able to set group ownership to wheel
in /var/db/builder-web/ on FreeBSD and emits a warning. Furthermore, the
restrictive permissions are preserved. Copying and then removing the
temporary file avoids these issues.
This commit is contained in:
Reynir Björnsson 2022-08-25 15:48:21 +02:00
parent ac8c31f2ac
commit aa1af6c2bd

View file

@ -155,7 +155,8 @@ if [ -e "${DEPENDENCIES_VIZ_FILENAME}" ]; then
info "Dependency visualization already exists: '${DEPENDENCIES_VIZ_FILENAME}'" info "Dependency visualization already exists: '${DEPENDENCIES_VIZ_FILENAME}'"
else else
if ${OPAM_GRAPH} --output-format=html "${OPAM_SWITCH}" > "${TMPDEPENDENCIES}"; then if ${OPAM_GRAPH} --output-format=html "${OPAM_SWITCH}" > "${TMPDEPENDENCIES}"; then
mv "${TMPDEPENDENCIES}" "${DEPENDENCIES_VIZ_FILENAME}" cp "${TMPDEPENDENCIES}" "${DEPENDENCIES_VIZ_FILENAME}"
rm "$TMPDEPENDENCIES"
else else
die "opam-graph failed to generate visualization" die "opam-graph failed to generate visualization"
fi fi
@ -201,7 +202,8 @@ if [ -n "${DEBUG_BIN_RELATIVE}" ]; then
"${DEBUG_BIN}" \ "${DEBUG_BIN}" \
> "${TMPTREE}" > "${TMPTREE}"
then then
mv "${TMPTREE}" "${TREEMAP_VIZ_FILENAME}" cp "${TMPTREE}" "${TREEMAP_VIZ_FILENAME}"
rm "$TMPTREE"
else else
die "modulectomy failed to generate visualization" die "modulectomy failed to generate visualization"
fi fi