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