delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/04/18/11:11:12

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:references:to:from:reply-to:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=wXqvyxjeYejoBSTs
uUYebg5BVGEQIftVN8G26KzfhhnRUlq7ESbsb7u670dRNiBZrQn1JvTXAliXqXrH
qrDI9msCImLM8scRHHK37AwCx5nrloeyL84chrVRyvdu019DIgk67XQl6z4xTsoV
v+HdpgOJmvbASuT/CmQrUo9itKg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:references:to:from:reply-to:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=jofjIqAqfwPMA0VeFTjbzy
y9G4o=; b=T5KmT1Vh/9Bu8JdAIrwqYKiPpGCy82BAOWgyoHYlP8bk0vg0vk8lOy
w0/8xIkO6lEXRIJuXPi+xk8xqdIEkXVOt/RHafbFRcBpe3B3C2MFRtXmV6U8mj6k
0CfvTKq1Lc75MhY4RyHXRapM5U8T2XUrDUD4RFZcR0TdLJUc9Wr9g=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Adam, dinwoodie, stopped, Dinwoodie
X-HELO: smtp-out-no.shaw.ca
X-Authority-Analysis: v=2.2 cv=dMPWoKRb c=1 sm=1 tr=0 a=WqCeCkldcEjBO3QZneQsCg==:117 a=WqCeCkldcEjBO3QZneQsCg==:17 a=IkcTkHD0fZMA:10 a=2jbGtApKPf5quagkgDUA:9 a=QEXdDO2ut3YA:10
Subject: Re: Segfault using `watch -c` with ANSI escapes in output
References: <CA+kUOanFdr6i3E8=2hTJS+3X7RYY246y6czxiJ_=O=dwpz_daA AT mail DOT gmail DOT com>
To: cygwin AT cygwin DOT com
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Message-ID: <afb2fadc-ce22-8573-6b56-805cd7450298@SystematicSw.ab.ca>
Date: Tue, 18 Apr 2017 09:10:42 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <CA+kUOanFdr6i3E8=2hTJS+3X7RYY246y6czxiJ_=O=dwpz_daA@mail.gmail.com>
X-CMAE-Envelope: MS4wfJBsiN8EghxBUwoktlRGTUC+bvu99DY6tzpJX5dd3BcmJ3DZaLLpJgm84EYgg8m2j6VEg9nWsMa+wXJ8s5yaLlwHRm9nEVn6JU1tmVPSIO7Oi8PdgjFN ETlmVr05UFbk042XvP7pyj4rPhq1tq0DHst9Iwh0Dg5FZQ0CRXltjEptt6ZWedGe/ZftekgjlznPzg==
X-IsSubscribed: yes

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.
(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 ?? ()
#1  0x0000000180047812 in _cygwin_exit_return () at /usr/src/debug/cygwin-2.8.0-1/winsup/cygwin/dcrt0.cc:1018
#2  0x00000001800455e3 in _cygtls::call2 (this=0xffffce00, func=0x1800468d0 <dll_crt0_1(void*)>, arg=0x0,
    buf=buf AT entry=0xffffcdf0) at /usr/src/debug/cygwin-2.8.0-1/winsup/cygwin/cygtls.cc:40
#3  0x0000000180045694 in _cygtls::call (func=<optimized out>, arg=<optimized out>)
    at /usr/src/debug/cygwin-2.8.0-1/winsup/cygwin/cygtls.cc:27
#4  0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) q
A debugging session is active.

        Inferior 1 [process 436] will be killed.

Quit anyway? (y or n) y

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

Same here e.g. $ watch cat e; watch -c cat -A e both work okay.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019