]> granicus.if.org Git - python/commitdiff
Restrict the mode to the lowest four octal positions; higher positions
authorAndrew M. Kuchling <amk@amk.ca>
Thu, 31 Jan 2002 22:08:38 +0000 (22:08 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Thu, 31 Jan 2002 22:08:38 +0000 (22:08 +0000)
   contain the type of the file (regular file, socket, link, &c.).
   This means that install_scripts will now print
   "changing mode of <file> to 775" instead of "... to 100775".

2.2 bugfix candidate, I suppose, though this isn't actually fixing a bug.

Lib/distutils/command/install_scripts.py

index 3bc23e7460f15721cb4fbdfac9b212655dc6fe25..d4cbaa3a0a8bfa75b8cd306f6c83191a2447dc1e 100644 (file)
@@ -50,7 +50,7 @@ class install_scripts (Command):
                 if self.dry_run:
                     self.announce("changing mode of %s" % file)
                 else:
-                    mode = (os.stat(file)[ST_MODE]) | 0111
+                    mode = ((os.stat(file)[ST_MODE]) | 0111) & 07777
                     self.announce("changing mode of %s to %o" % (file, mode))
                     os.chmod(file, mode)