Show More
@@ -848,16 +848,21 b' def checkexec(path):' | |||||
848 |
|
848 | |||
849 | Requires a directory (like /foo/.hg) |
|
849 | Requires a directory (like /foo/.hg) | |
850 | """ |
|
850 | """ | |
|
851 | ||||
|
852 | # VFAT on some Linux versions can flip mode but it doesn't persist | |||
|
853 | # a FS remount. Frequently we can detect it if files are created | |||
|
854 | # with exec bit on. | |||
|
855 | ||||
851 | try: |
|
856 | try: | |
852 | EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH |
|
857 | EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH | |
853 | fh, fn = tempfile.mkstemp("", "", path) |
|
858 | fh, fn = tempfile.mkstemp("", "", path) | |
|
859 | try: | |||
854 | os.close(fh) |
|
860 | os.close(fh) | |
855 | m = os.stat(fn).st_mode |
|
861 | m = os.stat(fn).st_mode & 0777 | |
856 | # VFAT on Linux can flip mode but it doesn't persist a FS remount. |
|
|||
857 | # frequently we can detect it if files are created with exec bit on. |
|
|||
858 | new_file_has_exec = m & EXECFLAGS |
|
862 | new_file_has_exec = m & EXECFLAGS | |
859 | os.chmod(fn, m ^ EXECFLAGS) |
|
863 | os.chmod(fn, m ^ EXECFLAGS) | |
860 | exec_flags_cannot_flip = (os.stat(fn).st_mode == m) |
|
864 | exec_flags_cannot_flip = (os.stat(fn).st_mode == m) | |
|
865 | finally: | |||
861 | os.unlink(fn) |
|
866 | os.unlink(fn) | |
862 | except (IOError,OSError): |
|
867 | except (IOError, OSError): | |
863 | # we don't care, the user probably won't be able to commit anyway |
|
868 | # we don't care, the user probably won't be able to commit anyway |
General Comments 0
You need to be logged in to leave comments.
Login now