Index: tools/checkperms/checkperms.py |
diff --git a/tools/checkperms/checkperms.py b/tools/checkperms/checkperms.py |
index cbdc6972c5eb359ac51dbb79a85565a1594c29c2..d70f4fad0ff5eccd66642acbdf874e114846279a 100755 |
--- a/tools/checkperms/checkperms.py |
+++ b/tools/checkperms/checkperms.py |
@@ -176,6 +176,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).startswith('#!/'): |
Lei Zhang
2012/04/13 19:09:49
startswith -> ==
|
+ # 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) |