Web lists-archives.com

Segfault using `watch -c` with ANSI escapes in output

I'm seeing a segfault from using `watch -c` with commands that output
ANSI colour sequences, which is a bit sad given the whole point of the
`-c` is to get the ANSI colour sequences to be displayed.

Simple test case:

    $ echo -e '\e[0;32mGreen\e[0;0m' >escapes

    $ cat escapes  # Text is green in my terminal

    $ xxd escapes
    00000000: 1b5b 303b 3332 6d47 7265 656e 1b5b 303b  .[0;32mGreen.[0;
    00000010: 306d 0a                                  0m.

    $ watch -c cat escapes
    Segmentation fault (core dumped)

    $ cat watch.exe.stackdump
    Exception: STATUS_ACCESS_VIOLATION at rip=001004029B0
    rax=0000000058F5FF8D rbx=0000000600001200 rcx=0000000600000060
    rdx=0000000000000000 rsi=0000000000000000 rdi=0000000000000004
    r8 =00000000FFFFCA2C r9 =000000018013C800 r10=0000000100000000
    r11=000000010040299A r12=0000000000000004 r13=00000000FFFFCAF0
    r14=0000000600000E50 r15=00000001801F82C0
    rbp=0000000000000000 rsp=00000000FFFFCA60
    program=C:\cygwin64\bin\watch.exe, pid 12100, thread main
    cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B
    Stack trace:
    Frame        Function    Args
    00000000000  001004029B0 (00000000000, 00000000000, 00000000030,
    000FFFFCCC0  00180047812 (00000000000, 00000000000, 00000000000,
    00000000000  001800455E3 (00000000000, 00000000000, 00000000000,
    000FFFFFFF0  00180045694 (00000000000, 00000000000, 00000000000,
    End of stack trace

This works as expected when using `watch` without the `-c` option, and
when using `watch -c` with output that doesn't include any ANSI colour

Output from `cygcheck -srv` is attached, and `cygcheck -f
/usr/bin/watch.exe` returns `procps-ng-3.3.11-1`.

Attachment: cygcheck.out
Description: Binary data

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple