From 42354876de823f52a431eac900d360c074c6198d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 15 Jul 2021 14:56:58 -0300 Subject: aux/lib.sh: Add mkstemp and mkdtemp, and copy uuid over The tests were relying on the unspecified and non-standartized behaviour of "mktemp". Now they use "mkstemp()", a shim sh function to provide the expected behaviour, and an accompanying "mkdtemp()" function is also defined. To further decouple from specific implementations and OS-behaviours and quirks, a aux/lib.sh file containing both those functions was added. Its purpose is to also allow code under aux/ to not depend on specific behaviour. "mkdtemp()" had to be replicated in aux/ci/ci-build.sh, since it runs outside the repository. --- aux/workflow/assert-spelling.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'aux/workflow/assert-spelling.sh') diff --git a/aux/workflow/assert-spelling.sh b/aux/workflow/assert-spelling.sh index cdc6d28..f1eef6f 100755 --- a/aux/workflow/assert-spelling.sh +++ b/aux/workflow/assert-spelling.sh @@ -1,11 +1,13 @@ #!/bin/sh set -eu +. aux/lib.sh + sort_dicts() { for f in po/spelling/*.txt; do if ! LANG=POSIX sort "$f" | diff - "$f"; then if [ "$IN_PLACE" = true ]; then - OUT="$(mktemp)" + OUT="$(mkstemp)" LANG=POSIX sort "$f" | uniq > "$OUT" mv "$OUT" "$f" else @@ -57,10 +59,10 @@ get_lang() { ' } -ACC="$(mktemp)" +ACC="$(mkstemp)" for f in "$@"; do l="$(get_lang "$f")" - CURR_DICT="$(mktemp)" + CURR_DICT="$(mkstemp)" cat po/spelling/international.txt "po/spelling/$l.txt" | sort | uniq > "$CURR_DICT" hunspell -u3 -H -d "$l" -p "$CURR_DICT" "$f" | tee -a "$ACC" >&2 done -- cgit v1.2.3