[Patches] [Patch #103154] Cygwin Check Import Case Patch

noreply@sourceforge.net noreply@sourceforge.net
Fri, 12 Jan 2001 06:57:25 -0800


Patch #103154 has been updated. 

Project: python
Category: core (C code)
Status: Closed
Submitted by: jlt63
Assigned to : gvanrossum
Summary: Cygwin Check Import Case Patch

Follow-Ups:

Date: 2001-Jan-11 13:59
By: gvanrossum

Comment:
Upload it as a new patch.

But I believe the solution is that the TERMIOS module should be renamed.

-------------------------------------------------------

Date: 2001-Jan-11 07:56
By: jlt63

Comment:
Actually, this is not a bug in my original version. Cygwin Python is
behaving
identically to the Win32 one. Unfortunately, as you pointed out Win32
Python definitely does not handle the situation of two modules that only
differ by case. Sigh... If one tries to import the second module that would
be
found in sys.path, then a NameError: Case mismatch ... exception will
*always*
be generated. I'm not sure that I agree with this behavior but I really a
UNIX
guy.

Since Cygwin Python should support as many UNIX modules as possible, it
needs to deal with modules that only differ by case. termios and TERMIOS
used by getpass is a perfect example.

I have created a (hacky) patch, that solves this problem for both Cygwin
and
Win32. I can redo it so that it only affects Cygwin and leaves the Win32
functionality alone. I would like to upload it for discussion but I am
concerned
about overwriting the old version. Should I upload it anyway?
-------------------------------------------------------

Date: 2001-Jan-11 06:47
By: gvanrossum

Comment:
Reopened at request.

Note that I believe that "import termios, TERMIOS" *should fail* -- not all
filesystems used on Windows are case preserving.  I've had this battle with
Mark Hammond before.  The case check is intended to prevent you from
importing a moduleusing the wrong case (e.g. import String).  It is *not*
intended to let you have two modules that only differ in case.

-------------------------------------------------------

Date: 2001-Jan-10 19:48
By: jlt63

Comment:
I have already checked that this patch does not break the Windows VC
build before I submitted it. However, Tim is welcome to reverify himself.

Unfortunately, I have found a bug with this patch that (only) affects
Cygwin. Although this patch handles the following:

import String

it does not handle the following:

import termios, TERMIOS

I will resubmit a new version shortly, please change the status back to
open.
-------------------------------------------------------

Date: 2001-Jan-10 12:45
By: gvanrossum

Comment:
Thanks -- checked in!

Note: I didn't check this on Cygwin -- I only tested that this doesn't
break the build on Linux.  I hope that Tim will check that it doesn't break
the VC build on Windows.

-------------------------------------------------------

Date: 2001-Jan-08 21:11
By: jlt63

Comment:
[The formating was lost on my initial post, so I try again.  Sigh...]

This patch enables the imported module name case checking code
for Cygwin that is already enabled by default for Win32.  Use
the configure --with-check-import-case option to enable this
feature.

Without this patch, the following code from getpass.getuser()
behaves incorrectly:

import termios, TERMIOS

The folowing is a ChangeLog:

Mon Jan  8 23:54:00 2001  Jason Tishler <jt@dothill.com>

* acconfig.h: Add CHECK_IMPORT_CASE #undef.
* configure.in: Add --with-check-import-case section.
* Python/import.c: Enable case checking code for Cygwin too.
Include sys/cygwin.h, if appropriate.
(check_case): Add munging of module path from POSIX to Win32
so FindFirstFile() can cope, if appropriate.
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=103154&group_id=5470