Fix '\%o' for printf from coreutils
The printf utility provided by coreutils when interpreting '\%o' format does not recognize %o as formatting directive. For example printf '\%o 0 returns \%o and warning: ignoring excess arguments, starting with ‘0’, which results in failed tests in t5309-pack-delta-cycles.sh. In most shells the test ends with success as the printf is a builtin utility. Fix it by using '\\%o' which is interpreted consistently in all versions of printf. Signed-off-by: Kacper Kornet <draenog@pld-linux.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kacper Kornet committed
Oct 31, 2013 at 12:51 UTC
fbc812a6009ebc91f4870c3572821cb4d68184f8
1 file changed
+4
-4
t/lib-pack.sh
+4
-4
@@ -12,10 +12,10 @@
12
# Print the big-endian 4-byte octal representation of $1
13
uint32_octal () {
14
n=$1
15
- printf '\%o' $(($n / 16777216)); n=$((n % 16777216))
16
- printf '\%o' $(($n / 65536)); n=$((n % 65536))
17
- printf '\%o' $(($n / 256)); n=$((n % 256))
18
- printf '\%o' $(($n ));
15
+ printf '\\%o' $(($n / 16777216)); n=$((n % 16777216))
16
+ printf '\\%o' $(($n / 65536)); n=$((n % 65536))
17
+ printf '\\%o' $(($n / 256)); n=$((n % 256))
18
+ printf '\\%o' $(($n ));
19
}
20
21
# Print the big-endian 4-byte binary representation of $1