[Pythonmac-SIG] Serious bug with FSSpecs (and GUSI, and MacPython) on OSX
Jack Jansen
Jack.Jansen@oratrix.nl
Sun, 27 Jan 2002 23:35:39 +0100
Folks,
I need some help. It turns out that the bug Russell Owen posted
here before (505562 in sourceforge) that BuildApplet can destroy
sourcefiles has even more far reaching consequences.
The problem isn't with BuildApplet per se, the problem is with
the way MacOSX creates FSSpecs for files with names that are too
long (more than 32 chars) to represent in an FSSpec. What
happens is that the first 22 chars are used, then #XXXXX is
appended (where the XXXXX is a number unique to the file) and
then the original extension is appended (don't know what
happened if the original extension was more than 3 chars).
But, and this is the bad news, this extension is *not* checked
if you create an FSSpec by hand. So, if your original, existing,
file has a ".py" extension you can create a valid FSSpec,
pointing to the same file, without the ".py" extension. Or with
a ".c" extension, or anything else.
The other part of the bad news is that GUSI is completely
FSSpec-based. Hence, when BuildApplet gets a ".py" file, creates
the applet name by stripping the .py and then does
try:
os.remove(outputfile)
except ....
The os.remove() succeeds and happily removes your sourcefile!
--
- Jack Jansen <Jack.Jansen@oratrix.com>
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution --
Emma Goldman -