Skip to content

Commit 99e9ab5

Browse files
Ikkegitster
authored andcommitted
t0028: fix wrong octal values for BOM in setup
The setup code uses octal values with printf to generate a BOM for UTF-16/32 BE/LE. It specifically uses '\777' to emit a 0xff byte. This relies on the fact that most shells truncate the value above 0o377. Ash however interprets '\777' as '\77' + a literal '7', resulting in an invalid BOM. Fix this by using the proper value of 0xff: '\377'. Signed-off-by: Kevin Daudt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 268fbcd commit 99e9ab5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

t/t0028-working-tree-encoding.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ test_expect_success 'setup test files' '
2222
# BOM tests
2323
printf "\0a\0b\0c" >nobom.utf16be.raw &&
2424
printf "a\0b\0c\0" >nobom.utf16le.raw &&
25-
printf "\376\777\0a\0b\0c" >bebom.utf16be.raw &&
26-
printf "\777\376a\0b\0c\0" >lebom.utf16le.raw &&
25+
printf "\376\377\0a\0b\0c" >bebom.utf16be.raw &&
26+
printf "\377\376a\0b\0c\0" >lebom.utf16le.raw &&
2727
printf "\0\0\0a\0\0\0b\0\0\0c" >nobom.utf32be.raw &&
2828
printf "a\0\0\0b\0\0\0c\0\0\0" >nobom.utf32le.raw &&
29-
printf "\0\0\376\777\0\0\0a\0\0\0b\0\0\0c" >bebom.utf32be.raw &&
30-
printf "\777\376\0\0a\0\0\0b\0\0\0c\0\0\0" >lebom.utf32le.raw &&
29+
printf "\0\0\376\377\0\0\0a\0\0\0b\0\0\0c" >bebom.utf32be.raw &&
30+
printf "\377\376\0\0a\0\0\0b\0\0\0c\0\0\0" >lebom.utf32le.raw &&
3131
3232
# Add only UTF-16 file, we will add the UTF-32 file later
3333
cp test.utf16.raw test.utf16 &&

0 commit comments

Comments
 (0)