]> granicus.if.org Git - python/commitdiff
Refuse to run if the last bit of the destination path contains a # character.
authorJack Jansen <jack.jansen@cwi.nl>
Sun, 18 Aug 2002 21:57:09 +0000 (21:57 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sun, 18 Aug 2002 21:57:09 +0000 (21:57 +0000)
This is a silly workaround for a rather serious bug in MacOSX: if you take
a long filename and convert it to an FSSpec the fsspec gets a magic
cooky (containing a #, indeed). If you then massage the extension of this
fsspec and convert back to a pathname you may end up referring to the
same file. This could destroy your sourcefile. The problem only occcurs
in MacPython-OS9, not MacPython-OSX (I think).

Closes bug #505562.

Mac/Lib/buildtools.py

index ca9b252b39ebce8a60f70d7a19f5f2ce67e5ad38..a5e641dd8dc1a9cd3b919eeb56e16ceaf300a059 100644 (file)
@@ -74,7 +74,10 @@ def process(template, filename, destname, copy_codefragment,
                progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120)
                progress.label("Compiling...")
                progress.inc(0)
-       
+       # check for the script name being longer than 32 chars. This may trigger a bug
+       # on OSX that can destroy your sourcefile.
+       if '#' in os.path.split(filename)[1]:
+               raise BuildError, "BuildApplet could destroy your sourcefile on OSX, please rename: %s" % filename
        # Read the source and compile it
        # (there's no point overwriting the destination if it has a syntax error)