Re: Cygwin patches for 2002e

2003-10-22 Thread Mark Crispin
On Wed, 22 Oct 2003, Eduardo Chappa wrote:
 There is no
 way I can predict what a user will do when using Pine, and you must know
 very well that ignoring a possible case is one of the main reasons why
 users report bugs, so I would like to offer a full featured (or as much
 complete as possible)  software for people in Cygwin. This means that if
 they want simultaneous access to a mailbox, they'll need to get it if the
 format of the mailbox allows it.

Once again...

Simultaneous access in the mbx format requires meaningful file locking.

There is no such thing as meaningful file locking in Windows 98.  Windows
98 is not a real operating system.  Nor are Windows 95, Windows Me,
Windows 3.1, MS-DOS, Mac OS 9 (and earlier), etc.

If you wish to have real operating system services, then you must run a
real operating system.  Windows NT, 2000, and XP are real operating
systems.  UNIX and its variants are real operating systems.  Mac OS X is a
real operating system.

Cygwin is not a real operating system either.  It is one of long series of
similar products (e.g. Yale Tools, Mint, MachTen, MKS Toolkit) which
provide UNIX-like library calls and compiler semantics on a different
operating system (in this case, Windows).  However, like all these other
products, it is (and always will be) an incomplete compromise.  In some
cases, it will provide the service by translating the call to a similar
call on the host operating system.  In other cases, it must implement that
service as best it can within its own environment.  And in still other
cases, it has to punt and provide methods into the host environment (such
as the interface into the Windows concepts of logon and impersonate).

Cygwin apparently implements fcntl() locking via the Windows LockFileEx()
call.  This implementation is *NOT* correct for UNIX, but it is close.
One of these implementation bugs is a good thing, the other is not; hence
the special handling required for Cygwin.

LockFileEx() does not exist on the MS-DOS based versions of Windows (3.1,
95, 98, Me).  If you use one of those systems, you have to live with the
fact that you don't have meaningful locking.  Life is tough.

 I see no reason why PC-Pine and Cygwin
 Pine could not be exchanged one for the other.

Any favorable interaction between PC Pine and a UNIX Pine built under
Cygwin is completely coincidental and is not (nor ever will be)
guaranteed.

This is the price that you pay for using a kludge that hacks one operating
system's semantics on top of another.  They may be extremely useful
kludges, but they are (and always will be) limited.  Most people who use
such things understand these limitations.

On top of that, you are expecting services out of the MS-DOS versions of
Windows that do not exist.

   I believe it's a priority to offer access to mbx folders to any user of
 Pine/imapd/popXd, for any version of Windows, and that's the trick that
 must be done.

It may be a priority for you.  It is not for me; and quite frankly it is a
pipe-dream.  The MS-DOS versions of Windows do not have the capabilities
necessary to performs mbx-style shared access.  The MS-DOS versions of
Windows are dead products, and never will have those capabilities.

Nor do I want to waste much more of my time having to explain this to you.

   So my question still stands, does this patch work for Windowx 9X?, can
 anyone confirm or deny this?

The question is meaningless.  There is no works for Windows 9x in the
sense of operates with the full functionality of modern systems.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.


Re: Cygwin patches for 2002e

2003-10-22 Thread Gregory Hicks
Eduardo:

I think what Mark was saying was that simultaneous access to an mbx
mailbox from various incarnations of pine MAY not work correctly under
an MS-DOS implementation of windows.

If only one incarnation of pine is running, the mbx SHOULD be readable.

If your users *insist* on running two or more incarnations of pine to
access the same mailbox, the results probably will be unpredictable.

Regards,
Gregory Hicks

 Date: Wed, 22 Oct 2003 10:52:22 -0700 (PDT)
 From: Eduardo Chappa [EMAIL PROTECTED]
 To: Mark Crispin [EMAIL PROTECTED]
 Cc: Abe Backus [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: Re: Cygwin patches for 2002e
 
 *** Mark Crispin ([EMAIL PROTECTED]) wrote today:
 
 :) On Wed, 22 Oct 2003, Eduardo Chappa wrote:
 :)  There is no way I can predict what a user will do when using Pine,
 :)  and you must know very well that ignoring a possible case is one of
 :)  the main reasons why users report bugs, so I would like to offer a
 :)  full featured (or as much complete as possible)  software for people
 :)  in Cygwin. This means that if they want simultaneous access to a
 :)  mailbox, they'll need to get it if the format of the mailbox allows
 :)  it.
 :)
 :) Once again...
 :)
 :) Simultaneous access in the mbx format requires meaningful file locking.
 :)
 :) There is no such thing as meaningful file locking in Windows 98.
 :) Windows 98 is not a real operating system.  Nor are Windows 95, Windows
 :) Me, Windows 3.1, MS-DOS, Mac OS 9 (and earlier), etc.
 
 Mark,
 
   Does this mean that the changes that you are accepting into C-client
 will make Pine not work in Windows 9X when using mbx style folders?. I
 believe you are trying to say that, but it is not completely clear. Your
 answer is about locking, not about mbx style folders. I just want to be
 sure that the answer to my question is yes. Can you confirm or deny this,
 please?
 
 Thanks. Have a nice day.
 
 Eduardo
 http://www.math.washington.edu/~chappa/pine/

---
Gregory Hicks| Principal Systems Engineer
Cadence Design Systems   | Direct:   408.576.3609
555 River Oaks Pkwy M/S 6B1  | Fax:  408.894.3400
San Jose, CA 95134   | Internet: [EMAIL PROTECTED]

The trouble with doing anything right the first time is that nobody
appreciates how difficult it was.

When a team of dedicated individuals makes a commitment to act as
one...  the sky's the limit.

Just because We've always done it that way is not necessarily a good
reason to continue to do so...  Grace Hopper, Rear Admiral, United
States Navy



Re: Cygwin patches for 2002e

2003-10-22 Thread Eduardo Chappa
*** Gregory Hicks ([EMAIL PROTECTED]) wrote today:

:) I think what Mark was saying was that simultaneous access to an mbx
:) mailbox from various incarnations of pine MAY not work correctly under
:) an MS-DOS implementation of windows.
:)
:) If only one incarnation of pine is running, the mbx SHOULD be readable.
:)
:) If your users *insist* on running two or more incarnations of pine to
:) access the same mailbox, the results probably will be unpredictable.

Dear Gregory,

  Thank you for clarifying Mark's message. So the answer translated to my
mind is no it will not work. Too bad. Hopefully it will not be a problem.

  Thank you!

Eduardo
http://www.math.washington.edu/~chappa/pine/


Re: Cygwin patches for 2002e

2003-10-22 Thread Brad Arlt
On Wed, Oct 22, 2003 at 10:52:22AM -0700, Eduardo Chappa wrote:
 *** Mark Crispin ([EMAIL PROTECTED]) wrote today:
 :) Once again...
 :)
 :) Simultaneous access in the mbx format requires meaningful file locking.
 :)
 :) There is no such thing as meaningful file locking in Windows 98.
 :) Windows 98 is not a real operating system.  Nor are Windows 95, Windows
 :) Me, Windows 3.1, MS-DOS, Mac OS 9 (and earlier), etc.
 
 Mark,
 
   Does this mean that the changes that you are accepting into C-client
 will make Pine not work in Windows 9X when using mbx style folders?. I
 believe you are trying to say that, but it is not completely clear. Your
 answer is about locking, not about mbx style folders. I just want to be
 sure that the answer to my question is yes. Can you confirm or deny this,
 please?

I'll take a stab at this...

mbx needs file locking if it has any hope of mailbox integrity
if there is concurrent access - like email delivery or the mailbox
being open in two processes.

If you don't have real file locking, you can't use mbx.

There is a nice long rant/documentation on locking in the UW-imap
distro (so I presume it is in the Pine distro as well) in
docs/locking.txt

So to spell it out for you:

Windows Me/98/95/3.11/3.1/3.0, MacOS 9, and MS-DOS cannot use mbx
format without great risk of data corruption.  It may be you *can*
use mbx, but you shouldn't.

I have a feeling that the Unix mailbox format will work better for you
under these OSes.

Using Windows 2000/XP/2003 will allow you to use both Windows *and*
mbx in without these problems.
---
   __o  Bradley ArltSecurity Team Lead
 _ \_  [EMAIL PROTECTED]   University Of Calgary
(_)/(_) Joyously Canadian   Computer Science


Re: Cygwin patches for 2002e

2003-10-22 Thread Mark Crispin
On Wed, 22 Oct 2003, Gregory Hicks wrote:
 I think what Mark was saying was that simultaneous access to an mbx
 mailbox from various incarnations of pine MAY not work correctly under
 an MS-DOS implementation of windows.

 If only one incarnation of pine is running, the mbx SHOULD be readable.

 If your users *insist* on running two or more incarnations of pine to
 access the same mailbox, the results probably will be unpredictable.

This is correct.  To be specific:

If you wish to run two or more incarnations of Pine (or other c-client
tool such as imapd) on Windows to access the same mailbox at the same
time, the only means that is promised to work correctly is with a native
Windows (not Cygwin) version, running under Windows NT/2000/XP.

It is probable (but not guaranteed) that two or more incarnations of a
Cygwin build of UNIX Pine (or other c-client software) accessing the same
mailbox at the same time will work correctly under Windows NT/2000/XP.

In any other configuration, the results will be unpredictable, including
*all* configurations involving Windows 3.1/9x/Me (MS-DOS based Windows).

It is possible (but not guaranteed) that a Cygwin build of UNIX Pine (or
other c-client software) accessing the same mailbox at the same time with
PC Pine (or other native Windows build c-client software) accessing the
same mailbox at the same time will work to a limited fashion under Windows
NT/2000/XP. Certain aspects will fail; auxillary locks are handled
differently in UNIX and Windows.

The lessons should be:
 1) do not expect simultaneous access to work on systems which do not
 provide the tools to make simultaneous access work.
 2) do not expect software running under a compatibility package for
 a different operating system to interact completely (if at all)
 with the native version of that software.

A compatibility package should be seen for what it is -- an interim means
to run software from a foreign operating system.  As such, it will have
limitations; and these limitations translate into permanent restrictions
on how the software runs under that compatibility package.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.


Re: Cygwin patches for 2002e

2003-10-21 Thread Mark Crispin
On Tue, 21 Oct 2003, Abe Backus wrote:
 1) the flock simulator for cygwin in flockcyg.c has the same limitations as
 the flock simulator for NT, so the code should only lock on one byte in the
 file.  The person that brought this to my attention would prefer that the
 code lock the last possible byte in the file.

I have accepted this change, but to lock the first byte of the file.  I do
not believe that it is safe to lock a non-existant byte of a file, since
we have no way of knowing if future changes to Cygwin or Windows would
break that.

Arguably, the real bug is in Cygwin's implementation of fcntl() locks.
Cygwin is evidentally calling LockFileEx() on Windows directly, without
attempting to implement the correct fcntl() semantics.  In one case, this
is a good thing -- it doesn't implement the fcntl() design flaw that
requires all that flocksim master/slave hackery -- but in this case it is
not a good thing.

I'm not convinced that Cygwin should use the UNIX version of c-client
instead of the native Windows version.

 2) CRAM-MD5 wasn't working on cygwin

I don't see how it can work either.  Those logon/impersonate calls are
necessary to get access to the user files.  Removing those calls in the
CRAM-MD5 case has the effect of leaving the IMAP server running as SYSTEM,
which IMHO is not a good thing.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.


Re: Cygwin patches for 2002e

2003-10-21 Thread Eduardo Chappa
*** Mark Crispin ([EMAIL PROTECTED]) wrote today:

:) On Tue, 21 Oct 2003, Abe Backus wrote:
:)  1) the flock simulator for cygwin in flockcyg.c has the same
:) limitations as the flock simulator for NT, so the code should only
:) lock on one byte in the file.  The person that brought this to my
:) attention would prefer that the code lock the last possible byte
:) in the file.
:)
:) I have accepted this change, but to lock the first byte of the file.
:) I do not believe that it is safe to lock a non-existant byte of a file,
:) since we have no way of knowing if future changes to Cygwin or Windows
:) would break that.
:)
:) Arguably, the real bug is in Cygwin's implementation of fcntl() locks.
:) Cygwin is evidentally calling LockFileEx() on Windows directly, without
:) attempting to implement the correct fcntl() semantics.  In one case,
:) this is a good thing -- it doesn't implement the fcntl() design flaw
:) that requires all that flocksim master/slave hackery -- but in this
:) case it is not a good thing.
:)
:) I'm not convinced that Cygwin should use the UNIX version of c-client
:) instead of the native Windows version.

Hi Mark,

  One question, though. If your hunch is correct, I see that LockFileEx is
only implemented on Windows NT, 2000 and XP, so how does this patch work
in Windows 98?

  I have no way of testing this now, but if someone has tested/can test
this change in Windows 9X, I would be grateful for a report. I am
particularly interested in seeing how this code works when one attempts to
save a message to the same folder that it belongs, and how it works with
mbx style folders.

  It is my own personal belief that Mark is right, and Cygwin c-client
should use the windows code directly, instead of the unix code. Maybe we
could try to do this instead? What do you think Abraham?

Eduardo
http://www.math.washington.edu/~chappa/pine/


Re: Cygwin patches for 2002e

2003-10-21 Thread Mark Crispin
On Tue, 21 Oct 2003, Eduardo Chappa wrote:
   One question, though. If your hunch is correct, I see that LockFileEx is
 only implemented on Windows NT, 2000 and XP, so how does this patch work
 in Windows 98?

There is no such thing as meaningful file locking in Windows 98.  Win98 is
not a real operating system.

But it is also very doubtful that one is going to be running IMAP servers
on Windows 98; or multiple instances of Pine on the same mailbox.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.