* [PATCH 0/2] fortify: test_fortify.sh: Improve handling of tempfile
@ 2025-11-28 19:27 Nicolas Schier
2025-11-28 19:27 ` [PATCH 1/2] fortify: Rename temporary file to match ignore pattern Nicolas Schier
2025-11-28 19:27 ` [PATCH 2/2] fortify: Cleanup temp file also on non-successful exit Nicolas Schier
0 siblings, 2 replies; 7+ messages in thread
From: Nicolas Schier @ 2025-11-28 19:27 UTC (permalink / raw)
To: Kees Cook
Cc: WangYuli, WangYuli, Nathan Chancellor, linux-hardening,
linux-kernel, linux-kbuild, Nicolas Schier, Nicolas Schier,
Nicolas Schier
WangYuli reported [1] that the temporary file created by test_fortify.sh
is recognised by git as untracked file, especially if it remains after
non-common exits of test_fortify.sh (e.g. killed by signal).
The following two patches handle that by renaming the temporary file and
by cleaning up the file in more situations.
Link: https://lore.kernel.org/linux-kbuild/20251112114725.287349-1-wangyuli@aosc.io/ # [1]
Signed-off-by: Nicolas Schier <nsc@kernel.org>
---
Nicolas Schier (2):
fortify: Rename temporary file to match ignore pattern
fortify: Cleanup temp file also on non-successful exit
lib/test_fortify/test_fortify.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
change-id: 20251128-fortify-improve-handling-of-tempfile-2d2ac64ba4aa
Best regards,
--
Nicolas
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/2] fortify: Rename temporary file to match ignore pattern
2025-11-28 19:27 [PATCH 0/2] fortify: test_fortify.sh: Improve handling of tempfile Nicolas Schier
@ 2025-11-28 19:27 ` Nicolas Schier
2025-12-01 1:55 ` WangYuli
2025-12-01 23:41 ` Nathan Chancellor
2025-11-28 19:27 ` [PATCH 2/2] fortify: Cleanup temp file also on non-successful exit Nicolas Schier
1 sibling, 2 replies; 7+ messages in thread
From: Nicolas Schier @ 2025-11-28 19:27 UTC (permalink / raw)
To: Kees Cook
Cc: WangYuli, WangYuli, Nathan Chancellor, linux-hardening,
linux-kernel, linux-kbuild, Nicolas Schier, Nicolas Schier,
Nicolas Schier
From: Nicolas Schier <nicolas.schier@linux.dev>
test_fortify.sh uses a temporary file that might appear as untracked
file in some rare sitations. Rename it to match one of top-level's
gitignore patterns.
Reported-by: WangYuli <wangyuli@aosc.io>
Closes: https://lore.kernel.org/linux-kbuild/20251112114725.287349-1-wangyuli@aosc.io/
Signed-off-by: Nicolas Schier <n.schier@avm.de>
---
lib/test_fortify/test_fortify.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/test_fortify/test_fortify.sh b/lib/test_fortify/test_fortify.sh
index c2688ab8281d..368d07d9acbf 100644
--- a/lib/test_fortify/test_fortify.sh
+++ b/lib/test_fortify/test_fortify.sh
@@ -17,7 +17,7 @@ WANT="__${FILE%%-*}"
# Argument 2: Where to write the build log.
OUT="$1"
shift
-TMP="${OUT}.tmp"
+TMP="${OUT%/*}/.${OUT##*/}.tmp"
# Argument 3: Path to "nm" tool.
NM="$1"
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 1/2] fortify: Rename temporary file to match ignore pattern
2025-11-28 19:27 ` [PATCH 1/2] fortify: Rename temporary file to match ignore pattern Nicolas Schier
@ 2025-12-01 1:55 ` WangYuli
2025-12-01 23:41 ` Nathan Chancellor
1 sibling, 0 replies; 7+ messages in thread
From: WangYuli @ 2025-12-01 1:55 UTC (permalink / raw)
To: Nicolas Schier, Kees Cook
Cc: WangYuli, Nathan Chancellor, linux-hardening, linux-kernel,
linux-kbuild, Nicolas Schier
On 2025/11/29 03:27, Nicolas Schier wrote:
> From: Nicolas Schier <nicolas.schier@linux.dev>
>
> test_fortify.sh uses a temporary file that might appear as untracked
> file in some rare sitations. Rename it to match one of top-level's
> gitignore patterns.
>
> Reported-by: WangYuli <wangyuli@aosc.io>
> Closes: https://lore.kernel.org/linux-kbuild/20251112114725.287349-1-wangyuli@aosc.io/
> Signed-off-by: Nicolas Schier <n.schier@avm.de>
> ---
> lib/test_fortify/test_fortify.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/test_fortify/test_fortify.sh b/lib/test_fortify/test_fortify.sh
> index c2688ab8281d..368d07d9acbf 100644
> --- a/lib/test_fortify/test_fortify.sh
> +++ b/lib/test_fortify/test_fortify.sh
> @@ -17,7 +17,7 @@ WANT="__${FILE%%-*}"
> # Argument 2: Where to write the build log.
> OUT="$1"
> shift
> -TMP="${OUT}.tmp"
> +TMP="${OUT%/*}/.${OUT##*/}.tmp"
>
> # Argument 3: Path to "nm" tool.
> NM="$1"
>
Reviewed-by: WangYuli <wangyuli@aosc.io>
Thans,
--
WangYuli
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 1/2] fortify: Rename temporary file to match ignore pattern
2025-11-28 19:27 ` [PATCH 1/2] fortify: Rename temporary file to match ignore pattern Nicolas Schier
2025-12-01 1:55 ` WangYuli
@ 2025-12-01 23:41 ` Nathan Chancellor
1 sibling, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2025-12-01 23:41 UTC (permalink / raw)
To: Nicolas Schier
Cc: Kees Cook, WangYuli, WangYuli, linux-hardening, linux-kernel,
linux-kbuild, Nicolas Schier
On Fri, Nov 28, 2025 at 08:27:57PM +0100, Nicolas Schier wrote:
> From: Nicolas Schier <nicolas.schier@linux.dev>
>
> test_fortify.sh uses a temporary file that might appear as untracked
> file in some rare sitations. Rename it to match one of top-level's
> gitignore patterns.
>
> Reported-by: WangYuli <wangyuli@aosc.io>
> Closes: https://lore.kernel.org/linux-kbuild/20251112114725.287349-1-wangyuli@aosc.io/
> Signed-off-by: Nicolas Schier <n.schier@avm.de>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Not a big problem but some tools might complain about the email mismatch
between the From: line (which will end up being the author) and the
Signed-off-by line.
> ---
> lib/test_fortify/test_fortify.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/test_fortify/test_fortify.sh b/lib/test_fortify/test_fortify.sh
> index c2688ab8281d..368d07d9acbf 100644
> --- a/lib/test_fortify/test_fortify.sh
> +++ b/lib/test_fortify/test_fortify.sh
> @@ -17,7 +17,7 @@ WANT="__${FILE%%-*}"
> # Argument 2: Where to write the build log.
> OUT="$1"
> shift
> -TMP="${OUT}.tmp"
> +TMP="${OUT%/*}/.${OUT##*/}.tmp"
>
> # Argument 3: Path to "nm" tool.
> NM="$1"
>
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] fortify: Cleanup temp file also on non-successful exit
2025-11-28 19:27 [PATCH 0/2] fortify: test_fortify.sh: Improve handling of tempfile Nicolas Schier
2025-11-28 19:27 ` [PATCH 1/2] fortify: Rename temporary file to match ignore pattern Nicolas Schier
@ 2025-11-28 19:27 ` Nicolas Schier
2025-12-01 1:56 ` WangYuli
2025-12-01 23:43 ` Nathan Chancellor
1 sibling, 2 replies; 7+ messages in thread
From: Nicolas Schier @ 2025-11-28 19:27 UTC (permalink / raw)
To: Kees Cook
Cc: WangYuli, WangYuli, Nathan Chancellor, linux-hardening,
linux-kernel, linux-kbuild, Nicolas Schier, Nicolas Schier,
Nicolas Schier
From: Nicolas Schier <nicolas.schier@linux.dev>
Ensure cleanup of test_fortify.sh's temporary file also on script
interruption, or some common signals.
Reported-by: WangYuli <wangyuli@aosc.io>
Closes: https://lore.kernel.org/linux-kbuild/20251112114725.287349-1-wangyuli@aosc.io/
Signed-off-by: Nicolas Schier <n.schier@avm.de>
---
lib/test_fortify/test_fortify.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/test_fortify/test_fortify.sh b/lib/test_fortify/test_fortify.sh
index 368d07d9acbf..ad6dd44fa31c 100644
--- a/lib/test_fortify/test_fortify.sh
+++ b/lib/test_fortify/test_fortify.sh
@@ -29,7 +29,7 @@ shift
__cleanup() {
rm -f "$TMP"
}
-trap __cleanup EXIT
+trap __cleanup EXIT HUP INT QUIT TERM
# Function names in warnings are wrapped in backticks under UTF-8 locales.
# Run the commands with LANG=C so that grep output will not change.
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 2/2] fortify: Cleanup temp file also on non-successful exit
2025-11-28 19:27 ` [PATCH 2/2] fortify: Cleanup temp file also on non-successful exit Nicolas Schier
@ 2025-12-01 1:56 ` WangYuli
2025-12-01 23:43 ` Nathan Chancellor
1 sibling, 0 replies; 7+ messages in thread
From: WangYuli @ 2025-12-01 1:56 UTC (permalink / raw)
To: Nicolas Schier, Kees Cook
Cc: WangYuli, Nathan Chancellor, linux-hardening, linux-kernel,
linux-kbuild, Nicolas Schier
On 2025/11/29 03:27, Nicolas Schier wrote:
> From: Nicolas Schier <nicolas.schier@linux.dev>
>
> Ensure cleanup of test_fortify.sh's temporary file also on script
> interruption, or some common signals.
>
> Reported-by: WangYuli <wangyuli@aosc.io>
> Closes: https://lore.kernel.org/linux-kbuild/20251112114725.287349-1-wangyuli@aosc.io/
> Signed-off-by: Nicolas Schier <n.schier@avm.de>
> ---
> lib/test_fortify/test_fortify.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/test_fortify/test_fortify.sh b/lib/test_fortify/test_fortify.sh
> index 368d07d9acbf..ad6dd44fa31c 100644
> --- a/lib/test_fortify/test_fortify.sh
> +++ b/lib/test_fortify/test_fortify.sh
> @@ -29,7 +29,7 @@ shift
> __cleanup() {
> rm -f "$TMP"
> }
> -trap __cleanup EXIT
> +trap __cleanup EXIT HUP INT QUIT TERM
>
> # Function names in warnings are wrapped in backticks under UTF-8 locales.
> # Run the commands with LANG=C so that grep output will not change.
>
Reviewed-by: WangYuli <wangyuli@aosc.io>
Thans,
--
WangYuli
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 2/2] fortify: Cleanup temp file also on non-successful exit
2025-11-28 19:27 ` [PATCH 2/2] fortify: Cleanup temp file also on non-successful exit Nicolas Schier
2025-12-01 1:56 ` WangYuli
@ 2025-12-01 23:43 ` Nathan Chancellor
1 sibling, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2025-12-01 23:43 UTC (permalink / raw)
To: Nicolas Schier
Cc: Kees Cook, WangYuli, WangYuli, linux-hardening, linux-kernel,
linux-kbuild, Nicolas Schier
On Fri, Nov 28, 2025 at 08:27:58PM +0100, Nicolas Schier wrote:
> From: Nicolas Schier <nicolas.schier@linux.dev>
>
> Ensure cleanup of test_fortify.sh's temporary file also on script
> interruption, or some common signals.
>
> Reported-by: WangYuli <wangyuli@aosc.io>
> Closes: https://lore.kernel.org/linux-kbuild/20251112114725.287349-1-wangyuli@aosc.io/
> Signed-off-by: Nicolas Schier <n.schier@avm.de>
I guess with patch 1, this does not become as big of a deal. Kees, is
there any reason to leave these temporary files around if there was an
interruption or other signal? I do not see any obvious ones so:
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
> lib/test_fortify/test_fortify.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/test_fortify/test_fortify.sh b/lib/test_fortify/test_fortify.sh
> index 368d07d9acbf..ad6dd44fa31c 100644
> --- a/lib/test_fortify/test_fortify.sh
> +++ b/lib/test_fortify/test_fortify.sh
> @@ -29,7 +29,7 @@ shift
> __cleanup() {
> rm -f "$TMP"
> }
> -trap __cleanup EXIT
> +trap __cleanup EXIT HUP INT QUIT TERM
>
> # Function names in warnings are wrapped in backticks under UTF-8 locales.
> # Run the commands with LANG=C so that grep output will not change.
>
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-12-01 23:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-28 19:27 [PATCH 0/2] fortify: test_fortify.sh: Improve handling of tempfile Nicolas Schier
2025-11-28 19:27 ` [PATCH 1/2] fortify: Rename temporary file to match ignore pattern Nicolas Schier
2025-12-01 1:55 ` WangYuli
2025-12-01 23:41 ` Nathan Chancellor
2025-11-28 19:27 ` [PATCH 2/2] fortify: Cleanup temp file also on non-successful exit Nicolas Schier
2025-12-01 1:56 ` WangYuli
2025-12-01 23:43 ` Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).