Re: [PATCH v8 00/12] Fast git status via a file system watcher

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 10/4/2017 2:38 AM, Alex Vandiver wrote:
On Wed, 4 Oct 2017, Junio C Hamano wrote:
Rats indeed.  Let's go incremental as promised, perhaps like this
(but please supply a better description if you have one).

I think you'll also want the following squashed into 5c8cdcfd8 and
def437671:

-- >8 --
 From 445d45027bb5b7823338cf111910d2884af6318b Mon Sep 17 00:00:00 2001
From: Alex Vandiver <alexmv@xxxxxxxxxxx>
Date: Tue, 3 Oct 2017 23:27:46 -0700
Subject: [PATCH] fsmonitor: Read entirety of watchman output

In perl, setting $/ sets the string that is used as the "record
separator," which sets the boundary that the `<>` construct reads to.
Setting `local $/ = 0666;` evaluates the octal, getting 438, and
stringifies it.  Thus, the later read from `<CHLD_OUT>` stops as soon
as it encounters the string "438" in the watchman output, yielding
invalid JSON; repositories containing filenames with SHA1 hashes are
able to trip this easily.

Set `$/` to undefined, thus slurping all output from watchman.  Also
close STDIN which is provided to watchman, to better guarantee that we
cannot deadlock with watchman while both attempting to read.


Thank you! I'm a perl neophyte so have to rely on others when it comes to these types of perl issues. I tried out your fixes and they appear to work well.

While testing them, I discovered that your fix of `local $/ = 0666;` exposed an existing issue in the test version of the integration script. The fix for that is within my perl capabilities and is fixed with the following patch:

-- >8 --
From 3e3b983a4208a62d166c233a7de3bf045322f6c7 Mon Sep 17 00:00:00 2001
From: Ben Peart <benpeart@xxxxxxxxxxxxx>
Date: Wed, 4 Oct 2017 08:33:39 -0400
Subject: [PATCH] fsmonitor: preserve utf8 filenames in fsmonitor-watchman log

Update the test fsmonitor-watchman integration script to properly
preserve utf8 filenames when outputting the .git/watchman-output.out log
file.

Signed-off-by: Ben Peart <benpeart@xxxxxxxxxxxxx>
---
 t/t7519/fsmonitor-watchman | 1 +
 1 file changed, 1 insertion(+)

diff --git a/t/t7519/fsmonitor-watchman b/t/t7519/fsmonitor-watchman
index 51330f8b3d..a3e30bf54f 100755
--- a/t/t7519/fsmonitor-watchman
+++ b/t/t7519/fsmonitor-watchman
@@ -129,6 +129,7 @@ sub launch_watchman {
 	    "Falling back to scanning...\n" if $o->{error};

 	open ($fh, ">", ".git/watchman-output.out");
+	binmode $fh, ":utf8";
 	print $fh @{$o->{files}};
 	close $fh;

--
2.14.1.windows.1.1034.g0776750557




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux