delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/07/25/16:15:40

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:in-reply-to:references:date:subject
:from:to:mime-version:content-type:content-transfer-encoding; q=
dns; s=default; b=HJiRW+VJ0WRbydBxe8nYQ2GdqPILKAp5KdYrc3S2fkizNU
C6yUjiaNuDodvIXYRBhdkWUurLMxfaj0U+skoWxYaoxffziw3qPcjrPt1FvtN74q
YA7jrMlBqXCgrN5axLz893yzBeYsq6DhCfAni3b5lMLKDiU0R7I4/TG1dnZZw=
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:in-reply-to:references:date:subject
:from:to:mime-version:content-type:content-transfer-encoding; s=
default; bh=mmOKf9JuIwINjscxm0bP5L39Bw4=; b=tP3/zkGM/y/boZXroWh5
XYjwZhcwjui6A2NFHxdsAaYWxaMXeJnr5P+J5iaPVCDCMLyp1T9gKd0emuO/mBxe
3o2gKlDPkpOI7RtbhNezndexmBIk9Ke3irTAIg7qu94WPdXZe8GjQogG2nCTxhng
YNo9IQmFGHg8BYgivwOc/0A=
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.1 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: lb1-smtp-cloud2.xs4all.net
Message-ID: <e731c3536912df8739a630e17ab5d8ec.squirrel@oude-webmail.xs4all.nl>
In-Reply-To: <be0351be5e3aa7b7ba980fc25f9cce0c.squirrel@oude-webmail.xs4all.nl>
References: <announce DOT 55B1677D DOT 5080303 AT towo DOT net> <63a08c60771faffa23bc1c029235301d DOT squirrel AT oude-webmail DOT xs4all DOT nl> <55B22422 DOT 6000601 AT towo DOT net> <d9ef810e0ad325a9b51f641a10a06f0b DOT squirrel AT oude-webmail DOT xs4all DOT nl> <55B2B644 DOT 8010506 AT towo DOT net> <be0351be5e3aa7b7ba980fc25f9cce0c DOT squirrel AT oude-webmail DOT xs4all DOT nl>
Date: Sat, 25 Jul 2015 22:15:13 +0200
Subject: Re: [ANNOUNCEMENT] Update: mintty 2.1.2
From: "Houder" <houder AT xs4all DOT nl>
To: cygwin AT cygwin DOT com, "Thomas Wolff" <towo AT towo DOT net>
User-Agent: SquirrelMail/1.4.22
MIME-Version: 1.0
X-IsSubscribed: yes

> I found the bug (more or less): it is me (AND you). More will follow soon.

Hi Thomas,

As I reported earlier, I found the culprit ...

No, I did not build my own Cygwin.dll, as advised by Corinna, because to her Cygwin
is NOT "rocket science" (after all these years), however to me, it is still

    an "intergalactic science". :-)

But first things, first ...

Please, make a mental picture of the check boxes at your place at 'control panel >
performance information and tools > adjust visual effects'.

I'll bet, all check boxes for "eye candy" has been checked at your place; NONE of
them are checked at my place ...
(I am an old fashioned guy, who wants his 8 cores to do useful things)

Now, I said, that I found the culprit, but I what I really meant, was that I found
the function, that made mintty crash AT MY SIDE.

You still have to do all the hard work ... Sorry, I cannot help you with that.

winmain.c:

  // Initialise various other stuff.
  win_init_drop_target();
  win_init_menus();
// Henri: got you!
// CURIOUSLY NO PROBLEM if mintty is started from either cmd or explorer
  //update_transparency(); // culprit: Oh God, eye candy ...
if ( (fh = fopen("_RUNNING", "w") ) == (FILE *)NULL) error("_RUNNING ...");
fclose(fh);

// Henri: ouch! -- it even crashes  before this point
if ( (fh = fopen("_show_window", "w") ) == (FILE *)NULL) error("show_window ...");
fclose(fh);
  // Create child process.
  child_create(
    argv, &(struct winsize){cfg.rows, cfg.cols, term_width, term_height}
  );

The culprit is (at least at my place: update_transparancy()). After I had removed
the invocation of update_transparency() before the call to child_create(), mintty
did not crash anymore (at least at my place).

How did I proceed in finding this bug ... well, basically, I applied some debugging
in the old-fashioned way (using printf, sort of).

I started with the addition of this code:

i.e. I replaced 'your fork code', which follows after the processing of the command
line options, with:

  finish_config();

#if 1 // Henri
char my_msg[100];
if (snprintf(my_msg, 100, "getpgrp() = %d, getpid() = %d\n", getpgrp(), getpid() ) > 0) {
    show_msg(stdout, my_msg);
}

FILE *fh;
if (getppid() != (pid_t)1) {
                  /* Perhaps NOT the correct condition (or at least NOT complete)
                     However, is is sufficient for the following 2 cases:
                      - starting a shortcut to mintty (which forks bash), followed by yet another
                        invocation of mintty
                      - starting a shortcut to bash, followed by a invocation of mintty
                   */

    // a process started by bash is always a process group leader (fork will always happen)
    if (getpgrp() == getpid()) {
        switch (fork()) {
        case -1:
            error("fork");
        case 0:
            /* child */
            show_msg(stdout, "child"); // debug
            break;
        default:
            /* parent */
            show_msg(stdout, "parent"); // debug
            return 0;
        }
    }

// Henri: output to file, as output to stdout will not do after setsid()
    if ( (fh = fopen("_henri", "w") ) == (FILE *)NULL) error("fopen ...");
    if ( fprintf(fh, "before setsid() ...\n") <= 0) error("fprintf ...");
fflush(fh);
    if (setsid() < 0) {
        fprintf(fh, "setsid() failed\n");
    } else {
        fprintf(fh, "setsid() ...\n");
    }
fflush(fh);
fclose(fh);

} // if (!isatty(0))
#endif

I learned from this exercise, that the bug had to be further down the source code,
as mintty kept on crashing.

Next, I applied "bisection" on the remainder of the file (winmain.c) ...

It turned out, that mintty can survive its invocation (at least at my place), if I
remove the invocation of update_transparancy() before the call to child_create().

Now, the ball is in your court again ...

Btw, invocation of mintty from cmd has the same issue as mintty had, when invoked
from bash (has been fixed after patch_319 had been applied by you).

Henri

=====


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