delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/20/01:14:30

Message-ID: <38FE9301.1F19085E@unb.ca>
From: Endlisnis <s257m AT unb DOT ca>
X-Mailer: Mozilla 4.7 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: [Fwd: DJGPP and Win2K]
References: <38FE1354 DOT DCA13ACD AT americasm01 DOT nt DOT com>
Lines: 92
Date: Thu, 20 Apr 2000 05:15:58 GMT
NNTP-Posting-Host: 24.114.6.233
X-Complaints-To: abuse AT home DOT net
X-Trace: news1.rdc1.on.wave.home.com 956207758 24.114.6.233 (Wed, 19 Apr 2000 22:15:58 PDT)
NNTP-Posting-Date: Wed, 19 Apr 2000 22:15:58 PDT
Organization: @Home Network Canada
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Rolf Campbell wrote:

> > This is my best educated guess right now:
> >
> > If we have 2 djgpp programs, called 'a' and 'b'.  And we invoke 'a', and
> > then 'a' runs 'b', than 'a' terminates itself, the crash will occur after
> > 'a' has terminated AND there is any sort of keyboard activity (press or
> > release of any key, including things like 'alt' and 'shift').
>
> But the test with Bash running from Make involved 3 programs, right?
> So it's actually `a' runs `b' which runs `c', and the crash is when
> `b' exits, as far as I understand.

I realized that it has nothing to do with execution depth.  It is exclusively an
keypress on exit problem.  I wrote a simple test program (actually  Christian Domp
<Christian DOT Domp AT gmx DOT net> wrote it, but I modified it significantly).  I've included
the source at the end.  All it does it run itself to an arbitrary recursion depth,
using spawn.  This works up to about 27 in Win98, but it only fails because of lack
of DOS memory available (and doesn't crash the VM).  It also works fine under
Win2000 (up to about 30 levels), and does not crash on any of the exits.  It ONLY
crashes the VM if keyboard activity occurs during the actual end of a program
(during the small period of time between program running and program not running).
It runs fine if a key is pressed and released during the program, and then no other
keys are pressed when the program exits.

> Does it crash if Make runs Bash, but Bash does not run any other
> programs?

Only if keys are pressed when either one of the programs exit.  I think most of the
problems have been because people release the enter key (after typing 'make') when
some program is exiting, and that's what is causing the crash.  Or in RHIDE, they
release the 'F9' key at some bad time.

***
I suggest to all of the Win2000-RHIDE people, try running compile from the menu with
the mouse, I think this will stop the crashes.
***

> As for the keyboard activity: does it matter when do you press the
> keys?  For example, you could press them before `ls' is run from Bash,
> during the time `ls' runs (make it list a large directory, to make
> that time more than a split second), or after `ls' exits.

You must have keyboard activity during the ending of the program, that is the only
way to crash it.

> > I'll run some tests to try to confirm this hypothesis of mine when I get
> > home and post the results here.
> One thing that would be interesting to know is where exactly during
> the exit code does it crash.  You could test this with a simple
> program used instead of Bash in the same scenario where Bash causes a
> crash (I'm assuming that Bash is not special here).  That test program
> could be instrumented to print messages telling where it is in the
> exit code (for that, you might need to pull a few library modules,
> such as crt1.c and dpmiexcp.c, modify them, and paste them into your
> program).
> Thanks again for working on this.

No problem.  I'll look into the exit code after Easter holidays.

--
     (\/) Endlisnis (\/)
          s257m AT unb DOT ca
          Endlisnis AT HotMail DOT com
          ICQ: 32959047

----------------------
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <assert.h>

int main(int argc, char *argv[])
{
  int left;
  char leftStr[11];

  if(argc==1) left=10;
  else left = atol(argv[1]);

  printf("begin %d\n", left);
  if(left>1) {
    printf("spawning %d\n", left-1);
    sprintf(leftStr, "%d", left-1);
    assert(-1 != spawnl(P_WAIT, argv[0], argv[0], leftStr, NULL));
    printf("returned %d\n", left-1);
    }
  printf("returning... %d\n", left);
  return 0;
  }


- Raw text -


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