summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-04-17 23:43:22 +0100
committerLeah Rowe <leah@libreboot.org>2025-04-17 23:43:22 +0100
commite07a2adb130e86cf78fc1ee77a4d8b233a65cedf (patch)
tree322fef83ab84abebe14c05b3b4f9be9b7912f0c9 /mk
parent9d3b52cd1d2c91912476ac4622ef33726e349e54 (diff)
lbmk: don't handle TMPDIR directly
lbmk creates TMPDIR as /tmp/xbmk_*, but it's theoretically possible that something could re-export it by mistake. this change retains the same initialisation, but further use is now via a new variable "xbmktmp", that stores the value of TMPDIR upon lbmk's initialisation of it. this reduces the chance of such a bug in the future, as described above, so it is a preemptive/preventative fix. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'mk')
-rwxr-xr-xmk20
1 files changed, 10 insertions, 10 deletions
diff --git a/mk b/mk
index 8460773e..9f4da41b 100755
--- a/mk
+++ b/mk
@@ -175,7 +175,7 @@ trees()
mkhelpercfg="$datadir/mkhelper.cfg"
if e "$mkhelpercfg" f missing; then
- mkhelpercfg="$TMPDIR/mkhelper.cfg"
+ mkhelpercfg="$xbmktmp/mkhelper.cfg"
x_ touch "$mkhelpercfg"
fi
@@ -297,25 +297,25 @@ check_project_hashes()
[ ! -f "$XBMK_CACHE/hash/$project$tree" ] || \
read -r old_pjhash < "$XBMK_CACHE/hash/$project$tree"
- x_ rm -f "$TMPDIR/project.list" "$TMPDIR/project.hash" \
- "$TMPDIR/project.tmp"
- x_ touch "$TMPDIR/project.tmp"
- x_ touch "$TMPDIR/project.hash"
+ x_ rm -f "$xbmktmp/project.list" "$xbmktmp/project.hash" \
+ "$xbmktmp/project.tmp"
+ x_ touch "$xbmktmp/project.tmp"
+ x_ touch "$xbmktmp/project.hash"
for rmchk in "$datadir" "$configdir/$tree" "$mdir"; do
[ -d "$rmchk" ] || continue
find "$rmchk" -type f -not -path "*/.git*/*" >> \
- "$TMPDIR/project.tmp" || $err "!find $rmchk > project.tmp"
+ "$xbmktmp/project.tmp" || $err "!find $rmchk > project.tmp"
done
- sort "$TMPDIR/project.tmp" > "$TMPDIR/project.list" || \
+ sort "$xbmktmp/project.tmp" > "$xbmktmp/project.list" || \
$err "!sort project tmp/list"
while read -r rmchk; do
[ ! -f "$rmchk" ] || x_ sha512sum "$rmchk" | awk \
- '{print $1}' >> "$TMPDIR/project.hash" || $err "!h $rmchk"
- done < "$TMPDIR/project.list"
+ '{print $1}' >> "$xbmktmp/project.hash" || $err "!h $rmchk"
+ done < "$xbmktmp/project.list"
- pjhash="$(sha512sum "$TMPDIR/project.hash" | awk '{print $1}')" || :
+ pjhash="$(sha512sum "$xbmktmp/project.hash" | awk '{print $1}')" || :
[ "$pjhash" != "$old_pjhash" ] && badhash="y"
[ -f "$XBMK_CACHE/hash/$project$tree" ] || badhash="y"