delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/07/24/07:40:43

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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=k3zRskfqozDH0FlCni8dFbUQu0FhnJ41p8uDXL89Opp
RVoWCg7vb9Vt0ylGqMuI0ypN9unqQgSJarsVTMyfb1522ubBC9D4Hq73d5WGOTTu
lDr6LyNSxgj+KQBf6hjD5QD25Q8LsejDCdhvFBtm0kPoL65FtXKtT8m45kL14STM
=
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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=bmwvCTXRxYRG278fKY4RulXuziI=; b=HjY08VAzsUy/CzpRh
nQoaqvmdtTF4tJPFcyfIBhkCAm0LuEP1xQbURLBTSinNzLtKxesQic714TGXJvgD
orFjj+S5WXfoIA2BNDuVIR2vddHpatfTJw7MoizpUzEolSa22FOcemtzOMmeYfR1
coIs+p1fd+R53kWO2GiGjzw2Yo=
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=0.5 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2
X-HELO: demumfd002.nsn-inter.net
Message-ID: <55B22422.6000601@towo.net>
Date: Fri, 24 Jul 2015 13:40:18 +0200
From: Thomas Wolff <towo AT towo DOT net>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: [ANNOUNCEMENT] Update: mintty 2.1.2
References: <announce DOT 55B1677D DOT 5080303 AT towo DOT net> <63a08c60771faffa23bc1c029235301d DOT squirrel AT oude-webmail DOT xs4all DOT nl>
In-Reply-To: <63a08c60771faffa23bc1c029235301d.squirrel@oude-webmail.xs4all.nl>
X-TagToolbar-Keys: D20150724134018394
X-purgate-type: clean
X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de
X-purgate: clean
X-purgate: This mail is considered clean (visit http://www.eleven.de for further information)
X-purgate-size: 2567
X-purgate-ID: 151667::1437738020-000063FD-B817D05D/0/0
X-IsSubscribed: yes

On 24.07.2015 09:50, Houder wrote:
>> mintty 2.1.2 is an update in response to a number of crash reports under
>> unclear circumstances;
To resolve this discomforting issue which I still cannot reproduce, 
could please those who experience a crash report some details about 
their calling environment?
Could the issue be related to the occasional fork() resource problems in 
cygwin?
How much free memory do you have?
Insights can also be collected in 
https://github.com/mintty/mintty/issues/464

>> mintty only detaches from the caller's terminal if the option -D is given
> Thank you, Thomas!
> ...
My quick fix seems to work for now at least, sigh!
> I extracted mintty.exe (and named it mintty-v212.exe) from mintty-2.1.2-0.tar.xz, and
> placed it in <Windows Cygwin root>/bin (i.e. I did not install through setup.exe)
>
>  From winmain.c (v212),
>
>    // if started from console, try to detach from caller's terminal (~daemonize)
>    // in order to not suppress signals
>    // (indicated by isatty if linked with -mwindows)
>    if (daemonize && !isatty(0)) { // boolean daemonize is set to true if -D is specified
>      if (fork() > 0) exit(0);
>      setsid();
>    }
>
> I gather, that v212 has the "old behaviour" if -D is not specified on the command line.
>
> Test v212:
>
>   - started from the explorer: works
>   - using a dos console (in which mintty-v212 is started): works
>   - using a dos console (in which bash is started), followed by invocation of mintty-v212: works
>   - using a dos console (in which cmd is started), followed by invocation of mintty-v212: works
>
> Of course, SIGINT is ignored in the third case (old behaviour).
>
> Invocation of 'mintty-v212 -D' in the third case, makes "mintty" crash again ...
> (hint: source code of setsid.c -- util-linux package)
Maybe setsid() should not be called if fork() fails...
Could you try this please:
   if (daemonize && !isatty(0)) {
     int pid = fork();
     if (pid > 0) exit(0);    // exit parent process
     if (pid == 0) setsid();  // detach child process
     if (pid < 0) {
       error("could not detach from caller");
       exit(9);
     }
   }

> (... and I ask myself whether or not the condition '!isatty' is the "correct condition" to
>   go "daemon")
I wanted to check ttyname() for "/cons" but surprisingly ttyname() was 
null when started from cygwin console;
– could this be related to the original issue of signals not being 
delivered? (Corinna?)

Thanks for everybody's debugging support.
Thomas

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