Re: [PATCH] tests: mktemp: add tests for invalid Unicode options
From:
Collin Funk
Subject:
Re: [PATCH] tests: mktemp: add tests for invalid Unicode options
Date:
Mon, 05 Jan 2026 17:53:41 -0800
User-agent:
Gnus/5.13 (Gnus v5.13)
PƔdraig Brady <P@draigBrady.com> writes:
> On 05/01/2026 00:54, Collin Funk wrote:
>> * init.cfg (bad_unicode): New function, copied from
>> tests/fold/fold-characters.sh with the NUL removed.
>> * tests/fold/fold-characters.sh (bad_unicode): Rename to
>> bad_unicode_with_nul. Reformat long line.
>> * tests/mktemp/bad-unicode.sh: New test.
>> * tests/local.mk (all_tests): Add the new test.
>
> There were a few issues with this:
>
> It's actually creating files, and theoretically some file systems
> may reject the bad unicode, which would induce a false failure.
>
> Also it's better to use a cleanup_() function to remove files etc.
> to handle the case where a test is terminated early.
>
> Both the above issues can be avoided by passing -u to mktemp,
> so that it only does internal processing.
>
> There were typos with --tempdir and test -z.
Oops, silly mistakes on my part. I think it is more beneficial to ensure
the files and directories are created if the file system and operating
system support it.
How about using a shell redirection to check if bad unicode in file
names are supported? I attached a v2 patch doing that.
Also, I made it so files and directories are only created under the
current working directory. That removes the need for manual cleanup.
> The tests/misc/mktemp.pl should be moved to
> the tests/mktemp dir as part of this.
Yep, I was going to do that afterwards.
Collin