This is the mail archive of the cygwin@cygwin.com 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]

Cygwin strange behavior report


Hi all,

   its been a long time that I use cygwin tools really 
regularly, and it does work quite well, thanks for all.

   I am still bothered by a little detail that I finally tried to investigate a little further.

   Since a long time, I noticed that my 
bash did not handle Ctrl-C events (generated by pressing Ctrl and C keys)
in the usual configuration where I used it.
  As most users did not seem to have this problem, it must have been
something special on my configuration and this is 
indeed the case:
   - I use cygwin under another account (with windows runas.exe application).

With that configuration, Ctrl-C does never generate any 
signal, in any of the cygwin applications I tried.
If Ctrl-C is pressed at bash prompt,
bash does not go to a new line.

If I run the cygwin.bat from my normal account all works correctly.
Bash goes to a new line if I press Ctrl-C on bash prompt.
The same difference is can be noted for any cygwin tool.

Moreover if I use a shortcut with
cmd  /c 'c:\cygin\cygwin.bat'
I can check the box 'Run as a different user' (not sure of the exact english box name,
as I have a french localized version)
With the box checked, I get a prompt for another user account,
and if I enter the same account and password, I still get that Ctrl-C does not
operate.
Disabling this check box makes the Ctrl-C behave correctly again.

   Having this now clarified, I ried to go a little further and 
looked into the way cygin works (ot see if there are any differences)
so I tried the following
strace -o logfile -m 0x800 bash
0x800 is signal processing
Inside bash I simply tried to press ctrl-C once and entered exit after it.

I did this with and without changing user and tried to compare the logs.

To be able to compare the logs a little easier, I had to get rid of the 
constants that where different, so I used :
$ sed -e 's/ *[0-9]* *[0-9]* *\(\[[a-zA-Z0-9() ]*\]\) *\([a-zA-Z]*\) *[0-9]*/\1
  \2/' strace.log > strace.log2
I did that for both log files and did a diff -b -c afterwards:

I did notice that the order of apparence of the debug 
strings is different in the two versions, which seems to indicate that the
signal specific thread does make some more
function calls before some main thread calls,
but I was unable to really understand if this startup 
difference could explain the later different handling of 
the Ctrl-C press.

  I am willing to help more, but I am still far from understand the internals 
of the cygwin dll code which seem to be quite subttle
in several points.


$ cat strace.dif.adm.logadm
*** strace.adm2 Fri Feb 22 15:42:58 2002
--- strace.logadm2      Fri Feb 22 15:31:00 2002
***************
*** 1,12 ****
! [unknown (0x868)] bash wait_sig: sigcatch_nonmain 0xD8, sigcatch_main 0xE8
! [unknown (0x868)] bash wait_sig: Ready.  dwProcessid 2096
! [main] bash sigproc_init: process/signal handling enabled(41)
! [main] bash sig_send: pid 2096, signal -2, its_me 1
   [sig] bash wait_sig: awake
   [sig] bash wait_sig: processing signal -2
   [sig] bash wait_sig: set main thread completion event
   [sig] bash wait_sig: looping
! [main] bash sig_send: Waiting for thiscomplete 0xEC
   [main] bash sig_send: returning 0 from sending signal -2
   [main] bash sigaction: signal 20, newact 0x22FD04, oldact 0x22FCF4
   [main] bash sigaction: signal 20, newact 0x22FCF4, oldact 0x22FCE4
--- 1,12 ----
! [main] bash sigproc_init: process/signal handling enabled(1)
! [sig] bash wait_sig: sigcatch_nonmain 0xF4, sigcatch_main 0xD4
! [sig] bash wait_sig: Ready.  dwProcessid 1044
! [main] bash sig_send: pid 1044, signal -2, its_me 1
   [sig] bash wait_sig: awake
   [sig] bash wait_sig: processing signal -2
   [sig] bash wait_sig: set main thread completion event
   [sig] bash wait_sig: looping
! [main] bash sig_send: Waiting for thiscomplete 0xF8
   [main] bash sig_send: returning 0 from sending signal -2
   [main] bash sigaction: signal 20, newact 0x22FD04, oldact 0x22FCF4
   [main] bash sigaction: signal 20, newact 0x22FCF4, oldact 0x22FCE4
***************
*** 62,71 ****
   [main] bash sigaction: signal 21, newact 0x22F434, oldact 0x22F444
   [main] bash sigaction: signal 21, newact 0x478590, oldact 0x22F494
   [main] bash sigaction: signal 28, newact 0x22F434, oldact 0x22F444
! [unknown (0x700)] bash kill_pgrp: pid 2096, signal 2
! [unknown (0x700)] bash kill_pgrp: killing pid 2096, pgrp 2096, p->ctty 1073741
824, myself->ctty 1073741824
! [unknown (0x700)] bash sig_send: pid 2096, signal 2, its_me 1
! [unknown (0x700)] bash sig_send: Waiting for thiscomplete 0xF0
   [sig] bash wait_sig: awake
   [sig] bash wait_sig: processing signal 2
   [sig] bash wait_sig: Got signal 2
--- 62,71 ----
   [main] bash sigaction: signal 21, newact 0x22F434, oldact 0x22F444
   [main] bash sigaction: signal 21, newact 0x478590, oldact 0x22F494
   [main] bash sigaction: signal 28, newact 0x22F434, oldact 0x22F444
! [unknown (0x8D4)] bash kill_pgrp: pid 1044, signal 2
! [unknown (0x8D4)] bash kill_pgrp: killing pid 1044, pgrp 1044, p->ctty 1073741
824, myself->ctty 1073741824
! [unknown (0x8D4)] bash sig_send: pid 1044, signal 2, its_me 1
! [unknown (0x8D4)] bash sig_send: Waiting for thiscomplete 0xE0
   [sig] bash wait_sig: awake
   [sig] bash wait_sig: processing signal 2
   [sig] bash wait_sig: Got signal 2
***************
*** 77,96 ****
   [sig] bash proc_subproc: clear waiting threads
   [sig] bash proc_subproc: finished clearing
   [sig] bash proc_subproc: returning 1
! [sig] bash interrupt_setup: armed signal_arrived 0xC4, res 1
   [sig] bash setup_handler: good.  Didn't suspend main thread, th 0x610A4420
- [sig] bash setup_handler: returning 1
- [sig] bash sig_handle: returning 1
- [unknown (0x700)] bash sig_send: returning 0 from sending signal 2
   [main] bash call_signal_handler_now: sa_flags 0x0
   [main] bash reset_signal_arrived: reset signal_arrived
   [main] bash set_process_mask: old mask = 0, new mask = 2
   [main] bash set_process_mask: old mask = 2, new mask = 2
! [main] bash set_process_mask: not calling sig_dispatch_pending.  sigtid 0x868
current 0x494
   [main] bash set_process_mask: old mask = 2, new mask = 2
! [main] bash set_process_mask: not calling sig_dispatch_pending.  sigtid 0x868
current 0x494
   [main] bash sigaction: signal 2, newact 0x478530, oldact 0x22F2F4
- [sig] bash wait_sig: looping
   [main] bash sigaction: signal 15, newact 0x478540, oldact 0x22F2F4
   [main] bash sigaction: signal 3, newact 0x478560, oldact 0x22F2F4
   [main] bash sigaction: signal 14, newact 0x478550, oldact 0x22F2F4
--- 77,101 ----
   [sig] bash proc_subproc: clear waiting threads
   [sig] bash proc_subproc: finished clearing
   [sig] bash proc_subproc: returning 1
! [sig] bash interrupt_setup: armed signal_arrived 0xDC, res 1
   [sig] bash setup_handler: good.  Didn't suspend main thread, th 0x610A4420
   [main] bash call_signal_handler_now: sa_flags 0x0
   [main] bash reset_signal_arrived: reset signal_arrived
   [main] bash set_process_mask: old mask = 0, new mask = 2
+ [main] bash sig_send: pid 1044, signal -2, its_me 1
+ [main] bash sig_send: Waiting for thiscomplete 0xF8
+ [sig] bash setup_handler: returning 1
+ [sig] bash sig_handle: returning 1
+ [unknown (0x8D4)] bash sig_send: returning 0 from sending signal 2
+ [sig] bash wait_sig: looping
+ [sig] bash wait_sig: awake
+ [sig] bash wait_sig: processing signal -2
+ [main] bash sig_send: returning 0 from sending signal -2
   [main] bash set_process_mask: old mask = 2, new mask = 2
! [main] bash set_process_mask: not calling sig_dispatch_pending.  sigtid 0x388
current 0x828
   [main] bash set_process_mask: old mask = 2, new mask = 2
! [main] bash set_process_mask: not calling sig_dispatch_pending.  sigtid 0x388
current 0x828
   [main] bash sigaction: signal 2, newact 0x478530, oldact 0x22F2F4
   [main] bash sigaction: signal 15, newact 0x478540, oldact 0x22F2F4
   [main] bash sigaction: signal 3, newact 0x478560, oldact 0x22F2F4
   [main] bash sigaction: signal 14, newact 0x478550, oldact 0x22F2F4
***************
*** 98,112 ****
   [main] bash sigaction: signal 22, newact 0x478580, oldact 0x22F2F4
   [main] bash sigaction: signal 21, newact 0x478590, oldact 0x22F2F4
   [main] bash sigaction: signal 28, newact 0x4785A0, oldact 0x22F2F4
! [main] bash sig_send: pid 2096, signal 2, its_me 1
! [sig] bash wait_sig: awake
! [sig] bash wait_sig: signal 2 blocked
   [sig] bash wait_sig: set main thread completion event
   [sig] bash wait_sig: looping
! [main] bash sig_send: Waiting for thiscomplete 0xEC
   [main] bash sig_send: returning 0 from sending signal 2
   [main] bash set_process_mask: old mask = 2, new mask = 0
! [main] bash sig_send: pid 2096, signal -2, its_me 1
   [sig] bash wait_sig: awake
   [sig] bash wait_sig: processing signal -2
   [sig] bash wait_sig: processing signal 2
--- 103,120 ----
   [main] bash sigaction: signal 22, newact 0x478580, oldact 0x22F2F4
   [main] bash sigaction: signal 21, newact 0x478590, oldact 0x22F2F4
   [main] bash sigaction: signal 28, newact 0x4785A0, oldact 0x22F2F4
! [main] bash sig_send: pid 1044, signal 2, its_me 1
! [main] bash sig_send: Waiting for thiscomplete 0xF8
   [sig] bash wait_sig: set main thread completion event
   [sig] bash wait_sig: looping
! [sig] bash wait_sig: awake
! [sig] bash wait_sig: signal 2 blocked
   [main] bash sig_send: returning 0 from sending signal 2
   [main] bash set_process_mask: old mask = 2, new mask = 0
! [main] bash sig_send: pid 1044, signal -2, its_me 1
! [main] bash sig_send: Waiting for thiscomplete 0xF8
! [sig] bash wait_sig: set main thread completion event
! [sig] bash wait_sig: looping
   [sig] bash wait_sig: awake
   [sig] bash wait_sig: processing signal -2
   [sig] bash wait_sig: processing signal 2
***************
*** 120,132 ****
   [sig] bash proc_subproc: clear waiting threads
   [sig] bash proc_subproc: finished clearing
   [sig] bash proc_subproc: returning 1
! [sig] bash interrupt_setup: armed signal_arrived 0xC4, res 1
   [sig] bash setup_handler: good.  Didn't suspend main thread, th 0x610A4420
   [sig] bash setup_handler: returning 1
   [sig] bash sig_handle: returning 1
- [sig] bash wait_sig: set main thread completion event
- [sig] bash wait_sig: looping
- [main] bash sig_send: Waiting for thiscomplete 0xEC
   [main] bash sig_send: returning 0 from sending signal -2
   [main] bash reset_signal_arrived: reset signal_arrived
   [main] bash set_process_mask: old mask = 0, new mask = 2
--- 128,137 ----
   [sig] bash proc_subproc: clear waiting threads
   [sig] bash proc_subproc: finished clearing
   [sig] bash proc_subproc: returning 1
! [sig] bash interrupt_setup: armed signal_arrived 0xDC, res 1
   [sig] bash setup_handler: good.  Didn't suspend main thread, th 0x610A4420
   [sig] bash setup_handler: returning 1
   [sig] bash sig_handle: returning 1
   [main] bash sig_send: returning 0 from sending signal -2
   [main] bash reset_signal_arrived: reset signal_arrived
   [main] bash set_process_mask: old mask = 0, new mask = 2
***************
*** 134,142 ****
   [main] bash set_process_mask: old mask = 3A0002, new mask = 2
   [main] bash set_process_mask: old mask = 2, new mask = 0
   [main] bash set_process_mask: old mask = 0, new mask = 0
! [main] bash set_process_mask: not calling sig_dispatch_pending.  sigtid 0x868
current 0x494
   [main] bash sigaction: signal 2, newact 0x22FE14, oldact 0x22FE04
   [main] bash sigaction: signal 2, newact 0x22FE14, oldact 0x22FE04
   [main] bash set_process_mask: old mask = 0, new mask = 3A0000
   [main] bash set_process_mask: old mask = 3A0000, new mask = 0
   [main] bash sigaction: signal 2, newact 0x22F4F4, oldact 0x22F4E4
--- 139,149 ----
   [main] bash set_process_mask: old mask = 3A0002, new mask = 2
   [main] bash set_process_mask: old mask = 2, new mask = 0
   [main] bash set_process_mask: old mask = 0, new mask = 0
! [main] bash set_process_mask: not calling sig_dispatch_pending.  sigtid 0x388
current 0x828
   [main] bash sigaction: signal 2, newact 0x22FE14, oldact 0x22FE04
   [main] bash sigaction: signal 2, newact 0x22FE14, oldact 0x22FE04
+ [sig] bash wait_sig: set main thread completion event
+ [sig] bash wait_sig: looping
   [main] bash set_process_mask: old mask = 0, new mask = 3A0000
   [main] bash set_process_mask: old mask = 3A0000, new mask = 0
   [main] bash sigaction: signal 2, newact 0x22F4F4, oldact 0x22F4E4
***************
*** 167,173 ****
   [main] bash sigaction: signal 28, newact 0x4785A0, oldact 0x22F4D4
   [main] bash sigaction: signal 2, newact 0x22F4F4, oldact 0x22F4E4
   [main] bash set_process_mask: old mask = 0, new mask = 0
! [main] bash set_process_mask: not calling sig_dispatch_pending.  sigtid 0x868
current 0x494
   [main] bash sigaction: signal 2, newact 0x22FE14, oldact 0x22FE04
   [main] bash set_process_mask: old mask = 0, new mask = 3A0000
   [main] bash set_process_mask: old mask = 3A0000, new mask = 0
--- 174,180 ----
   [main] bash sigaction: signal 28, newact 0x4785A0, oldact 0x22F4D4
   [main] bash sigaction: signal 2, newact 0x22F4F4, oldact 0x22F4E4
   [main] bash set_process_mask: old mask = 0, new mask = 0
! [main] bash set_process_mask: not calling sig_dispatch_pending.  sigtid 0x388
current 0x828
   [main] bash sigaction: signal 2, newact 0x22FE14, oldact 0x22FE04
   [main] bash set_process_mask: old mask = 0, new mask = 3A0000
   [main] bash set_process_mask: old mask = 3A0000, new mask = 0


   




Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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