Linux Hardening
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: WangYuli <wangyuli@aosc.io>
Cc: kees@kernel.org, nicolas@fjasle.eu,
	linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org,
	WangYuli <wangyl5933@chinaunicom.cn>
Subject: Re: [PATCH] fortify: Ignore intermediate *.tmp files
Date: Wed, 12 Nov 2025 15:36:06 -0700	[thread overview]
Message-ID: <20251112223606.GA3268585@ax162> (raw)
In-Reply-To: <20251112114725.287349-1-wangyuli@aosc.io>

On Wed, Nov 12, 2025 at 07:47:25PM +0800, WangYuli wrote:
> From: WangYuli <wangyl5933@chinaunicom.cn>
> 
> The test_fortify.sh script generates logs of build-time warnings
> for string and memory functions. To ensure the final log file is
> updated atomically, the script first writes its output to a temporary
> file with a .log.tmp extension. Upon successful completion, this
> temporary file is renamed to the final .log file.
> 
> If the build process is interrupted before this rename operation,
> these *.log.tmp intermediate files will be left in the directory,
> creating a risk of them being accidentally added to the git repository.

Shouldn't the cleanup trap in lib/test_fortify/test_fortify.sh be enough
to avoid leaving behind .log.tmp? Or does that only work for clean
exits? Would adding INT to the trap avoid the problem?

> To prevent this from happening, add *.tmp to the .gitignore file to
> explicitly ignore these temporary files.
> 
> Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
> Signed-off-by: WangYuli <wangyuli@aosc.io>

Regardless, this seems fine in the meantime.

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  lib/test_fortify/.gitignore | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/test_fortify/.gitignore b/lib/test_fortify/.gitignore
> index c1ba37d14b50..8056bc75b442 100644
> --- a/lib/test_fortify/.gitignore
> +++ b/lib/test_fortify/.gitignore
> @@ -1,2 +1,3 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  /*.log
> +/*.tmp
> -- 
> 2.51.0
> 

  reply	other threads:[~2025-11-12 22:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12 11:47 [PATCH] fortify: Ignore intermediate *.tmp files WangYuli
2025-11-12 22:36 ` Nathan Chancellor [this message]
2025-11-28 19:21   ` Nicolas Schier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251112223606.GA3268585@ax162 \
    --to=nathan@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=wangyl5933@chinaunicom.cn \
    --cc=wangyuli@aosc.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox