BPF List
 help / color / mirror / Atom feed
From: Vineet Gupta <vineet.gupta@linux.dev>
To: Ihor Solodrai <ihor.solodrai@linux.dev>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next] selftests/bpf: Sanitize traffic monitor log file names
Date: Thu, 6 Aug 2026 14:57:06 -0700	[thread overview]
Message-ID: <22167514-248e-411e-ba4c-2e000f38e9ef@linux.dev> (raw)
In-Reply-To: <078e91be-92d2-4ea7-94e1-a81562a35a3b@linux.dev>



On 8/6/26 2:53 PM, Ihor Solodrai wrote:
> On 8/6/26 2:11 PM, Vineet Gupta wrote:
>> 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.
>> Test names are free form though, and other characters make it through.
>> A subtest called "INET4: bpf timestamping" produces
>>
>>    /tmp/tmon_pcap/packets-125-15-net_timestamping__INET4:_bpf_timestamping-net_timestamping_ns.log
>>
>> CI systems that collect these logs as artifacts reject such names.
>> GitHub Actions' upload-artifact fails the upload with
>>
>>    Error: The path for one of the files in artifact is not valid:
>>    ... Contains the following character:  Colon :
>>
>> Replace the whole set of awkward characters in one pass rather than
>> adding another strchr() loop per character. Note the loop tests *p
>> before calling strchr(), so the terminating NUL is never passed to it.
>>
>> This came up as a side error/annoyance when trying to re-enable BPF-GCC
>> CI runs [1]. The CI side already has path name normalization and needs
>> some tweaking as well, however fixing it at the source also makes sense.
>>
>> Fixes: f52403b6bfea ("selftests/bpf: Add traffic monitor functions.")
>> Link: https://github.com/kernel-patches/vmtest/actions/runs/30710914503/job/91399011388 [1]
>> Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev>
>> ---
>>   tools/testing/selftests/bpf/network_helpers.c | 11 +++++++----
>>   1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/selftests/bpf/network_helpers.c
>> index db935a9d9fc1..3818cec354a0 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.
>> +	 */
>> +	for (p = buf; *p; p++)
>> +		if (strchr("/ \":<>|*?\r\n", *p))
> Hi Vineet,
>
> We already do this on the CI side here:
> https://github.com/libbpf/ci/blob/main/run-vmtest/normalize-paths-for-github.sh
>
> The problem on the CI side is that the script is not executed
> in some corner cases, like a VM timeout.
>
> I don't think this change is necessary upstream: the paths are
> technically valid, it's an issue for CI only due to github quirks.

Yeah I've submitted that separately [1] - this was more of a preventive 
fix to not generate such file names in the first place.

Thx,
-Vineet

[1] https://github.com/kernel-patches/vmtest/pull/504

      reply	other threads:[~2026-08-06 21:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 21:11 [PATCH bpf-next] selftests/bpf: Sanitize traffic monitor log file names Vineet Gupta
2026-08-06 21:17 ` sashiko-bot
2026-08-06 21:37   ` Vineet Gupta
2026-08-06 21:53 ` Ihor Solodrai
2026-08-06 21:57   ` Vineet Gupta [this message]

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=22167514-248e-411e-ba4c-2e000f38e9ef@linux.dev \
    --to=vineet.gupta@linux.dev \
    --cc=bpf@vger.kernel.org \
    --cc=ihor.solodrai@linux.dev \
    /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