This is the mail archive of the
mailing list for the Cygwin project.
Re: Symlinks don't work in python???
On Tue, 19 Apr 2005, Jason Tishler wrote:
> On Fri, Apr 15, 2005 at 10:12:56PM -0400, Jason Tishler wrote:
> > On Fri, Apr 15, 2005 at 03:54:37PM -0400, Steve Ward wrote:
> > > Can you try my failing experiment (symlink bar.py to file foo.py in
> > > same directory)?
> > I was able reproduce your problem on my way out of work today.
> > > It seems using a different name for the symlink may cause the
> > > trouble... I have no idea why.
> > Can you strace the issue and report back to the list? If not, then I
> > will try when I'm back at work on Monday.
> AFAICT, symlinking bar.py to foo.py never worked or at least since
> case-insensitive file system support was added to Python in 2/2001:
Why not use the built-in Cygwin case checking feature with
> The problem is Cygwin specific code is invoked during imports to make
> sure one imports a module using the same case as the file stored in the
> file system. For example, "foo" will match "foo.py" but not "FoO.py",
> etc. When you import bar (i.e., bar.py) which is symlinked to foo.py
> the case checking code fails (because "bar" != "foo") and the module is
Ouch. It should be checking against the resolved Win32 filename instead.
> You can workaround the problem by defining PYTHONCASEOK:
> $ PYTHONCASEOK= python -c 'import bar'
> I will work with the Python developers to try to come up with a better
> long term solution.
The way Cygwin does it internally is get a directory entry using a given
Win32 filename, and then compare the case of the filename with that of the
directory entry. The first part ensures that the filename can only refer
to the same file, and this happens after symlink resolution, so if
"bar.py" is a symlink to "FoO.py", and the file on disk is "fOo.py", the
latter check will fail.
|\ _,,,---,,_ firstname.lastname@example.org
ZZZzz /,`.-'`' -. ;-;;,_ email@example.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html