Re: [PATCH v3 1/8] t7519: rewrite sparse index test
flat view
From: Eric Sunshine <hidden>
Date: 2021-08-20 16:40:58
On Fri, Aug 20, 2021 at 11:09 AM Derrick Stolee [off-list ref] wrote:
On 8/19/2021 3:45 AM, Johannes Schindelin wrote:> On Tue, 17 Aug 2021, Derrick Stolee via GitGitGadget wrote:quoted
quoted
+ write_script .git/hooks/fsmonitor-test <<-\EOF && printf "last_update_token\0"Technically, the backslash needs to be escaped because it is within double quotes and we do not want the shell to interpolate the `\0`, but `printf`. Practically, all the shells I tried handle this as expected.
Technically, for a POSIX-conforming shell, `\0` is correct, and the backslash does not need to be escaped. Of course, it doesn't hurt to write `\\0` since it resolves to the same thing, but it isn't necessary. See POSIX section "2.2.3 Double-Quotes": https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02_03
I have no opinions on this one way or another. I will just point out that the pattern used in this test is also used throughout the test script, so any change to that format should be applied universally. The test has been operating without complaint since it was introduced in 5c8cdcf (fsmonitor: add test cases for fsmonitor extension, 2017-09-22), so compatibility is likely not a problem.
Since POSIX says that `\0` is correct and since we haven't encountered any shells which handle this incorrectly, there seems little reason to change it.