From fa3a38d81faaf96d17b5a7f0248b9923e3a648cc Mon Sep 17 00:00:00 2001 From: Greg Price Date: Mon, 9 Sep 2019 07:16:33 -0700 Subject: [PATCH] Mark files as executable that are meant as scripts. (GH-15354) This is the converse of GH-15353 -- in addition to plenty of scripts in the tree that are marked with the executable bit (and so can be directly executed), there are a few that have a leading `#!` which could let them be executed, but it doesn't do anything because they don't have the executable bit set. Here's a command which finds such files and marks them. The first line finds files in the tree with a `#!` line *anywhere*; the next-to-last step checks that the *first* line is actually of that form. In between we filter out files that already have the bit set, and some files that are meant as fragments to be consumed by one or another kind of preprocessor. $ git grep -l '^#!' \ | grep -vxFf <( \ git ls-files --stage \ | perl -lane 'print $F[3] if (!/^100644/)' \ ) \ | grep -ve '\.in$' -e '^Doc/includes/' \ | while read f; do head -c2 "$f" | grep -qxF '#!' \ && chmod a+x "$f"; \ done --- Lib/pydoc.py | 0 Lib/turtledemo/__main__.py | 0 Lib/turtledemo/sorting_animate.py | 0 Misc/python-wing3.wpr | 0 Misc/python-wing4.wpr | 0 Misc/python-wing5.wpr | 0 PCbuild/fix_encoding.py | 0 PCbuild/get_external.py | 0 PCbuild/prepare_ssl.py | 0 Parser/asdl_c.py | 0 Tools/scripts/generate_token.py | 0 11 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 Lib/pydoc.py mode change 100644 => 100755 Lib/turtledemo/__main__.py mode change 100644 => 100755 Lib/turtledemo/sorting_animate.py mode change 100644 => 100755 Misc/python-wing3.wpr mode change 100644 => 100755 Misc/python-wing4.wpr mode change 100644 => 100755 Misc/python-wing5.wpr mode change 100644 => 100755 PCbuild/fix_encoding.py mode change 100644 => 100755 PCbuild/get_external.py mode change 100644 => 100755 PCbuild/prepare_ssl.py mode change 100644 => 100755 Parser/asdl_c.py mode change 100644 => 100755 Tools/scripts/generate_token.py diff --git a/Lib/pydoc.py b/Lib/pydoc.py old mode 100644 new mode 100755 diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py old mode 100644 new mode 100755 diff --git a/Lib/turtledemo/sorting_animate.py b/Lib/turtledemo/sorting_animate.py old mode 100644 new mode 100755 diff --git a/Misc/python-wing3.wpr b/Misc/python-wing3.wpr old mode 100644 new mode 100755 diff --git a/Misc/python-wing4.wpr b/Misc/python-wing4.wpr old mode 100644 new mode 100755 diff --git a/Misc/python-wing5.wpr b/Misc/python-wing5.wpr old mode 100644 new mode 100755 diff --git a/PCbuild/fix_encoding.py b/PCbuild/fix_encoding.py old mode 100644 new mode 100755 diff --git a/PCbuild/get_external.py b/PCbuild/get_external.py old mode 100644 new mode 100755 diff --git a/PCbuild/prepare_ssl.py b/PCbuild/prepare_ssl.py old mode 100644 new mode 100755 diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/generate_token.py b/Tools/scripts/generate_token.py old mode 100644 new mode 100755