about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-12-09 12:08:45 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-12-09 12:08:45 +0100
commit993c3283a9e6a00fcb6b747d54f281caf6f4b681 (patch)
tree01133013bdfc8bb582db736289ab79c322730179
parentpkgs/notify-run: Append the name of the spawned command before printing (diff)
downloadnixos-config-993c3283a9e6a00fcb6b747d54f281caf6f4b681.zip
treewide: Give tempfiles descriptive names
This makes it easier to see, where each tempfile comes from.
Diffstat (limited to '')
-rw-r--r--modules/by-name/bo/boot/module.nix2
-rwxr-xr-xmodules/by-name/lf/lf/commands/base.sh4
-rw-r--r--modules/by-name/lf/lf/module.nix2
-rwxr-xr-xmodules/by-name/lf/lf/wrappers/ll/ll.sh2
-rwxr-xr-xmodules/by-name/ni/nixos-shell/nixos-shell.sh2
-rwxr-xr-xpkgs/by-name/fu/fupdate-sys/fupdate-sys.sh2
-rwxr-xr-xpkgs/by-name/gi/git-edit-index/git-edit-index.sh2
-rwxr-xr-xpkgs/by-name/lf/lf-make-map/tests/cases/child_insert/test.sh2
-rwxr-xr-xpkgs/by-name/lf/lf-make-map/tests/cases/simple/test.sh2
-rwxr-xr-xpkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh2
-rwxr-xr-xpkgs/update_pkgs.sh2
11 files changed, 12 insertions, 12 deletions
diff --git a/modules/by-name/bo/boot/module.nix b/modules/by-name/bo/boot/module.nix
index dfcd14b7..4b95aedf 100644
--- a/modules/by-name/bo/boot/module.nix
+++ b/modules/by-name/bo/boot/module.nix
@@ -46,7 +46,7 @@ in {
     # #    stay on disk forever) <2024-05-11>
     # copyExtraFiles = ''
     #   echo "[systemd-boot] copying files to ${bootMountPoint}"
-    #   empty_file=$(mktemp)
+    #   empty_file=$(mktemp boot_empty_file_XXX)
     #
     #   ${lib.concatStrings (lib.mapAttrsToList (n: v:
     #     /*
diff --git a/modules/by-name/lf/lf/commands/base.sh b/modules/by-name/lf/lf/commands/base.sh
index 99852c3e..7c6851c0 100755
--- a/modules/by-name/lf/lf/commands/base.sh
+++ b/modules/by-name/lf/lf/commands/base.sh
@@ -41,11 +41,11 @@ prompt() {
 #   set -- "$@" "$file"
 # done < "$(echo "$fx" | tmp)"
 tmp() {
-    __base_tmp_temporary_file="$(mktemp --tmpdir="$__base_tmp_temporary_directory")"
+    __base_tmp_temporary_file="$(mktemp --tmpdir="$__base_tmp_temporary_directory" lf_commands_tmp_fun_XXXXXXXX )"
     cat >"$__base_tmp_temporary_file"
     echo "$__base_tmp_temporary_file"
 }
-__base_tmp_temporary_directory="$(mktemp --directory)"
+__base_tmp_temporary_directory="$(mktemp --directory lf_commands_tmp_fun_XXXXXXXXXXXX)"
 trap 'rm --recursive "$__base_tmp_temporary_directory"' EXIT
 
 # Run a lf command on the current lf client
diff --git a/modules/by-name/lf/lf/module.nix b/modules/by-name/lf/lf/module.nix
index e66c3a8a..28b627bd 100644
--- a/modules/by-name/lf/lf/module.nix
+++ b/modules/by-name/lf/lf/module.nix
@@ -100,7 +100,7 @@ in {
           # and keep running through `autoquit = false`.
           # (Otherwise, the remote command is silently dropped: https://github.com/gokcehan/lf/issues/495)
           &{{
-            tmp="$(mktemp)"
+            tmp="$(mktemp lf_make_map_dynamic_mapping_source_XXXXX)"
             ${lib.getExe pkgs.lf-make-map} --depth 4 generate ~/media ~/repos ~/documents >"$tmp"
 
             lf -remote "send $id source $tmp"
diff --git a/modules/by-name/lf/lf/wrappers/ll/ll.sh b/modules/by-name/lf/lf/wrappers/ll/ll.sh
index e012cffa..462e03db 100755
--- a/modules/by-name/lf/lf/wrappers/ll/ll.sh
+++ b/modules/by-name/lf/lf/wrappers/ll/ll.sh
@@ -10,7 +10,7 @@
 # You should have received a copy of the License along with this program.
 # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
 
-last_directory="$(mktemp)"
+last_directory="$(mktemp ll_last_directory_XXXXXXX)"
 cleanup() {
     rm "$last_directory"
 }
diff --git a/modules/by-name/ni/nixos-shell/nixos-shell.sh b/modules/by-name/ni/nixos-shell/nixos-shell.sh
index 390e60b1..99476e9d 100755
--- a/modules/by-name/ni/nixos-shell/nixos-shell.sh
+++ b/modules/by-name/ni/nixos-shell/nixos-shell.sh
@@ -10,7 +10,7 @@
 # You should have received a copy of the License along with this program.
 # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
 
-SHARED_DIR="$(mktemp --directory)"
+SHARED_DIR="$(mktemp --directory "nixos_shell_XXXXXXXXX")"
 cleanup() {
     rm --recursive "$SHARED_DIR"
 }
diff --git a/pkgs/by-name/fu/fupdate-sys/fupdate-sys.sh b/pkgs/by-name/fu/fupdate-sys/fupdate-sys.sh
index 4ec3e9e8..991830b3 100755
--- a/pkgs/by-name/fu/fupdate-sys/fupdate-sys.sh
+++ b/pkgs/by-name/fu/fupdate-sys/fupdate-sys.sh
@@ -151,7 +151,7 @@ msg2 "Updating git repository..."
 git pull --rebase
 
 # We use a tempfile, to make this truly async.
-default_branch=$(mktemp)
+default_branch=$(mktemp fupdate_flake_XXXX)
 cleanup() {
     rm "$default_branch"
 }
diff --git a/pkgs/by-name/gi/git-edit-index/git-edit-index.sh b/pkgs/by-name/gi/git-edit-index/git-edit-index.sh
index 46fbc9c5..a78db1e0 100755
--- a/pkgs/by-name/gi/git-edit-index/git-edit-index.sh
+++ b/pkgs/by-name/gi/git-edit-index/git-edit-index.sh
@@ -56,7 +56,7 @@ materialize_file() {
 }
 
 edit() {
-    files_to_add="$(mktemp)"
+    files_to_add="$(mktemp git_edit_index_XXXXX)"
     cleanup() {
         rm "$files_to_add"
     }
diff --git a/pkgs/by-name/lf/lf-make-map/tests/cases/child_insert/test.sh b/pkgs/by-name/lf/lf-make-map/tests/cases/child_insert/test.sh
index 90ebe1ce..efe8fe79 100755
--- a/pkgs/by-name/lf/lf-make-map/tests/cases/child_insert/test.sh
+++ b/pkgs/by-name/lf/lf-make-map/tests/cases/child_insert/test.sh
@@ -10,7 +10,7 @@
 # You should have received a copy of the License along with this program.
 # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
 
-test="$(mktemp --directory)"
+test="$(mktemp --directory lf_make_map_test_XXXX)"
 
 cleanup() {
     rm --recursive "$test"
diff --git a/pkgs/by-name/lf/lf-make-map/tests/cases/simple/test.sh b/pkgs/by-name/lf/lf-make-map/tests/cases/simple/test.sh
index 6e127d28..656fd2a1 100755
--- a/pkgs/by-name/lf/lf-make-map/tests/cases/simple/test.sh
+++ b/pkgs/by-name/lf/lf-make-map/tests/cases/simple/test.sh
@@ -12,7 +12,7 @@
 
 # We need to hard code this, so that our output matches the golden sample.
 base="/tmp/tmp.DfcgjemfCG"
-test="$(mktemp --directory)"
+test="$(mktemp --directory lf_make_temp_test_XXXXX)"
 
 [ -d "$base" ] && {
     echo "$base already exists!"
diff --git a/pkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh b/pkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh
index 0eeb75c0..dfaed457 100755
--- a/pkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh
+++ b/pkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh
@@ -10,7 +10,7 @@
 
 # shellcheck shell=bash
 
-tmp="$(mktemp)"
+tmp="$(mktemp screenshot_persistent_XXXXX)"
 
 if grim -g "$(slurp)" "$tmp"; then
     name="$(rofi -dmenu -p "Name of screenshot: " -l 0)"
diff --git a/pkgs/update_pkgs.sh b/pkgs/update_pkgs.sh
index d046ee76..32fc6758 100755
--- a/pkgs/update_pkgs.sh
+++ b/pkgs/update_pkgs.sh
@@ -19,7 +19,7 @@ cd "$(dirname "$0")" || die "Bug: run with the wrong first arg: '$0'!"
 cd ./by-name || die "(BUG): The directory './by-name' does not exist?"
 
 # First check if all the update scripts conform to the standard
-files_with_update="$(mktemp)"
+files_with_update="$(mktemp update_pkgs_XXXXX)"
 trap 'rm "$files_with_update"' EXIT
 
 fd '^update.sh$' . --type file --extension sh --max-depth 3 | while read -r file; do