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

Jon Turney jon.turney@dronecode.org.uk
Wed Apr 19 15:42:00 GMT 2017


On 18/04/2017 16:10, Brian Inglis wrote:
> On 2017-04-18 06:36, Adam Dinwoodie wrote:
>> 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
>>     Green
>>     $ 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)
>
> Dies on me too:
> $ uname -srvmo
> CYGWIN_NT-10.0 2.8.0(0.309/5/3) 2017-04-01 20:47 x86_64 Cygwin
> $ watch --version
> watch from procps-ng 3.3.11
>
> gdb crashes with dumper .core.
>
> $ gdb watch
> ...
> Reading symbols from watch...(no debugging symbols found)...done.

If you install procps-ng-debuginfo for symbols...

> (gdb) run -c cat e
> Starting program: /usr/bin/watch -c cat e
> [New Thread 436.0x19dc]
> [New Thread 436.0x1e44]
> [New Thread 436.0x834]
> [New Thread 436.0x12d0]
> [New Thread 436.0x1508]
> [New Thread 436.0xa24]
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000001004029b0 in ?? ()
> (gdb) bt
> #0  0x00000001004029b0 in ?? ()

... you'll see the obvious mistake which has been fixed upstream for a 
while [1].

[1] https://gitlab.com/procps-ng/procps/issues/11


--
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



More information about the Cygwin mailing list