From aa1af6c2bd333d06fad5c664760761bb468ec69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reynir=20Bj=C3=B6rnsson?= Date: Thu, 25 Aug 2022 15:48:21 +0200 Subject: [PATCH] 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. --- packaging/visualizations.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/visualizations.sh b/packaging/visualizations.sh index e9253d9..1236463 100755 --- a/packaging/visualizations.sh +++ b/packaging/visualizations.sh @@ -155,7 +155,8 @@ if [ -e "${DEPENDENCIES_VIZ_FILENAME}" ]; then info "Dependency visualization already exists: '${DEPENDENCIES_VIZ_FILENAME}'" else if ${OPAM_GRAPH} --output-format=html "${OPAM_SWITCH}" > "${TMPDEPENDENCIES}"; then - mv "${TMPDEPENDENCIES}" "${DEPENDENCIES_VIZ_FILENAME}" + cp "${TMPDEPENDENCIES}" "${DEPENDENCIES_VIZ_FILENAME}" + rm "$TMPDEPENDENCIES" else die "opam-graph failed to generate visualization" fi @@ -201,7 +202,8 @@ if [ -n "${DEBUG_BIN_RELATIVE}" ]; then "${DEBUG_BIN}" \ > "${TMPTREE}" then - mv "${TMPTREE}" "${TREEMAP_VIZ_FILENAME}" + cp "${TMPTREE}" "${TREEMAP_VIZ_FILENAME}" + rm "$TMPTREE" else die "modulectomy failed to generate visualization" fi