On 17.02.2020 18:24, Eric Sunshine wrote:
+ x=0123456789abcde\n && # 16
Did you intend for the \n in this assignment to be a literal newline?
Every shell with which I tested treats it instead as an escaped 'n'.
I'm such a novice shell script writer :(
Yes, I intended a newline.
By the way, are the embedded newlines actually important to the test
itself, or are they just for human consumption if the test fails?I
ask because I was curious about how other tests create large files,
and found that a mechanism similar to your original (but without the
pitfalls) has been used. For instance, t1050-large.sh uses:
printf "%2000000s" X >large1 &&
which is plenty portable and (presumably) doesn't have such demanding
memory consumption.
They are not important to the test; the test only needs to internally
have a 8+ mb patch.
This only comes from my feeling that super-large lines could cause other
unexpected things, such as hitting various completely reasonable limits
and/or causing unwanted slowdowns. Frankly, I didn't test.
Frankly, I already had concerns about adding the test. Now I have
re-evaluated things and finally decided to move the test into commit
message instead. With it, all compatibility etc questions are resolved.