@matheusbsbs / matheus-bagliano / commits / 99b2ba35f5
Fork 0

t0028: eliminate non-standard usage of printf

man 1p printf: In addition to the escape sequences shown in the Base Definitions volume of POSIX.1‐2008, Chapter 5, File Format Notation ('\\', '\a', '\b', '\f', '\n', '\r', '\t', '\v'), "\ddd", where ddd is a one, two, or three-digit octal number, shall be written as a byte with the numeric value specified by the octal number. printf '\xfe\xff' is an extension of some shell. Dash, a popular yet simple shell, do not implement this extension. This wasn't caught by most people running the tests, even though common shells like dash don't handle hex escapes, because their systems don't trigger the NO_UTF16_BOM prereq. But systems with musl libc do; when combined with dash, the test fails. Correct it. Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Doan Tran Cong Danh committed Nov 7, 2019 at 09:56 UTC 99b2ba35f5a67dd6308b265a8e4c3a92e2e67221
1 file changed +2 -2
t/t0028-working-tree-encoding.sh
+2 -2
@@ -17,7 +17,7 @@ test_lazy_prereq NO_UTF32_BOM '
17 write_utf16 () {
18 if test_have_prereq NO_UTF16_BOM
19 then
20 - printf '\xfe\xff'
20 + printf '\376\377'
21 fi &&
22 iconv -f UTF-8 -t UTF-16
23 }
@@ -25,7 +25,7 @@ write_utf16 () {
25 write_utf32 () {
26 if test_have_prereq NO_UTF32_BOM
27 then
28 - printf '\x00\x00\xfe\xff'
28 + printf '\0\0\376\377'
29 fi &&
30 iconv -f UTF-8 -t UTF-32
31 }