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

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: 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 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)
« 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