diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-13 20:23:18 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-13 20:23:18 +0000 |
commit | 8141b7802e394322d674abb5ab051262e57a4816 (patch) | |
tree | 6d4983ba1a6faca7dcdb09d8689f2f3f1b8c5280 /tools/checkperms/checkperms.py | |
parent | 2db9bd7f4d790d11f25f6f6e4aef9fc731b2424e (diff) | |
download | chromium_src-8141b7802e394322d674abb5ab051262e57a4816.zip chromium_src-8141b7802e394322d674abb5ab051262e57a4816.tar.gz chromium_src-8141b7802e394322d674abb5ab051262e57a4816.tar.bz2 |
Make checkperms.py look for shebang.
This should enable removing most (if not all) of the whitelist.
R=thestig@chromium.org
BUG=
TEST=
Review URL: http://codereview.chromium.org/10083003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132258 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/checkperms/checkperms.py')
-rwxr-xr-x | tools/checkperms/checkperms.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/checkperms/checkperms.py b/tools/checkperms/checkperms.py index 2640d5a0..c3959f9 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) |