Show More
@@ -848,18 +848,23 b' def checkexec(path):' | |||
|
848 | 848 | |
|
849 | 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 | 856 | try: |
|
852 | 857 | EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH |
|
853 | 858 | fh, fn = tempfile.mkstemp("", "", path) |
|
854 | os.close(fh) | |
|
855 |
|
|
|
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 | |
|
859 | os.chmod(fn, m ^ EXECFLAGS) | |
|
860 | exec_flags_cannot_flip = (os.stat(fn).st_mode == m) | |
|
861 | os.unlink(fn) | |
|
862 | except (IOError,OSError): | |
|
859 | try: | |
|
860 | os.close(fh) | |
|
861 | m = os.stat(fn).st_mode & 0777 | |
|
862 | new_file_has_exec = m & EXECFLAGS | |
|
863 | os.chmod(fn, m ^ EXECFLAGS) | |
|
864 | exec_flags_cannot_flip = (os.stat(fn).st_mode == m) | |
|
865 | finally: | |
|
866 | os.unlink(fn) | |
|
867 | except (IOError, OSError): | |
|
863 | 868 | # we don't care, the user probably won't be able to commit anyway |
|
864 | 869 | return False |
|
865 | 870 | return not (new_file_has_exec or exec_flags_cannot_flip) |
General Comments 0
You need to be logged in to leave comments.
Login now