From: phillip.wood123@gmail.com Date: Thu, 18 Jul 2024 09:56:19 GMT Subject: Re: [PATCH v3 4/4] add-patch: render hunks through the pager Message-ID: <6317c4a0-06b9-4e2c-9b23-10cb96950617@gmail.com> In-Reply-To: On 17/07/2024 21:31, Junio C Hamano wrote: > phillip.wood123@gmail.com writes: > >>> - test_write_lines P q | GIT_PAGER="head -n 1" test_terminal git add -p >>> + test_write_lines P q | >>> + ( >>> + GIT_PAGER="head -n 1" && >>> + export GIT_PAGER && >>> + test_terminal git add -p >actual >>> + ) >> >> That's surprising, why does running git in a sub-shell stop it from >> segfaulting? > > Another difference besides the sub-shell is where the output from > test_terminal goes. If the above change fixes the issue for Rubén, > I wonder if it still works if ">actual" gets removed. Yes that would be interesting to know. I do think we should be checking the output here to make sure the test is doing what we think it is - all we know at the moment is whether git exits successfully or not. If we receive SIGPIPE then fputs() will see EPIPE which will set ferror() which we should be clearing and checking that the prompt prints correctly afterwards. I think it would be helpful to add tail -n3 actual >actual.trimmed && cat >expect <<\EOF && \ No newline at end of file (1/1) Stage addition [y,n,q,a,d,e,p,?]? @@ -0,0 +1,2 @@ (1/1) Stage addition [y,n,q,a,d,e,p,?]? EOF test_cmp expect actual.trimmed to the test. That all still leaves me wondering about the segfault though Best Wishes Phillip