From 7fe652d9291a9fb26f130644039db4d44a308a5d Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Wed, 23 Apr 2025 20:07:17 -0400 Subject: [PATCH 1/5] fix(regen-defs): Fix globs and clean tempfiles on INT, TERM --- regen-defs.zsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/regen-defs.zsh b/regen-defs.zsh index 07c1880..8203dc5 100755 --- a/regen-defs.zsh +++ b/regen-defs.zsh @@ -23,8 +23,14 @@ for folder in $folders; do stdout_file=$(mktemp) stderr_file=$(mktemp) + # Cleanup on interruption + cleanup() { + rm "$stdout_file" "$stderr_file" + } + trap cleanup INT TERM + # Execute the command and capture stdout and stderr - uv run "$cpplint" $cmd > "$stdout_file" 2> "$stderr_file" + eval uv run "$cpplint" $cmd > "$stdout_file" 2> "$stderr_file" ret_code=$? # Count the number of lines in stdout @@ -42,7 +48,7 @@ for folder in $folders; do } > "$file" # Clean up temporary files - rm "$stdout_file" "$stderr_file" + cleanup done cd .. done From 7abe1d28b63d07465ba6580a3e2f0e5e7867cc54 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Fri, 28 Nov 2025 15:37:24 -0500 Subject: [PATCH 2/5] use wildcard parameter expansion instead of eval I do not think "attackers controlling .def content" is a plausible scenario, but this does seem to be the better tool for the job. --- regen-defs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regen-defs.zsh b/regen-defs.zsh index 8203dc5..2be0ab3 100755 --- a/regen-defs.zsh +++ b/regen-defs.zsh @@ -30,7 +30,7 @@ for folder in $folders; do trap cleanup INT TERM # Execute the command and capture stdout and stderr - eval uv run "$cpplint" $cmd > "$stdout_file" 2> "$stderr_file" + uv run "$cpplint" ${(~)cmd} > "$stdout_file" 2> "$stderr_file" ret_code=$? # Count the number of lines in stdout From e12e484178ee97d1bcb99102e60a4561062adffa Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Fri, 28 Nov 2025 18:05:50 -0500 Subject: [PATCH 3/5] =?UTF-8?q?back=20to=20eval=E2=80=94switch=20to=20expa?= =?UTF-8?q?nsion=20caused=20all=20kinds=20of=20breakage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- regen-defs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regen-defs.zsh b/regen-defs.zsh index 2be0ab3..8203dc5 100755 --- a/regen-defs.zsh +++ b/regen-defs.zsh @@ -30,7 +30,7 @@ for folder in $folders; do trap cleanup INT TERM # Execute the command and capture stdout and stderr - uv run "$cpplint" ${(~)cmd} > "$stdout_file" 2> "$stderr_file" + eval uv run "$cpplint" $cmd > "$stdout_file" 2> "$stderr_file" ret_code=$? # Count the number of lines in stdout From 53a1696a4003f2f45eafa701941889e0b764583d Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Mon, 20 Jul 2026 19:37:05 -0400 Subject: [PATCH 4/5] fix: make trap exit --- regen-defs.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/regen-defs.zsh b/regen-defs.zsh index 8203dc5..94572bd 100755 --- a/regen-defs.zsh +++ b/regen-defs.zsh @@ -26,6 +26,7 @@ for folder in $folders; do # Cleanup on interruption cleanup() { rm "$stdout_file" "$stderr_file" + exit $((128 + $1)) } trap cleanup INT TERM From e89746cffe0e5b8ff23a3607602da7efe32ea965 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Mon, 20 Jul 2026 19:43:33 -0400 Subject: [PATCH 5/5] fix: change default cpplint directory to /Projects/cpplint see https://blog.tenstral.net/2026/04/hello-projects-directory.html . change mostly because this is what i now use --- regen-defs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regen-defs.zsh b/regen-defs.zsh index 94572bd..cae3f6d 100755 --- a/regen-defs.zsh +++ b/regen-defs.zsh @@ -1,7 +1,7 @@ #!/bin/zsh # Input the path of cpplint here -cpplint="$HOME/Documents/cpplint/cpplint.py" +cpplint="$HOME/Projects/cpplint/cpplint.py" cd samples/ || exit 74 # EX_IOERROR