@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.

Write patterns to "git grep" on stdin instead of passing them with "-e"

Summary:
Fixes T12807. Some shells may apparently mangle/strip UTF8 characters? Just dodge this whole problem by sending the pattern over stdin rather than actually figuring out the particulars.

Related tasks, like T7339 and T5554, discuss finding broader fixes for this class of issue, and this definitely isn't exactly a fully legitimate fix, but in many cases (as here) we can reasonably just avoid the problem rather than actually fixing it, at least for a long time.

Test Plan: Searched for emoji and non-emoji locally, but this worked fine (on OSX) for me before the patch too.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12807

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

+5 -2
+5 -2
src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php
··· 57 57 $results = array(); 58 58 $future = $repository->getLocalCommandFuture( 59 59 // NOTE: --perl-regexp is available only with libpcre compiled in. 60 - 'grep --extended-regexp --null -n --no-color -e %s %s -- %s', 61 - $grep, 60 + 'grep --extended-regexp --null -n --no-color -f - %s -- %s', 62 61 $drequest->getStableCommit(), 63 62 $path); 63 + 64 + // NOTE: We're writing the pattern on stdin to avoid issues with UTF8 65 + // being mangled by the shell. See T12807. 66 + $future->write($grep); 64 67 65 68 $binary_pattern = '/Binary file [^:]*:(.+) matches/'; 66 69 $lines = new LinesOfALargeExecFuture($future);