This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ANNOUNCEMENT] Update: mintty 2.1.2

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

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

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");

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

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]