Subject: bug#32236: df header corrupted with LANG=zh_TW.UTF-8 on macOS

From: Chih-Hsuan Yen <[email-masked]>
Date: Sun, 22 Jul 2018 20:51:16 +0800

2018-07-22 18:46 GMT+08:00 Bruno Haible <[email-masked]>:
> Chih-Hsuan Yen wrote:
>> The `c_iscntrl()` patch also fixes the issue on macOS. Please tell me
>> if you want me to test other patches, thanks!
>
> You could test how it behaves with mount points that contain U+2028 or
> U+2029 characters. On Linux, I'd test it like this. Hope it's similar
> on macOS:
> $ mkdir /tmp/`printf 'abc\u2028def\u2029ghi'`
> $ sudo mount -r -t iso9660 -o loop /some/iso/image.iso /tmp/abc*
> $ df
> ...
> /dev/loop0                1986048    1986048          0  100% /tmp/abc�def�ghi
> $ ls -ld /tmp/abc*
> dr-xr-xr-x 4 root root 2048 Nov 19  2014 /tmp/abc?def?ghi
>
> Bruno
>

Hi Bruno,

With the c_iscntrl() patch, the result of ls and df are: (I use xxd as
GMail seems unable to handle U+2028 and U+2029 correctly)

$ ls -ld /tmp/abc def ghi | xxd
00000000: 6472 7778 722d 7872 2d78 2031 2079 656e  drwxr-xr-x 1 yen
00000010: 2073 7461 6666 2034 3039 3620 3230 3138   staff 4096 2018
00000020: 2f30 372f 3232 2030 323a 3136 3a34 3320  /07/22 02:16:43
00000030: 2f74 6d70 2f61 6263 e280 a864 6566 e280  /tmp/abc...def..
00000040: a967 6869 0a                             .ghi.

$ df | xxd
00000000: e6aa 94e6 a188 e7b3 bbe7 b5b1 2020 2020  ............
00000010: 2020 2020 e5ae b9e9 878f 2020 e5b7 b2e7      ......  ....
00000020: 94a8 2020 e58f afe7 94a8 20e5 b7b2 e794  ..  ...... .....
00000030: a825 20e6 8e9b e8bc 89e9 bb9e 0a2f 6465  .% ........../de
00000040: 762f 6469 736b 3173 3120 2020 2032 3334  v/disk1s1    234
00000050: 4720 2031 3337 4720 2020 3935 4720 2020  G  137G   95G
00000060: 3630 2520 2f0a 2f64 6576 2f64 6973 6b31  60% /./dev/disk1
00000070: 7334 2020 2020 3233 3447 2020 322e 3147  s4    234G  2.1G
00000080: 2020 2039 3547 2020 2020 3325 202f 7072     95G    3% /pr
00000090: 6976 6174 652f 7661 722f 766d 0a63 6879  ivate/var/vm.chy
000000a0: 656e 2e63 633a 2020 2020 2020 2020 3235  en.cc:        25
000000b0: 4720 2020 3132 4720 2020 3132 4720 2020  G   12G   12G
000000c0: 3532 2520 2f70 7269 7661 7465 2f74 6d70  52% /private/tmp
000000d0: 2f61 6263 e280 a864 6566 e280 a967 6869  /abc...def...ghi
000000e0: 0a                                       .

Without the c_iscntrl() patch (unmodified 8.30), ls behaves the same,
and the result of df is:

$ df | xxd
00000000: e6aa 3fe6 a13f e7b3 bbe7 b5b1 20e5 aeb9  ..?..?...... ...
00000010: e93f 3f20 e5b7 b2e7 3fa8 20e5 3faf e73f  .?? ....?. .?..?
00000020: a820 e5b7 b2e7 3fa8 2520 e63f 3fe8 bc3f  . ....?.% .??..?
00000030: e9bb 3f0a 2f64 6576 2f64 6973 6b31 7331  ..?./dev/disk1s1
00000040: 2020 2020 3233 3447 2020 3133 3747 2020      234G  137G
00000050: 2020 3935 4720 2020 2036 3025 202f 0a2f    95G    60% /./
00000060: 6465 762f 6469 736b 3173 3420 2020 2032  dev/disk1s4    2
00000070: 3334 4720 2032 2e31 4720 2020 2039 3547  34G  2.1G    95G
00000080: 2020 2020 2033 2520 2f70 7269 7661 7465       3% /private
00000090: 2f76 6172 2f76 6d0a 6368 7965 6e2e 6363  /var/vm.chyen.cc
000000a0: 3a20 2020 2020 2020 2032 3547 2020 2031  :        25G   1
000000b0: 3247 2020 2020 3132 4720 2020 2035 3125  2G    12G    51%
000000c0: 202f 7072 6976 6174 652f 746d 702f 6162   /private/tmp/ab
000000d0: 63e2 3fa8 6465 66e2 3fa9 6768 690a       c.?.def.?.ghi.

Hope those results are helpful!

Chih-Hsuan Yen