From 00ea6f7e5607a933767a8778d60b8d14e4d9f20d Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 3 Aug 2025 22:01:58 +0200 Subject: test.bash: use flock without subshell From man 1 flock: shell> exec 4<>/var/lock/mylockfile; shell> flock -n 4 This form is convenient for locking a file without spawning a subprocess. The shell opens the lock file for reading and writing as file descriptor 4, then flock is used to lock the descriptor. --- test.bash | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test.bash b/test.bash index bf3b78d..9e1d89a 100755 --- a/test.bash +++ b/test.bash @@ -37,9 +37,9 @@ unmount_leftovers() { return $RET } -( # Prevent multiple parallel test.bash instances as this causes # all kinds of mayhem +exec 200> "$LOCKFILE" if ! command -v flock > /dev/null ; then echo "flock is not available, skipping" elif ! flock -n 200 ; then @@ -131,5 +131,3 @@ if find . ! -path "./vendor/*" -type f -name \*.go -print0 | xargs -0 grep '\.Cr echo "$MYNAME: Please use Open(..., O_CREAT|O_WRONLY|O_EXCL, ...) instead of Creat()! https://github.com/rfjakob/gocryptfs/issues/623" exit 1 fi - -) 200> "$LOCKFILE" -- cgit v1.2.3