Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: tools/checkperms/checkperms.py

Issue 10083003: Make checkperms.py look for shebang. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comment Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698