It looks like this is a brittle unit test.

Lucas Nussbaum wrote:
> > Failures:
> > ! /<<PKGBUILDDIR>>/test/ext/test-help:35  '1' = '0'  FAILED

This line is:

    WVPASSEQ 1 $(bup help save | head -1 | grep -cF 'bup-save(1)')

The hyphen in the grep expression "bup-save(1)" in the unit test is the
ordinary ASCII character 45:

    ASCII 2/13 is decimal 045, hex 2d, octal 055, bits 00101101: prints as `-'
    Official name: Hyphen
    Other names: Dash, Minus, Worm

That matches the output of "bup help save | head -1" in the C locale:

    root@8f8c3e4ea090:/# LC_ALL=C LANG=C bup help save | head -1 | hd
    troff:<standard input>:5: warning: cannot select font 'CB'
    troff:<standard input>:152: warning: cannot select font 'C'
                       vv
    00000000  62 75 70 2d 73 61 76 65  28 31 29 20 20 20 20 20  |bup-save(1)    
 |
                       ^^
    00000010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |               
 |
    *
    00000070  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 62  |               
b|
    00000080  75 70 2d 73 61 76 65 28  31 29 0a                 |up-save(1).|
    0000008b
    root@8f8c3e4ea090:/#

> The full build log is available from:
> http://qa-logs.debian.net/2023/07/26/bup_0.33.2-1_unstable.log

    User Environment
    ----------------

    […]
    LANG=C.UTF-8
    LC_ALL=C.UTF-8
    […]

However, with a UTF-8 locale I see the hyphen being encoded as the byte
sequence 0xE2 0x80 0x90:

    root@8f8c3e4ea090:/# LC_ALL=C.UTF-8 LANG=C.UTF-8 bup help save | head -1 | 
hd
    troff:<standard input>:5: warning: cannot select font 'CB'
    troff:<standard input>:152: warning: cannot select font 'C'
                       vvvvvvvv
    00000000  62 75 70 e2 80 90 73 61  76 65 28 31 29 20 20 20  |bup...save(1)  
 |
                       ^^^^^^^^
    00000010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |               
 |
    *
    00000080  20 62 75 70 e2 80 90 73  61 76 65 28 31 29 0a     | 
bup...save(1).|
    0000008f
    root@8f8c3e4ea090:/#

Which is the UTF-8 encoding of the Unicode character U+2010 'HYPHEN'.

So I guess the bup unit tests should probably set LANG/LC_ALL explicitly.

Thanks!

-- 
Robert Edmonds
edmo...@debian.org

Reply via email to