[[!comment format=mdwn
 username="joey"
 subject="""comment 2"""
 date="2022-07-13T19:53:44Z"
 content="""
Just reproduced this. In my big repo, I had commit
eab6ac8b34be1d7c36df2a2f41a9414cf5908041 checked out
and ran `git reset --hard fbbe4045871f`

Git reported that it updated 112465 files, and near to the beginning,
filter-process died of signal 15.

Even better, it is reproducible, going back to that
starting commit and running that command again works every time!

And I got a strace too. Here is the git command:

	write(5, "0013command=smudge\n", 19)    = 19
	write(5, "0019pathname=new/cleanup\n", 25) = 25
	write(5, "0035treeish=fbbe4045871fb749299b"..., 53) = 53
	write(5, "0032blob=baad2545defeae59f526ea3"..., 50) = 50
	write(5, "0000", 4)                     = 4
	write(5, "0322", 4)                     = 4
	write(5, "#!/bin/sh\n\ngit commit -m 'pre cl"..., 798) = 798
	write(5, "0000", 4)                     = 4
	read(6, "0000", 4)                      = 4
	rt_sigaction(SIGPIPE, {sa_handler=0x563cf8debb50, sa_mask=[PIPE], sa_flags=SA_RES
	TORER|SA_RESTART, sa_restorer=0x7fab5717c920}, {sa_handler=SIG_IGN, sa_mask=[PIPE
	], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7fab5717c920}, 8) = 0
	write(2, "error: external filter 'git-anne"..., 57) = 57
	kill(1638045, SIGTERM)                  = 0

So git sends SIGTERM when it gets unhappy with the response it got from
git-annex filter-process.

Here is where git runs git-annex filter-process via the shell:

	execve("/bin/sh", ["/bin/sh", "-c", "git-annex filter-process", "git-annex filter-process"], 0x563cfacbfb40 /* 68 vars */) = 0
	...
	newfstatat(AT_FDCWD, "/home/joey/bin/git-annex", {st_mode=S_IFREG|0755, st_size=72524080, ...}, 0) = 0
	rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
	vfork()                                 = 1631132
	rt_sigprocmask(SIG_SETMASK, [], ~[KILL STOP RTMIN RT_1], 8) = 0
	wait4(-1, 0x7fff910d697c, 0, NULL)      = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
	--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=1631129, si_uid=1000} ---
	+++ killed by SIGTERM +++

But the actual git-annex process read the last thing git wrote to it,
replied, and keeps running until it later reads an EOF from git.

	write(1, "0000", 4)                     = 4
	poll([{fd=0, events=POLLIN}], 1, 0)     = 0 (Timeout)
	epoll_ctl(4, EPOLL_CTL_MOD, 0, {EPOLLIN|EPOLLONESHOT, {u32=0, u64=287065581021036544}}) = 0
	futex(0x67fe568, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY) = 0
	futex(0x67fe570, FUTEX_WAKE_PRIVATE, 1) = 0
	futex(0x67fe68c, FUTEX_WAKE_PRIVATE, 1) = 1
	read(0, "0013command=smudge\n0019pathname=new/cleanup\n0035treeish=fbbe4045871fb749299b4484862645bd9a7f175a\n0032blob=baad2545defeae59f526ea3d64174398899cb9cc\n00000322", 8192) = 155
	poll([{fd=0, events=POLLIN}], 1, 0)     = 1 ([{fd=0, revents=POLLIN}])
	futex(0x67fe688, FUTEX_WAKE_PRIVATE, 1) = 1
	futex(0x67fe690, FUTEX_WAKE_PRIVATE, 1) = 0
	read(0, "#!/bin/sh....", 8192) = 802
	futex(0x67fe56c, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY) = -1 EAGAIN (Resource temporarily unavailable)
	futex(0x67fe570, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
	futex(0x67fe570, FUTEX_WAKE_PRIVATE, 1) = 0
	poll([{fd=1, events=POLLOUT}], 1, 0)    = 1 ([{fd=1, revents=POLLOUT}])
	futex(0x67fe68c, FUTEX_WAKE_PRIVATE, 1) = 1
	futex(0x67fe690, FUTEX_WAKE_PRIVATE, 1) = 0
	write(1, "0013status=success\n", 19)    = 19
	futex(0x67fe568, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY) = 0
	futex(0x67fe570, FUTEX_WAKE_PRIVATE, 1) = 0
	poll([{fd=1, events=POLLOUT}], 1, 0)    = 1 ([{fd=1, revents=POLLOUT}])
	write(1, "0000", 4)                     = 4
	poll([{fd=1, events=POLLOUT}], 1, 0)    = 1 ([{fd=1, revents=POLLOUT}])
	write(1, "0322#!/bin/sh...", 802) = 802
	poll([{fd=1, events=POLLOUT}], 1, 0)    = 1 ([{fd=1, revents=POLLOUT}])
	write(1, "0000", 4)                     = 4
	poll([{fd=1, events=POLLOUT}], 1, 0)    = 1 ([{fd=1, revents=POLLOUT}])
	write(1, "0000", 4)                     = 4
	poll([{fd=0, events=POLLIN}], 1, 0)     = 0 (Timeout)

Git does not see that 0013status=success response though. It sees "0000",
which must be the one that git-annex wrote earlier (top of above strace).

So, this seems like a protocol problem of some kind.
"""]
