[Pythonmac-SIG] Serious bug with FSSpecs (and GUSI, and MacPython) on OSX
Mark Day
mday@mac.com
Mon, 28 Jan 2002 17:17:52 -0800
Jack,
You've found a bug in the Carbon File Manager on Mac OS X.
When you pass in a mangled filename, the File Manager is supposed to try
finding the name literally, then try finding it based by its ID (the
XXXXX part).
If it finds the file by ID, it is supposed to then derive the mangled
name again and compare it to what you passed in. Carbon isn't doing
this. You can definitely write up a bug and describe how it has data
losing consequences (in the hopes that a fix gets released sooner).
-Mark
On Sunday, January 27, 2002, at 02:35 PM, Jack Jansen wrote:
> 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!