@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Never try to run README as a commit hook

Summary:
Fixes T4960. Users `chmod +x` this, and then bash chokes on it.

Phabricator "owns" this file anyway, so there is no real ambiguity here: this should never be a hook script.

Test Plan:
- Did `chmod +x README`.
- Made a commit.
- Added `z.sh`, got blocked.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T4960

Differential Revision: https://secure.phabricator.com/D8981

+12 -2
+12 -2
src/applications/diffusion/engine/DiffusionCommitHookEngine.php
··· 637 637 638 638 foreach (Filesystem::listDirectory($directory) as $path) { 639 639 $full_path = $directory.DIRECTORY_SEPARATOR.$path; 640 - if (is_executable($full_path)) { 641 - $executables[] = $full_path; 640 + if (!is_executable($full_path)) { 641 + // Don't include non-executable files. 642 + continue; 642 643 } 644 + 645 + if (basename($full_path) == 'README') { 646 + // Don't include README, even if it is marked as executable. It almost 647 + // certainly got caught in the crossfire of a sweeping `chmod`, since 648 + // users do this with some frequency. 649 + continue; 650 + } 651 + 652 + $executables[] = $full_path; 643 653 } 644 654 645 655 return $executables;