Re: [PATCH bpf-next] selftests/bpf: Sanitize traffic monitor log file names
Vineet Gupta <[email protected]>
| Newsgroups | dev.linux.lists.sashiko-reviews,org.kernel.vger.bpf |
|---|---|
| Message-ID | <[email protected]> |
On 8/6/26 2:17 PM, [email protected] wrote: > Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: > - [Medium] The backslash character `\` is missing from the sanitization string, leaving artifact names vulnerable to rejection by GitHub Actions. > - [Low] The newly introduced multi-line comment violates the BPF subsystem's strict comment style guidelines. > -- > > --- Patch [1]: [PATCH bpf-next] selftests/bpf: Sanitize traffic monitor log file names --- > commit 4eb40c6024aab5f28e7a52af3fba116cbdeff427 > Author: Vineet Gupta <[email protected]> > > selftests/bpf: Sanitize traffic monitor log file names > > The traffic monitor names its capture logs after the test and subtest > being run, replacing '/' and ' ' so the result is usable as a file name. > This patch replaces the whole set of awkward characters in one pass to > fix artifact upload failures in CI systems like GitHub Actions. > > Link: https://github.com/kernel-patches/vmtest/actions/runs/30710914503/job/91399011388 [1] > >> diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/selftests/bpf/network_helpers.c >> index db935a9d9fc1a..3818cec354a0d 100644 >> --- a/tools/testing/selftests/bpf/network_helpers.c >> +++ b/tools/testing/selftests/bpf/network_helpers.c >> @@ -1142,10 +1142,13 @@ static void encode_test_name(char *buf, size_t len, const char *test_name, const >> snprintf(buf, len, "%s__%s", test_name, subtest_name); >> else >> snprintf(buf, len, "%s", test_name); >> - while ((p = strchr(buf, '/'))) >> - *p = '_'; >> - while ((p = strchr(buf, ' '))) >> - *p = '_'; >> + /* Test names are free form, so replace anything that is awkward in a >> + * file name. Besides the path separator, this covers the characters >> + * rejected by CI systems collecting these logs as artifacts. >> + */ > [Severity: Low] > This isn't a bug, but does this multi-line comment in encode_test_name() > conflict with the BPF subsystem's comment style guidelines? The opening /* > is typically expected to be placed on its own line. It follows the pre-existing convention in this file and for netdev in general. I can fix if maintainers prefer that. >> + for (p = buf; *p; p++) >> + if (strchr("/ \":<>|*?\r\n", *p)) > [Severity: Medium] > Since this is meant to cover characters rejected by CI systems like GitHub > Actions, should the backslash character '\\' also be included in this > sanitization string? > > If a test or subtest name contains a backslash, it appears the artifact > upload could still fail. The original intention was parity with libbpf-ci: run-vmtest/normalize-paths-for-github.sh but agree adding the backslash makes it more robust. Thx, -Vineet