public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: Ctrl-C crashes bash
@ 1997-03-10  1:14 Valery Fine
  1997-03-10  8:27 ` Jim Balter
  0 siblings, 1 reply; 5+ messages in thread
From: Valery Fine @ 1997-03-10  1:14 UTC (permalink / raw)
  To: gnu-win32; +Cc: sos, reese, sam

On  9 Mar 97 at 12:49, Sergey Okhapkin wrote:

> Samuel Tardieu wrote:
> > 
> > Bob> a. Does anybody else have the problem that using control-C to
> > Bob> terminate a running program crashes bash?
> > 
> > This problem occured for me under Win95 but doesn't seem to show
> > up under WinNT.
> > 
> 
> On Windows NT 4.0 too...
> 


  It was posted several times to this list but so far no reply seen.
                                                      
  The problem is (according Microsoft):

" ....
Note  SIGINT is not supported for any Win32 application including
Windows NT and Windows 95. When a CTRL+C interrupt occurs, Win32
operating systems generate a new thread to specifically handle that
interrupt. This can cause a single-thread application such as UNIX, to
become multithreaded, resulting in unexpected behavior. 
                      ================================ !!!!
  .... "

  The worst thing is (by Microsoft again):

" TerminateThread is a dangerous function that should only be used in 
the most extreme cases".


  One workaround for this is present with "Microsoft System 
Journal", March, 96. (See source code on Web http://www.msj.com )

          Valery






=================================================================
Dr. Valery Fine                  Telex : 911621 dubna su
    -----------
LCTA/Joint Inst.for NuclearRes   Phone : +7 09621 6 40 80
141980 Dubna, Moscow region      Fax   : +7 09621 6 51 45
Russia                           mailto:fine@main1.jinr.dubna.su
                                 mailto:fine@vxcern.cern.ch
Dr. Valeri Faine
    ------------                 Phone: +41 22 767 6468
CERN                             FAX  : +41 22 782 2601
CH-1211 Geneva, 23               mailto:fine@vxcern.cern.ch 
Switzerland                      http://nicewww.cern.ch/~fine
                                 
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Ctrl-C crashes bash
  1997-03-10  1:14 Ctrl-C crashes bash Valery Fine
@ 1997-03-10  8:27 ` Jim Balter
  0 siblings, 0 replies; 5+ messages in thread
From: Jim Balter @ 1997-03-10  8:27 UTC (permalink / raw)
  To: Valery Fine; +Cc: gnu-win32

Valery Fine wrote:
> 
> On  9 Mar 97 at 12:49, Sergey Okhapkin wrote:
> 
> > Samuel Tardieu wrote:
> > >
> > > Bob> a. Does anybody else have the problem that using control-C to
> > > Bob> terminate a running program crashes bash?
> > >
> > > This problem occured for me under Win95 but doesn't seem to show
> > > up under WinNT.
> > >
> >
> > On Windows NT 4.0 too...
> >
> 
>   It was posted several times to this list but so far no reply seen.
> 
>   The problem is (according Microsoft):
> 
> " ....
> Note  SIGINT is not supported for any Win32 application including
> Windows NT and Windows 95. When a CTRL+C interrupt occurs, Win32
> operating systems generate a new thread to specifically handle that
> interrupt. This can cause a single-thread application such as UNIX, to
> become multithreaded, resulting in unexpected behavior.
>                       ================================ !!!!
>   .... "

cygwin goes to some effort to change the original thread to run your
SIGINT handler (that you have set via signal()) rather than naively
running it from the SetConsoleCtrlHandler HandlerRoutine (namely,
exceptions.cc:ctrl_c_handler), so it wouldn't seem to be subject
to this multithreading problem.  I don't know what's causing the
bash problem, though it is quite possible that bash isn't expecting
a crtl-C because it is reading from the terminal in raw mode.

I do note that programs that *haven't* set a SIGINT handler often crash
upon ctrl-C.  The most obvious problem is

  if ((void *)u->self->sigs[sig].sa_handler == (void *)SIG_DFL)
    {
      /* We encode the signal stuff in the high 8 bits.
	 (sorta like the reverse of a standard wait)
	 This is so that ordinary dos progs can look at our
	 exit value. */
      /* FIXME: exit calls atexit handlers.  */
      exit ((sig<<8) | 0x10000);
    }

That exit call is utterly wrong, and apparently someone at cygwin knew
it.  It will flush stdio streams, which could crash if the process is in
the middle of a stdio call, which it usually is when you hit ctrl-c.
Simply changing it to _exit, as it should be, would probably go a long
ways, but still wouldn't quite be enough because the code that _exit
calls is not thread-safe; the process could be in the middle closing a
file or even in _exit (but that's a lot less likely than being in
stdio).  Of course, the whole of cygwin needs to be made thread-safe if
anyone is going to be able to use it with multi-threaded apps.

--
<J Q B>
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Ctrl-C crashes bash
@ 1997-03-09  1:48 Sergey Okhapkin
  0 siblings, 0 replies; 5+ messages in thread
From: Sergey Okhapkin @ 1997-03-09  1:48 UTC (permalink / raw)
  To: Bob Reese, 'Samuel Tardieu'; +Cc: gnu-win32

Samuel Tardieu wrote:
> 
> Bob> a. Does anybody else have the problem that using control-C to
> Bob> terminate a running program crashes bash?
> 
> This problem occured for me under Win95 but doesn't seem to show up under
> WinNT.
> 

On Windows NT 4.0 too...

-- 
Sergey Okhapkin
Moscow, Russia
Looking for a job

-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Ctrl-C crashes bash
  1997-03-07 21:03 Bob Reese
@ 1997-03-08 10:16 ` Samuel Tardieu
  0 siblings, 0 replies; 5+ messages in thread
From: Samuel Tardieu @ 1997-03-08 10:16 UTC (permalink / raw)
  To: Bob Reese; +Cc: gnu-win32

>>>>> "Bob" == Bob Reese <reese@erc.msstate.edu> writes:

Bob> a. Does anybody else have the problem that using control-C to
Bob> terminate a running program crashes bash?

This problem occured for me under Win95 but doesn't seem to show up under
WinNT.

  Sam
--
Samuel Tardieu -- sam@inf.enst.fr

-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Ctrl-C crashes bash
@ 1997-03-07 21:03 Bob Reese
  1997-03-08 10:16 ` Samuel Tardieu
  0 siblings, 1 reply; 5+ messages in thread
From: Bob Reese @ 1997-03-07 21:03 UTC (permalink / raw)
  To: gnu-win32; +Cc: reese

Under Win95, latest distribution (17.?) from Cygnus:

a. Does anybody else have the problem that using
control-C to terminate  a running program crashes bash?

b. Does anybody have a fix for bash filename completion
so that it works past the first directory name?

c. The 'conagent.exe' terminal window (command prompt window)
 which bash is forced to use is terrible; 
no scroll bars, max 50 lines, limited resizing. 
Are there any alternatives?

Thanks for any pointers, 

 Bob 

-- 
----------------------------------------------------------------
Bob Reese                                601/325-3670 (voice)
reese@erc.msstate.edu                    601/325-7692 (fax)
Microsystems Prototyping Laboratory, MSU/NSF Engr. Research Ctr.
http://www.erc.msstate.edu/mpl
Associate Prof/Electrical & Computer Engineering
Mississippi State University      
US Mail Address:
 Engr Research Center, Box 9627, Mississippi State, MS 39762
Street Address:
 2 Research Boulevard, Starkville, MS 39759
----------------------------------------------------------------


-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-03-10  8:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-10  1:14 Ctrl-C crashes bash Valery Fine
1997-03-10  8:27 ` Jim Balter
  -- strict thread matches above, loose matches on Subject: below --
1997-03-09  1:48 Sergey Okhapkin
1997-03-07 21:03 Bob Reese
1997-03-08 10:16 ` Samuel Tardieu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).