equal
deleted
inserted
replaced
662 # a FS remount. Frequently we can detect it if files are created |
662 # a FS remount. Frequently we can detect it if files are created |
663 # with exec bit on. |
663 # with exec bit on. |
664 |
664 |
665 try: |
665 try: |
666 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH |
666 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH |
667 fh, fn = tempfile.mkstemp("", "", path) |
667 fh, fn = tempfile.mkstemp(dir=path, prefix='hg-checkexec-') |
668 try: |
668 try: |
669 os.close(fh) |
669 os.close(fh) |
670 m = os.stat(fn).st_mode & 0777 |
670 m = os.stat(fn).st_mode & 0777 |
671 new_file_has_exec = m & EXECFLAGS |
671 new_file_has_exec = m & EXECFLAGS |
672 os.chmod(fn, m ^ EXECFLAGS) |
672 os.chmod(fn, m ^ EXECFLAGS) |