* [PATCH] verification/rvgen: Use .old instead of .bak for kunit backup files
@ 2026-08-24 8:15 Gabriele Monaco
2026-08-24 8:28 ` sashiko-bot
2026-08-24 15:33 ` Kuan-Wei Chiu
0 siblings, 2 replies; 3+ messages in thread
From: Gabriele Monaco @ 2026-08-24 8:15 UTC (permalink / raw)
To: linux-kernel, Steven Rostedt, Gabriele Monaco, Nam Cao,
linux-trace-kernel
Cc: Kuan-Wei Chiu
The rvgen kunit command generates .bak backup files and these can be
checked in for selftests (make check). Clean targets like make disclean
remove such files, leaving the tree dirty.
Switch to .old to preserve a clean tree after make disclean.
Reported-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Closes: https://lore.kernel.org/lkml/aosuwKH5GOEo0xTN@google.com
Fixes: 7b6246294eb0 ("verification/rvgen: Add selftests for rvgen kunit")
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
---
tools/verification/rvgen/rvgen/kunit.py | 2 +-
.../{test_bak_kunit_kunit.c.bak => test_bak_kunit_kunit.c.old} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename tools/verification/rvgen/tests/golden/test_bak_kunit/{test_bak_kunit_kunit.c.bak => test_bak_kunit_kunit.c.old} (100%)
diff --git a/tools/verification/rvgen/rvgen/kunit.py b/tools/verification/rvgen/rvgen/kunit.py
index ed2082d7d3bc..85973f918c9b 100644
--- a/tools/verification/rvgen/rvgen/kunit.py
+++ b/tools/verification/rvgen/rvgen/kunit.py
@@ -173,7 +173,7 @@ EXPORT_SYMBOL_IF_KUNIT({struct_name});
for path in (header_file_path, kunit_c_file_path):
if path.exists():
try:
- path.rename(path.with_suffix(path.suffix + ".bak"))
+ path.rename(path.with_suffix(path.suffix + ".old"))
except OSError as e:
raise KUnitError(f"Error backing up file {path}: {e}") from e
diff --git a/tools/verification/rvgen/tests/golden/test_bak_kunit/test_bak_kunit_kunit.c.bak b/tools/verification/rvgen/tests/golden/test_bak_kunit/test_bak_kunit_kunit.c.old
similarity index 100%
rename from tools/verification/rvgen/tests/golden/test_bak_kunit/test_bak_kunit_kunit.c.bak
rename to tools/verification/rvgen/tests/golden/test_bak_kunit/test_bak_kunit_kunit.c.old
base-commit: 0a0d1d55dad570724bf8c7ea83409639cfb4be9b
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] verification/rvgen: Use .old instead of .bak for kunit backup files
2026-08-24 8:15 [PATCH] verification/rvgen: Use .old instead of .bak for kunit backup files Gabriele Monaco
@ 2026-08-24 8:28 ` sashiko-bot
2026-08-24 15:33 ` Kuan-Wei Chiu
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-08-24 8:28 UTC (permalink / raw)
To: Gabriele Monaco; +Cc: linux-trace-kernel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The `rvgen kunit` tool generates `.old` backup files which are not cleaned up by `make distclean`, polluting the user's working directory.
--
--- Patch [1]: [PATCH] verification/rvgen: Use .old instead of .bak for kunit backup files ---
commit 293b444e4dfea5692931faee1bc9c58a549085d8
Author: Gabriele Monaco <gmonaco@redhat.com>
verification/rvgen: Use .old instead of .bak for kunit backup files
The rvgen kunit command generates .bak backup files and these can be
checked in for selftests (make check). Clean targets like make disclean
remove such files, leaving the tree dirty. Switch to .old to preserve a
clean tree after make disclean.
Closes: https://lore.kernel.org/lkml/aosuwKH5GOEo0xTN@google.com
> diff --git a/tools/verification/rvgen/rvgen/kunit.py b/tools/verification/rvgen/rvgen/kunit.py
> index ed2082d7d3bc4..85973f918c9b5 100644
> --- a/tools/verification/rvgen/rvgen/kunit.py
> +++ b/tools/verification/rvgen/rvgen/kunit.py
[ ... ]
> @@ -173,7 +173,7 @@ EXPORT_SYMBOL_IF_KUNIT({struct_name});
> for path in (header_file_path, kunit_c_file_path):
> if path.exists():
> try:
> - path.rename(path.with_suffix(path.suffix + ".bak"))
> + path.rename(path.with_suffix(path.suffix + ".old"))
[Severity: Medium]
Will this regression leave users' working directories polluted with .old
backup files that aren't cleaned up by the top-level make distclean target?
The kernel's global Makefile explicitly cleans *.bak files during
distclean, but ignores *.old files.
When a user runs rvgen kunit in a directory with existing kunit files and
accepts the backup prompt, print_files() will generate these .old files.
Since they are no longer .bak files, is it expected that they will persist
after running make distclean?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260824081519.81103-2-gmonaco@redhat.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] verification/rvgen: Use .old instead of .bak for kunit backup files
2026-08-24 8:15 [PATCH] verification/rvgen: Use .old instead of .bak for kunit backup files Gabriele Monaco
2026-08-24 8:28 ` sashiko-bot
@ 2026-08-24 15:33 ` Kuan-Wei Chiu
1 sibling, 0 replies; 3+ messages in thread
From: Kuan-Wei Chiu @ 2026-08-24 15:33 UTC (permalink / raw)
To: Gabriele Monaco; +Cc: linux-kernel, Steven Rostedt, Nam Cao, linux-trace-kernel
On Mon, Aug 24, 2026 at 10:15:19AM +0200, Gabriele Monaco wrote:
> The rvgen kunit command generates .bak backup files and these can be
> checked in for selftests (make check). Clean targets like make disclean
> remove such files, leaving the tree dirty.
>
> Switch to .old to preserve a clean tree after make disclean.
>
> Reported-by: Kuan-Wei Chiu <visitorckw@gmail.com>
> Closes: https://lore.kernel.org/lkml/aosuwKH5GOEo0xTN@google.com
> Fixes: 7b6246294eb0 ("verification/rvgen: Add selftests for rvgen kunit")
> Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
Thanks for the quick fix!
The working tree now remains clean after running make distclean.
Tested-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Regards,
Kuan-Wei
> ---
> tools/verification/rvgen/rvgen/kunit.py | 2 +-
> .../{test_bak_kunit_kunit.c.bak => test_bak_kunit_kunit.c.old} | 0
> 2 files changed, 1 insertion(+), 1 deletion(-)
> rename tools/verification/rvgen/tests/golden/test_bak_kunit/{test_bak_kunit_kunit.c.bak => test_bak_kunit_kunit.c.old} (100%)
>
> diff --git a/tools/verification/rvgen/rvgen/kunit.py b/tools/verification/rvgen/rvgen/kunit.py
> index ed2082d7d3bc..85973f918c9b 100644
> --- a/tools/verification/rvgen/rvgen/kunit.py
> +++ b/tools/verification/rvgen/rvgen/kunit.py
> @@ -173,7 +173,7 @@ EXPORT_SYMBOL_IF_KUNIT({struct_name});
> for path in (header_file_path, kunit_c_file_path):
> if path.exists():
> try:
> - path.rename(path.with_suffix(path.suffix + ".bak"))
> + path.rename(path.with_suffix(path.suffix + ".old"))
> except OSError as e:
> raise KUnitError(f"Error backing up file {path}: {e}") from e
>
> diff --git a/tools/verification/rvgen/tests/golden/test_bak_kunit/test_bak_kunit_kunit.c.bak b/tools/verification/rvgen/tests/golden/test_bak_kunit/test_bak_kunit_kunit.c.old
> similarity index 100%
> rename from tools/verification/rvgen/tests/golden/test_bak_kunit/test_bak_kunit_kunit.c.bak
> rename to tools/verification/rvgen/tests/golden/test_bak_kunit/test_bak_kunit_kunit.c.old
>
> base-commit: 0a0d1d55dad570724bf8c7ea83409639cfb4be9b
> --
> 2.55.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-24 15:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24 8:15 [PATCH] verification/rvgen: Use .old instead of .bak for kunit backup files Gabriele Monaco
2026-08-24 8:28 ` sashiko-bot
2026-08-24 15:33 ` Kuan-Wei Chiu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox