Subject: Control-key command inconsistencies--was Confirm or deny.
From: L Anderson <[email-masked]>
To: cygwinList <[email-masked]>
Date: Mon, 29 Jan 2001 15:58:17 -0800

I did a clean install on Win98SE of cygwin on Jan 24; so I'm running
about the latest version.  In trying to understand the differences in
control-key command behavior between Dos/Win98 and cygwin I ran into a
problem.

Recent communication with the cygwin.com list confirms the cygwin
binaries should run under either a cygwin shell (bash) or a Dos shell
(command.com) with the attendant appropriate behavior.  However, in the
tests I did, there appear to be a few problems.

To test the control-key commands, I used just console input on four
programs: md5sum, cksum, cat, and perl.  Under both the cygwin window
(bash) and Dos window (command.com), ctrl-d and ctrl-c behave the same
for all programs, as I expected.  However, under both shells, ctrl-z
behaves differently and depends on the program, which I partially
expect.  The programs' behavior in cygwin's window may be correct but
surprised me, perhaps, due to my lack of proficiency with Unix. 
However, the programs' behavior in Dos's window, while consistent,
appears to be a bug--the Dos window died.

Under the cygwin window
=======================
In the cygwin window, the following can be observed for ctrl-z where the
garbage strings, e.g. jhgajga, are my console inputs.  In the interest
of bandwidth, I left out cksum and cat since they behave the same as
md5sum:

Checking with md5sum (cksum, cat the same)
------------------------------------------
$ md5sum
jhsgjgs
sjkhgsjg
<------------ctrl-z entered here
[1]+  Stopped                 md5sum

$ fg
md5sum
jhjsg
<------------ctrl-d entered here
md5sum: -: Interrupted system call

$

Checking with perl
------------------
$ perl
jhsjg
kjhskjgs
<------------ctrl-z entered here
[1]+  Stopped                 perl

$ fg
perl
Can't locate object method "jhsjg" via package "kjhskjgs" (perhaps you
forgot to
 load "kjhskjgs"?) at - line 1.

$

Comments re the cygwin window
-----------------------------
I assumed that ctrl-z would suspend the program, an fg would resume it
as if nothing had happened, and a subsequent ctrl-d, following more
input, would complete that input and the program would finish
normally--not so.  In the case of md5sum (cksum and cat), the message 
"-: Interrupted system call" was received after the ctrl-d then the
program terminate.  However, for perl the program executed and then
terminated after the fg.  Two different program specific behaviors.  Is
my assumption wrong, are things as they should be(really program
defined), or is there a bug?  I don't know.

Under the Dos window
====================

The Dos window died after I initiated the program, entered console
input, and then entered a ctrl-z.  I.E., the window stopped accepting
input.  I could only close the window from Win98 to clean things up.  I
assume this is a bug.

For md5sum, it looked like this:

C:\
->md5sum
gsjkhgsj
sjhgsj
     <==========ctrl-z entered here.  The Dos window died

Comments re the Dos window (and cygwin)
--------------------------------------

Nominally, there are conflicts between Dos and cygwin(and Unix) in the
use of control-key commands.  For the three I looked at, the use is as
follows:

ctrl  Dos                       cygwin                    Comments

-c    Kill foreground process   Kill foreground process   Same syntax &
semantics

-d    Not used (???)            Signal end of input       Couldn't find
any Dos use

-z    Signal end of input(eof)  Suspend program           Same syntax,
different semantics

The question is, should cygwin utilities behave Dosishly in a Dos shell,
Unixishly in a Dos shell, or a bit of both?  Right now, under some
conditions, they appear to behave "badishly" in a Dos shell. :-) 
Obviously, any number of design choices is available.   Personally, I
don't care what is done except definitely not a mixture of both and
"hang".  In any case, I assume the problem is in cygwin1.dll and at this
point in my cygwin career I don't think you'd want my patches so don't
suggest. :-)

Aside form doing nothing, several options under the Dos shell comes to
mind:

1. ctrl-c: kill process(no change), ctrl-d: end of input, ctrl-z: exit
to Dos shell(call command.com again), and change fg to issue an exit. 
Either an exit or fg would then be needed to resume the prior task. This
is almost Unixish in a Dosishly sort of way.

2. ctrl-c: kill process(no change), ctrl-d: end of input, ctrl-z: nop. 
This is a Unixish subset.

3. ctrl-c: kill process(no change), ctrl-z: end of input, ctrl-d: nop. 
This is very Doshish.

I'm submitting this not because it has great priority or significance
but only to document the problem/inconsistency should someone choose to
fix it.  Maybe someday I'll be so blessed at to be able to fix these
things. :-)

Regards,

Lowell Anderson

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple