[BUG][FIX] FileDirectory (on Windows)

Stephen Pair spair at acm.org
Wed Dec 4 15:47:11 UTC 2002


Recently, I've encountered a serious bug on Windows.  I've just starting
running squeak out of c:\squeak, and I found that trying to install
SqueakMap packages would occasionally cause things to go into an
infinite recursion.  Upon further inspection, I discovered that it was
happening on FileDirectory>>assureExistence...to recreate, you can do
the following:

	(FileDirectory on: 'c:\squeak') assureExistence

You should be able to observe the broken behavior on any top level
directory.  In digging further is appears that the following answers
false:

	(FileDirectory on: 'c:') exists

If you are working with a second level directory (or deeper)
assureExistence will also fail if the second level directory does not
exists and even if the top level directory does exist.  For example, if
c:\squeak exists, but c:\squeak\icons does not, then the following will
fail (infinite recursion):

	(FileDirectory on: 'c:\squeak\icons') assureExistence

The attached change set fixes this problem by overriding #exists in
DosFileDirectory to check whether the path is to a drive.  It also makes
#driveName a little more robust.

I'm a bit concerned that this behavior might not be exibited in all
versions of Windows.  What I found was that "self primLookupEntryIn:
pathName index: 0" in FileDirectory>>exists was not giving back the
expected result for a pathName of 'c:' (or other drive letter) and thus
it was answering false.  I find it hard to believe that this was not
caught until now.  Anyway, this fix works, but the real fix might need
to happen in the primitive...I don't know.

- Stephen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DosDirFix.1.cs
Type: application/octet-stream
Size: 819 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20021204/b99811b5/DosDirFix.1.obj


More information about the Squeak-dev mailing list