Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/topic/bbannier/use-mktemp'
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannier committed Oct 4, 2023
2 parents 6339085 + 22fbdf9 commit 905c8fe
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
14 changes: 14 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
1.1-4 | 2023-10-04 11:30:31 +0200

* Simplify generation of temporary files (Benjamin Bannier, Corelight)

Instead of manuall relying in `$$` being unique, with this patch we
instead use `mktemp` which creates a unique, temporary file which we can
use later. This also removes the possibility that we accidentially
overwrite other existing files in the final location, e.g., from
previous, failed runs.

Via the default behavior of `mktemp` with this patch we also switch from
forced generation of temporary files in `/tmp` to possibly `$TMPDIR` if
set.

1.1-2 | 2023-08-09 15:20:16 +0200

* Bump pre-commit hooks. (Benjamin Bannier, Corelight)
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
..
.. Version number is filled in automatically.

.. |version| replace:: 1.1-2
.. |version| replace:: 1.1-4

==================================================
BTest - A Generic Driver for Powerful System Tests
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1-2
1.1-4
2 changes: 1 addition & 1 deletion btest
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ else:
import multiprocessing.managers as mp_managers
import multiprocessing.sharedctypes as mp_sharedctypes

VERSION = "1.1-2" # Automatically filled in.
VERSION = "1.1-4" # Automatically filled in.

Name = "btest"
Config = None
Expand Down
4 changes: 2 additions & 2 deletions btest-diff
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ if [ -z "$TEST_DIFF_CANONIFIER" ] || is_binary_mode; then
TEST_DIFF_CANONIFIER="cat"
fi

canon_output=/tmp/test-diff.$$.$canon.tmp
canon_output=$(mktemp -t "test-diff.$canon.tmp.XXXXXX")
tmpfiles="$tmpfiles $canon_output"
error=0

Expand All @@ -201,7 +201,7 @@ if [ $? -ne 0 ]; then
fi

if [ -n "$baseline" ]; then
canon_baseline=/tmp/test-diff.$$.$canon.baseline.tmp
canon_baseline=$(mktemp -t "test-diff.$canon.baseline.tmp.XXXXXX")
tmpfiles="$tmpfiles $canon_baseline"

# Prepare the baseline. When created by a recent btest-diff, we
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

setup(
name="btest",
version="1.1.dev2", # Filled in automatically.
version="1.1.dev4", # Filled in automatically.
description="A powerful system testing framework",
long_description="See https://github.com/zeek/btest",
author="The Zeek Team",
Expand Down

0 comments on commit 905c8fe

Please sign in to comment.