Index: tools/checkperms/checkperms.py |
diff --git a/tools/checkperms/checkperms.py b/tools/checkperms/checkperms.py |
index 2640d5a0ba2d59f2a6afc8d2cadf0be049626826..c3959f99ce9289fabcfae1a39588947cf89b9797 100755 |
--- a/tools/checkperms/checkperms.py |
+++ b/tools/checkperms/checkperms.py |
@@ -177,6 +177,12 @@ def CheckFile(file_path): |
return 'Failed to stat file: %s' % e |
if EXECUTABLE_PERMISSION & st_mode: |
+ # Look if the file starts with #!/ |
+ with open(file_path, 'rb') as f: |
+ if f.read(3) == '#!/': |
+ # That's fine. |
+ return None |
+ # TODO(maruel): Check that non-executable file do not start with a shebang. |
error = 'Contains executable permission' |
if VERBOSE: |
return '%s: %06o' % (error, st_mode) |