# t0025 flakey?

14 messages from 2019-02-06 to 2019-02-08. Participants: Johannes Schindelin, SZEDER Gábor, Torsten Bögershausen, Randall S. Becker, Jeff King, Junio C Hamano.
Thread: https://gitlist.dev/t/50410

## Johannes Schindelin, 2019-02-06 10:25

Subject: t0025 flakey?
Message-ID: <nycvar.QRO.7.76.6.1902061123410.41@tvgsbejvaqbjf.bet>
URL: https://gitlist.dev/e/nycvar.QRO.7.76.6.1902061123410.41%40tvgsbejvaqbjf.bet

```
Hi Torsten,

at first I thought that those intermittent test failures were limited to
Windows, but they are not: I can see it now in a build on 32-bit Linux.
Full logs here:

https://dev.azure.com/gitgitgadget/git/_build/results?buildId=1032&_a=summary&view=ms.vss-test-web.build-test-results-tab

Excerpt from the failing test case:

-- snip --
not ok 2 - renormalize CRLF in repo
 expecting success: 
	echo "*.txt text=auto" >.gitattributes &&
	git add --renormalize "*.txt" &&
	cat >expect <<-\EOF &&
	i/lf w/crlf attr/text=auto CRLF.txt
	i/lf w/lf attr/text=auto LF.txt
	i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
	EOF
	git ls-files --eol |
	sed -e "s/	/ /g" -e "s/  */ /g" |
	sort >actual &&
	test_cmp expect actual

+ echo *.txt text=auto
+ git add --renormalize *.txt
+ cat
+ sort
+ sed -e s/	/ /g -e s/  */ /g
+ git ls-files --eol
+ test_cmp expect actual
+ diff -u expect actual
--- expect	2019-02-06 09:39:42.080733629 +0000
+++ actual	2019-02-06 09:39:42.088733629 +0000
@@ -1,3 +1,3 @@
-i/lf w/crlf attr/text=auto CRLF.txt
+i/crlf w/crlf attr/text=auto CRLF.txt
 i/lf w/lf attr/text=auto LF.txt
-i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
+i/mixed w/mixed attr/text=auto CRLF_mix_LF.txt
error: last command exited with $?=1
-- snap --

Any ideas?
Johannes

```

## SZEDER Gábor, 2019-02-06 10:42

Subject: Re: t0025 flakey?
Message-ID: <20190206104243.GJ10587@szeder.dev>
URL: https://gitlist.dev/e/20190206104243.GJ10587%40szeder.dev
In-Reply-To: <nycvar.QRO.7.76.6.1902061123410.41@tvgsbejvaqbjf.bet>

```
On Wed, Feb 06, 2019 at 11:25:38AM +0100, Johannes Schindelin wrote:
> Hi Torsten,
> 
> at first I thought that those intermittent test failures were limited to
> Windows, but they are not: I can see it now in a build on 32-bit Linux.
> Full logs here:
> 
> https://dev.azure.com/gitgitgadget/git/_build/results?buildId=1032&_a=summary&view=ms.vss-test-web.build-test-results-tab
> 
> Excerpt from the failing test case:
> 
> -- snip --
> not ok 2 - renormalize CRLF in repo
>  expecting success: 
> 	echo "*.txt text=auto" >.gitattributes &&
> 	git add --renormalize "*.txt" &&
> 	cat >expect <<-\EOF &&
> 	i/lf w/crlf attr/text=auto CRLF.txt
> 	i/lf w/lf attr/text=auto LF.txt
> 	i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
> 	EOF
> 	git ls-files --eol |
> 	sed -e "s/	/ /g" -e "s/  */ /g" |
> 	sort >actual &&
> 	test_cmp expect actual
> 
> + echo *.txt text=auto
> + git add --renormalize *.txt
> + cat
> + sort
> + sed -e s/	/ /g -e s/  */ /g
> + git ls-files --eol
> + test_cmp expect actual
> + diff -u expect actual
> --- expect	2019-02-06 09:39:42.080733629 +0000
> +++ actual	2019-02-06 09:39:42.088733629 +0000
> @@ -1,3 +1,3 @@
> -i/lf w/crlf attr/text=auto CRLF.txt
> +i/crlf w/crlf attr/text=auto CRLF.txt
>  i/lf w/lf attr/text=auto LF.txt
> -i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
> +i/mixed w/mixed attr/text=auto CRLF_mix_LF.txt
> error: last command exited with $?=1
> -- snap --
> 
> Any ideas?

I reported this and Peff looked into it on the way to Git Merge, but
not working solution yet.

https://public-inbox.org/git/20190129225121.GD1895@sigill.intra.peff.net/T/#u


```

## Johannes Schindelin, 2019-02-06 13:52

Subject: Re: t0025 flakey?
Message-ID: <nycvar.QRO.7.76.6.1902061450280.41@tvgsbejvaqbjf.bet>
URL: https://gitlist.dev/e/nycvar.QRO.7.76.6.1902061450280.41%40tvgsbejvaqbjf.bet
In-Reply-To: <20190206104243.GJ10587@szeder.dev>

```
Hi Gábor,

On Wed, 6 Feb 2019, SZEDER Gábor wrote:

> On Wed, Feb 06, 2019 at 11:25:38AM +0100, Johannes Schindelin wrote:
> 
> > at first I thought that those intermittent test failures were limited
> > to Windows, but they are not: I can see it now in a build on 32-bit
> > Linux.
> > Full logs here:
> > 
> > https://dev.azure.com/gitgitgadget/git/_build/results?buildId=1032&_a=summary&view=ms.vss-test-web.build-test-results-tab
> > 
> > Excerpt from the failing test case:
> > 
> > -- snip --
> > not ok 2 - renormalize CRLF in repo
> >  expecting success: 
> > 	echo "*.txt text=auto" >.gitattributes &&
> > 	git add --renormalize "*.txt" &&
> > 	cat >expect <<-\EOF &&
> > 	i/lf w/crlf attr/text=auto CRLF.txt
> > 	i/lf w/lf attr/text=auto LF.txt
> > 	i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
> > 	EOF
> > 	git ls-files --eol |
> > 	sed -e "s/	/ /g" -e "s/  */ /g" |
> > 	sort >actual &&
> > 	test_cmp expect actual
> > 
> > + echo *.txt text=auto
> > + git add --renormalize *.txt
> > + cat
> > + sort
> > + sed -e s/	/ /g -e s/  */ /g
> > + git ls-files --eol
> > + test_cmp expect actual
> > + diff -u expect actual
> > --- expect	2019-02-06 09:39:42.080733629 +0000
> > +++ actual	2019-02-06 09:39:42.088733629 +0000
> > @@ -1,3 +1,3 @@
> > -i/lf w/crlf attr/text=auto CRLF.txt
> > +i/crlf w/crlf attr/text=auto CRLF.txt
> >  i/lf w/lf attr/text=auto LF.txt
> > -i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
> > +i/mixed w/mixed attr/text=auto CRLF_mix_LF.txt
> > error: last command exited with $?=1
> > -- snap --
> > 
> > Any ideas?
> 
> I reported this and Peff looked into it on the way to Git Merge, but
> not working solution yet.
> 
> https://public-inbox.org/git/20190129225121.GD1895@sigill.intra.peff.net/T/#u

Thank you!
Dscho
```

## Torsten Bögershausen, 2019-02-06 17:15

Subject: Re: t0025 flakey?
Message-ID: <20190206171517.s5lskawpdodc74ui@tb-raspi4>
URL: https://gitlist.dev/e/20190206171517.s5lskawpdodc74ui%40tb-raspi4
In-Reply-To: <nycvar.QRO.7.76.6.1902061450280.41@tvgsbejvaqbjf.bet>

```
On Wed, Feb 06, 2019 at 02:52:53PM +0100, Johannes Schindelin wrote:
> Hi Gábor,
>
> On Wed, 6 Feb 2019, SZEDER Gábor wrote:
>
> > On Wed, Feb 06, 2019 at 11:25:38AM +0100, Johannes Schindelin wrote:
> >
> > > at first I thought that those intermittent test failures were limited
> > > to Windows, but they are not: I can see it now in a build on 32-bit
> > > Linux.
> > > Full logs here:
> > >
> > > https://dev.azure.com/gitgitgadget/git/_build/results?buildId=1032&_a=summary&view=ms.vss-test-web.build-test-results-tab
> > >
> > > Excerpt from the failing test case:
> > >
> > > -- snip --
> > > not ok 2 - renormalize CRLF in repo
> > >  expecting success:
> > > 	echo "*.txt text=auto" >.gitattributes &&
> > > 	git add --renormalize "*.txt" &&
> > > 	cat >expect <<-\EOF &&
> > > 	i/lf w/crlf attr/text=auto CRLF.txt
> > > 	i/lf w/lf attr/text=auto LF.txt
> > > 	i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
> > > 	EOF
> > > 	git ls-files --eol |
> > > 	sed -e "s/	/ /g" -e "s/  */ /g" |
> > > 	sort >actual &&
> > > 	test_cmp expect actual
> > >
> > > + echo *.txt text=auto
> > > + git add --renormalize *.txt
> > > + cat
> > > + sort
> > > + sed -e s/	/ /g -e s/  */ /g
> > > + git ls-files --eol
> > > + test_cmp expect actual
> > > + diff -u expect actual
> > > --- expect	2019-02-06 09:39:42.080733629 +0000
> > > +++ actual	2019-02-06 09:39:42.088733629 +0000
> > > @@ -1,3 +1,3 @@
> > > -i/lf w/crlf attr/text=auto CRLF.txt
> > > +i/crlf w/crlf attr/text=auto CRLF.txt
> > >  i/lf w/lf attr/text=auto LF.txt
> > > -i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
> > > +i/mixed w/mixed attr/text=auto CRLF_mix_LF.txt
> > > error: last command exited with $?=1
> > > -- snap --
> > >
> > > Any ideas?
> >
> > I reported this and Peff looked into it on the way to Git Merge, but
> > not working solution yet.
> >
> > https://public-inbox.org/git/20190129225121.GD1895@sigill.intra.peff.net/T/#u
>
> Thank you!
> Dscho

I shortly looked into the pointers here -
Is t0025 flaky after the fix from Peff:

[PATCH] add: use separate ADD_CACHE_RENORMALIZE flag

Or has it always been shaky ?
Does anybody know ?

```

## SZEDER Gábor, 2019-02-06 17:39

Subject: Re: t0025 flakey?
Message-ID: <20190206173932.GM10587@szeder.dev>
URL: https://gitlist.dev/e/20190206173932.GM10587%40szeder.dev
In-Reply-To: <20190206171517.s5lskawpdodc74ui@tb-raspi4>

```
On Wed, Feb 06, 2019 at 05:15:17PM +0000, Torsten Bögershausen wrote:
> On Wed, Feb 06, 2019 at 02:52:53PM +0100, Johannes Schindelin wrote:
> > Hi Gábor,
> >
> > On Wed, 6 Feb 2019, SZEDER Gábor wrote:
> >
> > > On Wed, Feb 06, 2019 at 11:25:38AM +0100, Johannes Schindelin wrote:
> > >
> > > > at first I thought that those intermittent test failures were limited
> > > > to Windows, but they are not: I can see it now in a build on 32-bit
> > > > Linux.
> > > > Full logs here:
> > > >
> > > > https://dev.azure.com/gitgitgadget/git/_build/results?buildId=1032&_a=summary&view=ms.vss-test-web.build-test-results-tab
> > > >
> > > > Excerpt from the failing test case:
> > > >
> > > > -- snip --
> > > > not ok 2 - renormalize CRLF in repo
> > > >  expecting success:
> > > > 	echo "*.txt text=auto" >.gitattributes &&
> > > > 	git add --renormalize "*.txt" &&
> > > > 	cat >expect <<-\EOF &&
> > > > 	i/lf w/crlf attr/text=auto CRLF.txt
> > > > 	i/lf w/lf attr/text=auto LF.txt
> > > > 	i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
> > > > 	EOF
> > > > 	git ls-files --eol |
> > > > 	sed -e "s/	/ /g" -e "s/  */ /g" |
> > > > 	sort >actual &&
> > > > 	test_cmp expect actual
> > > >
> > > > + echo *.txt text=auto
> > > > + git add --renormalize *.txt
> > > > + cat
> > > > + sort
> > > > + sed -e s/	/ /g -e s/  */ /g
> > > > + git ls-files --eol
> > > > + test_cmp expect actual
> > > > + diff -u expect actual
> > > > --- expect	2019-02-06 09:39:42.080733629 +0000
> > > > +++ actual	2019-02-06 09:39:42.088733629 +0000
> > > > @@ -1,3 +1,3 @@
> > > > -i/lf w/crlf attr/text=auto CRLF.txt
> > > > +i/crlf w/crlf attr/text=auto CRLF.txt
> > > >  i/lf w/lf attr/text=auto LF.txt
> > > > -i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
> > > > +i/mixed w/mixed attr/text=auto CRLF_mix_LF.txt
> > > > error: last command exited with $?=1
> > > > -- snap --
> > > >
> > > > Any ideas?
> > >
> > > I reported this and Peff looked into it on the way to Git Merge, but
> > > not working solution yet.
> > >
> > > https://public-inbox.org/git/20190129225121.GD1895@sigill.intra.peff.net/T/#u
> >
> > Thank you!
> > Dscho
> 
> I shortly looked into the pointers here -
> Is t0025 flaky after the fix from Peff:
> 
> [PATCH] add: use separate ADD_CACHE_RENORMALIZE flag
> 
> Or has it always been shaky ?
> Does anybody know ?

I sort-of bisected it, and it pointed to Peff's fix.

Running 't0025 --stress' in the merge of 'sg/stress-test' and
'jk/add-ignore-errors-bit-assignment-fix' results in a failure within
seconds or <20 repetitions.  In the merge with
'jk/add-ignore-errors-bit-assignment-fix^' it runs successfully for
thousands of repetitions.



```

## Randall S. Becker, 2019-02-06 18:00

Subject: RE: t0025 flakey?
Message-ID: <005501d4be45$e4121c40$ac3654c0$@nexbridge.com>
URL: https://gitlist.dev/e/005501d4be45%24e4121c40%24ac3654c0%24%40nexbridge.com
In-Reply-To: <20190206171517.s5lskawpdodc74ui@tb-raspi4>

```
On February 6, 2019 12:15, Torsten Bögershausen wrote:
> To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> Cc: SZEDER Gábor <szeder.dev@gmail.com>; Jeff King <peff@peff.net>;
> git@vger.kernel.org
> Subject: Re: t0025 flakey?
> 
> On Wed, Feb 06, 2019 at 02:52:53PM +0100, Johannes Schindelin wrote:
> > Hi Gábor,
> >
> > On Wed, 6 Feb 2019, SZEDER Gábor wrote:
> >
> > > On Wed, Feb 06, 2019 at 11:25:38AM +0100, Johannes Schindelin wrote:
> > >
> > > > at first I thought that those intermittent test failures were
> > > > limited to Windows, but they are not: I can see it now in a build
> > > > on 32-bit Linux.
> > > > Full logs here:
> > > >
> > > > https://dev.azure.com/gitgitgadget/git/_build/results?buildId=1032
> > > > &_a=summary&view=ms.vss-test-web.build-test-results-tab
> > > >
> > > > Excerpt from the failing test case:
> > > >
> > > > -- snip --
> > > > not ok 2 - renormalize CRLF in repo  expecting success:
> > > > 	echo "*.txt text=auto" >.gitattributes &&
> > > > 	git add --renormalize "*.txt" &&
> > > > 	cat >expect <<-\EOF &&
> > > > 	i/lf w/crlf attr/text=auto CRLF.txt
> > > > 	i/lf w/lf attr/text=auto LF.txt
> > > > 	i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
> > > > 	EOF
> > > > 	git ls-files --eol |
> > > > 	sed -e "s/	/ /g" -e "s/  */ /g" |
> > > > 	sort >actual &&
> > > > 	test_cmp expect actual
> > > >
> > > > + echo *.txt text=auto
> > > > + git add --renormalize *.txt
> > > > + cat
> > > > + sort
> > > > + sed -e s/	/ /g -e s/  */ /g
> > > > + git ls-files --eol
> > > > + test_cmp expect actual
> > > > + diff -u expect actual
> > > > --- expect	2019-02-06 09:39:42.080733629 +0000
> > > > +++ actual	2019-02-06 09:39:42.088733629 +0000
> > > > @@ -1,3 +1,3 @@
> > > > -i/lf w/crlf attr/text=auto CRLF.txt
> > > > +i/crlf w/crlf attr/text=auto CRLF.txt
> > > >  i/lf w/lf attr/text=auto LF.txt
> > > > -i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
> > > > +i/mixed w/mixed attr/text=auto CRLF_mix_LF.txt
> > > > error: last command exited with $?=1
> > > > -- snap --
> > > >
> > > > Any ideas?
> > >
> > > I reported this and Peff looked into it on the way to Git Merge, but
> > > not working solution yet.
> > >
> > > https://public-inbox.org/git/20190129225121.GD1895@sigill.intra.peff
> > > .net/T/#u
> >
> > Thank you!
> > Dscho
> 
> I shortly looked into the pointers here - Is t0025 flaky after the fix
from Peff:
> 
> [PATCH] add: use separate ADD_CACHE_RENORMALIZE flag
> 
> Or has it always been shaky ?
> Does anybody know ?

The NonStop port has traditionally had issues with t0025, which we tended to
ignore because things did work. We wrote those off as bash issues in t0025
since they seemed to be corrected when we picked up a new bash version about
a year ago. I will keep monitoring this, particularly when 2.21 comes out.

Cheers,
Randall

-- Brief whoami:
 NonStop developer since approximately 211288444200000000
 UNIX developer since approximately 421664400
-- In my real life, I talk too much.




```

## Jeff King, 2019-02-07 02:00

Subject: [PATCH] add_to_index(): convert forgotten HASH_RENORMALIZE check
Message-ID: <20190207020022.GA29974@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20190207020022.GA29974%40sigill.intra.peff.net
In-Reply-To: <20190206104243.GJ10587@szeder.dev>

```
On Wed, Feb 06, 2019 at 11:42:43AM +0100, SZEDER Gábor wrote:

> I reported this and Peff looked into it on the way to Git Merge, but
> not working solution yet.
> 
> https://public-inbox.org/git/20190129225121.GD1895@sigill.intra.peff.net/T/#u

Oof. Well, now I know why my attempts to fix the test failed. It was not
my new test that was failing at all, but rather the existing test. Which
implies that I severely bungled the actual code change.

Armed with that knowledge, it was pretty easy to find said bungling. The
fix is below.

Junio, this should go on top of jk/add-ignore-errors-bit-assignment-fix
as soon as possible, as the regression is already in master. And I'll go
find a brown paper bag. ;)

-- >8 --
Subject: [PATCH] add_to_index(): convert forgotten HASH_RENORMALIZE check

Commit 9e5da3d055 (add: use separate ADD_CACHE_RENORMALIZE flag,
2019-01-17) switched out using HASH_RENORMALIZE in our flags field for a
new ADD_CACHE_RENORMALIZE flag. However, it forgot to convert one of the
checks for HASH_RENORMALIZE into the new flag, which totally broke "git
add --renormalize".

To make matters even more confusing, the resulting code would racily
pass the tests!  The forgotten check was responsible for defeating the
up-to-date check of the index entry. That meant that "git add
--renormalize" would refuse to renormalize things that appeared
stat-clean. But most of the time the test commands run fast enough that
the file mtime is the same as the index mtime. And thus we err on the
conservative side and re-hash the file, which is what "--renormalize"
would have wanted.

But if you're unlucky and cross that one-second boundary between writing
the file and writing the index (which is more likely to happen on a slow
or heavily-loaded system), then the file appears stat-clean. And
"--renormalize" would effectively do nothing.

The fix is straightforward: convert this check to use the right flag.

Noticed-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
---
 read-cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/read-cache.c b/read-cache.c
index 9783c493a3..accc059951 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -746,7 +746,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
 	if (ignore_case) {
 		adjust_dirname_case(istate, ce->name);
 	}
-	if (!(flags & HASH_RENORMALIZE)) {
+	if (!(flags & ADD_CACHE_RENORMALIZE)) {
 		alias = index_file_exists(istate, ce->name,
 					  ce_namelen(ce), ignore_case);
 		if (alias &&
-- 
2.20.1.1122.g2972e48916


```

## Torsten Bögershausen, 2019-02-07 04:18

Subject: Re: [PATCH] add_to_index(): convert forgotten HASH_RENORMALIZE check
Message-ID: <20190207041802.ai25fc64sqfg2h66@tb-raspi4>
URL: https://gitlist.dev/e/20190207041802.ai25fc64sqfg2h66%40tb-raspi4
In-Reply-To: <20190207020022.GA29974@sigill.intra.peff.net>

```
On Wed, Feb 06, 2019 at 09:00:22PM -0500, Jeff King wrote:
> On Wed, Feb 06, 2019 at 11:42:43AM +0100, SZEDER Gábor wrote:
>
> > I reported this and Peff looked into it on the way to Git Merge, but
> > not working solution yet.
> >
> > https://public-inbox.org/git/20190129225121.GD1895@sigill.intra.peff.net/T/#u
>
> Oof. Well, now I know why my attempts to fix the test failed. It was not
> my new test that was failing at all, but rather the existing test. Which
> implies that I severely bungled the actual code change.
>
> Armed with that knowledge, it was pretty easy to find said bungling. The
> fix is below.
>
> Junio, this should go on top of jk/add-ignore-errors-bit-assignment-fix
> as soon as possible, as the regression is already in master. And I'll go
> find a brown paper bag. ;)
>
> -- >8 --
> Subject: [PATCH] add_to_index(): convert forgotten HASH_RENORMALIZE check
>
> Commit 9e5da3d055 (add: use separate ADD_CACHE_RENORMALIZE flag,
> 2019-01-17) switched out using HASH_RENORMALIZE in our flags field for a
> new ADD_CACHE_RENORMALIZE flag. However, it forgot to convert one of the
> checks for HASH_RENORMALIZE into the new flag, which totally broke "git
> add --renormalize".
>
> To make matters even more confusing, the resulting code would racily
> pass the tests!  The forgotten check was responsible for defeating the
> up-to-date check of the index entry. That meant that "git add
> --renormalize" would refuse to renormalize things that appeared
> stat-clean. But most of the time the test commands run fast enough that
> the file mtime is the same as the index mtime. And thus we err on the
> conservative side and re-hash the file, which is what "--renormalize"
> would have wanted.
>
> But if you're unlucky and cross that one-second boundary between writing
> the file and writing the index (which is more likely to happen on a slow
> or heavily-loaded system), then the file appears stat-clean. And
> "--renormalize" would effectively do nothing.
>
> The fix is straightforward: convert this check to use the right flag.
>
> Noticed-by: SZEDER Gábor <szeder.dev@gmail.com>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  read-cache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/read-cache.c b/read-cache.c
> index 9783c493a3..accc059951 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -746,7 +746,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
>  	if (ignore_case) {
>  		adjust_dirname_case(istate, ce->name);
>  	}
> -	if (!(flags & HASH_RENORMALIZE)) {
> +	if (!(flags & ADD_CACHE_RENORMALIZE)) {
>  		alias = index_file_exists(istate, ce->name,
>  					  ce_namelen(ce), ignore_case);
>  		if (alias &&
> --
> 2.20.1.1122.g2972e48916
>

Ack, of course.

And trying to answer an older question:

>>>The reason appears to be wrong bit mask usage
>>>#define ADD_CACHE_IGNORE_ERRORS    4
>>>and
>>>#define HASH_RENORMALIZE  4

What if we had renamed "flags" like this ?

diff --git a/read-cache.c b/read-cache.c
index 5096e395ee..f93d291613 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -696,20 +696,20 @@ void set_object_name_for_intent_to_add_entry(struct cache_entry *ce)
 	oidcpy(&ce->oid, &oid);
 }

-int add_to_index(struct index_state *istate, const char *path, struct stat *st, int flags)
+int add_to_index(struct index_state *istate, const char *path, struct stat *st, int add_cache_flags)
 {
 	int namelen, was_same;
 	mode_t st_mode = st->st_mode;
 	struct cache_entry *ce, *alias = NULL;
 	unsigned ce_option = CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE|CE_MATCH_RACY_IS_DIRTY;
-	int verbose = flags & (ADD_CACHE_VERBOSE | ADD_CACHE_PRETEND);
-	int pretend = flags & ADD_CACHE_PRETEND;
-	int intent_only = flags & ADD_CACHE_INTENT;
+	int verbose = add_cache_flags & (ADD_CACHE_VERBOSE | ADD_CACHE_PRETEND);
+	int pretend = add_cache_flags & ADD_CACHE_PRETEND;
+	int intent_only = add_cache_flags & ADD_CACHE_INTENT;
 	int add_option = (ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE|
 			  (intent_only ? ADD_CACHE_NEW_ONLY : 0));
 	int hash_flags = HASH_WRITE_OBJECT;

-	if (flags & ADD_CACHE_RENORMALIZE)
+	if (add_cache_flags & ADD_CACHE_RENORMALIZE)
 		hash_flags |= HASH_RENORMALIZE;

 	if (!S_ISREG(st_mode) && !S_ISLNK(st_mode) && !S_ISDIR(st_mode))
@@ -750,7 +750,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
 	if (ignore_case) {
 		adjust_dirname_case(istate, ce->name);
 	}
-	if (!(flags & HASH_RENORMALIZE)) {
+	if (!(add_cache_flags & HASH_RENORMALIZE)) {
 		alias = index_file_exists(istate, ce->name,
 					  ce_namelen(ce), ignore_case);
 		if (alias &&

```

## Johannes Schindelin, 2019-02-07 13:17

Subject: Re: [PATCH] add_to_index(): convert forgotten HASH_RENORMALIZE check
Message-ID: <nycvar.QRO.7.76.6.1902071416410.41@tvgsbejvaqbjf.bet>
URL: https://gitlist.dev/e/nycvar.QRO.7.76.6.1902071416410.41%40tvgsbejvaqbjf.bet
In-Reply-To: <20190207020022.GA29974@sigill.intra.peff.net>

```
Hi Peff,

On Wed, 6 Feb 2019, Jeff King wrote:

> On Wed, Feb 06, 2019 at 11:42:43AM +0100, SZEDER Gábor wrote:
> 
> > I reported this and Peff looked into it on the way to Git Merge, but
> > not working solution yet.
> > 
> > https://public-inbox.org/git/20190129225121.GD1895@sigill.intra.peff.net/T/#u
> 
> Oof. Well, now I know why my attempts to fix the test failed. It was not
> my new test that was failing at all, but rather the existing test. Which
> implies that I severely bungled the actual code change.
> 
> Armed with that knowledge, it was pretty easy to find said bungling. The
> fix is below.
> 
> Junio, this should go on top of jk/add-ignore-errors-bit-assignment-fix
> as soon as possible, as the regression is already in master. And I'll go
> find a brown paper bag. ;)

Thank you *so* much for the quick fix!
Dscho

> -- >8 --
> Subject: [PATCH] add_to_index(): convert forgotten HASH_RENORMALIZE check
> 
> Commit 9e5da3d055 (add: use separate ADD_CACHE_RENORMALIZE flag,
> 2019-01-17) switched out using HASH_RENORMALIZE in our flags field for a
> new ADD_CACHE_RENORMALIZE flag. However, it forgot to convert one of the
> checks for HASH_RENORMALIZE into the new flag, which totally broke "git
> add --renormalize".
> 
> To make matters even more confusing, the resulting code would racily
> pass the tests!  The forgotten check was responsible for defeating the
> up-to-date check of the index entry. That meant that "git add
> --renormalize" would refuse to renormalize things that appeared
> stat-clean. But most of the time the test commands run fast enough that
> the file mtime is the same as the index mtime. And thus we err on the
> conservative side and re-hash the file, which is what "--renormalize"
> would have wanted.
> 
> But if you're unlucky and cross that one-second boundary between writing
> the file and writing the index (which is more likely to happen on a slow
> or heavily-loaded system), then the file appears stat-clean. And
> "--renormalize" would effectively do nothing.
> 
> The fix is straightforward: convert this check to use the right flag.
> 
> Noticed-by: SZEDER Gábor <szeder.dev@gmail.com>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  read-cache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/read-cache.c b/read-cache.c
> index 9783c493a3..accc059951 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -746,7 +746,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
>  	if (ignore_case) {
>  		adjust_dirname_case(istate, ce->name);
>  	}
> -	if (!(flags & HASH_RENORMALIZE)) {
> +	if (!(flags & ADD_CACHE_RENORMALIZE)) {
>  		alias = index_file_exists(istate, ce->name,
>  					  ce_namelen(ce), ignore_case);
>  		if (alias &&
> -- 
> 2.20.1.1122.g2972e48916
> 
> 
```

## Randall S. Becker, 2019-02-07 16:58

Subject: RE: t0025 flakey?
Message-ID: <001501d4bf06$506b8640$f14292c0$@nexbridge.com>
URL: https://gitlist.dev/e/001501d4bf06%24506b8640%24f14292c0%24%40nexbridge.com
In-Reply-To: <20190206171517.s5lskawpdodc74ui@tb-raspi4>

```
On February 6, 2019 13:01, I wrote:
> On February 6, 2019 12:15, Torsten Bögershausen wrote:
> > To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> > Cc: SZEDER Gábor <szeder.dev@gmail.com>; Jeff King <peff@peff.net>;
> > git@vger.kernel.org
> > Subject: Re: t0025 flakey?
> >
> > On Wed, Feb 06, 2019 at 02:52:53PM +0100, Johannes Schindelin wrote:
> > > Hi Gábor,
> > >
> > > On Wed, 6 Feb 2019, SZEDER Gábor wrote:
> > >
> > > > On Wed, Feb 06, 2019 at 11:25:38AM +0100, Johannes Schindelin
> wrote:
> > > >
> > > > > at first I thought that those intermittent test failures were
> > > > > limited to Windows, but they are not: I can see it now in a
> > > > > build on 32-bit Linux.
> > > > > Full logs here:
> > > > >
> > > > > https://dev.azure.com/gitgitgadget/git/_build/results?buildId=10
> > > > > 32 &_a=summary&view=ms.vss-test-web.build-test-results-tab
> > > > >
> > > > > Excerpt from the failing test case:
> > > > >
> > > > > -- snip --
> > > > > not ok 2 - renormalize CRLF in repo  expecting success:
> > > > > 	echo "*.txt text=auto" >.gitattributes &&
> > > > > 	git add --renormalize "*.txt" &&
> > > > > 	cat >expect <<-\EOF &&
> > > > > 	i/lf w/crlf attr/text=auto CRLF.txt
> > > > > 	i/lf w/lf attr/text=auto LF.txt
> > > > > 	i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
> > > > > 	EOF
> > > > > 	git ls-files --eol |
> > > > > 	sed -e "s/	/ /g" -e "s/  */ /g" |
> > > > > 	sort >actual &&
> > > > > 	test_cmp expect actual
> > > > >
> > > > > + echo *.txt text=auto
> > > > > + git add --renormalize *.txt
> > > > > + cat
> > > > > + sort
> > > > > + sed -e s/	/ /g -e s/  */ /g
> > > > > + git ls-files --eol
> > > > > + test_cmp expect actual
> > > > > + diff -u expect actual
> > > > > --- expect	2019-02-06 09:39:42.080733629 +0000
> > > > > +++ actual	2019-02-06 09:39:42.088733629 +0000
> > > > > @@ -1,3 +1,3 @@
> > > > > -i/lf w/crlf attr/text=auto CRLF.txt
> > > > > +i/crlf w/crlf attr/text=auto CRLF.txt
> > > > >  i/lf w/lf attr/text=auto LF.txt -i/lf w/mixed attr/text=auto
> > > > > CRLF_mix_LF.txt
> > > > > +i/mixed w/mixed attr/text=auto CRLF_mix_LF.txt
> > > > > error: last command exited with $?=1
> > > > > -- snap --
> > > > >
> > > > > Any ideas?
> > > >
> > > > I reported this and Peff looked into it on the way to Git Merge,
> > > > but not working solution yet.
> > > >
> > > > https://public-inbox.org/git/20190129225121.GD1895@sigill.intra.pe
> > > > ff
> > > > .net/T/#u
> > >
> > > Thank you!
> > > Dscho
> >
> > I shortly looked into the pointers here - Is t0025 flaky after the fix
from
> Peff:
> >
> > [PATCH] add: use separate ADD_CACHE_RENORMALIZE flag
> >
> > Or has it always been shaky ?
> > Does anybody know ?
> 
> The NonStop port has traditionally had issues with t0025, which we tended
> to ignore because things did work. We wrote those off as bash issues in
> t0025 since they seemed to be corrected when we picked up a new bash
> version about a year ago. I will keep monitoring this, particularly when
2.21
> comes out.

FYI: t0020-t0027 all passed on the NonStop port for 2.21.0-rc0 - so no
issues for us on this one.

Cheers,
Randall

-- Brief whoami:
 NonStop developer since approximately 211288444200000000
 UNIX developer since approximately 421664400
-- In my real life, I talk too much.




```

## Junio C Hamano, 2019-02-07 17:39

Subject: Re: t0025 flakey?
Message-ID: <xmqqtvhfpkep.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqtvhfpkep.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <001501d4bf06$506b8640$f14292c0$@nexbridge.com>

```
"Randall S. Becker" <rsbecker@nexbridge.com> writes:

> On February 6, 2019 13:01, I wrote:
>> On February 6, 2019 12:15, Torsten Bögershausen wrote:
>> > To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
>> > ...
>> > [PATCH] add: use separate ADD_CACHE_RENORMALIZE flag
>> >
>> > Or has it always been shaky ?
>> > Does anybody know ?
>> 
>> The NonStop port has traditionally had issues with t0025, which we tended
>> to ignore because things did work. We wrote those off as bash issues in
>> t0025 since they seemed to be corrected when we picked up a new bash
>> version about a year ago. I will keep monitoring this, particularly when
> 2.21
>> comes out.
>
> FYI: t0020-t0027 all passed on the NonStop port for 2.21.0-rc0 - so no
> issues for us on this one.

Yup, the preview has both the renormalize fix and another hotfix for
it Peff made.  Thanks all for quick fixes and confirmations.

```

## Jeff King, 2019-02-07 21:00

Subject: Re: [PATCH] add_to_index(): convert forgotten HASH_RENORMALIZE check
Message-ID: <20190207210009.GA30825@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20190207210009.GA30825%40sigill.intra.peff.net
In-Reply-To: <20190207041802.ai25fc64sqfg2h66@tb-raspi4>

```
On Thu, Feb 07, 2019 at 04:18:02AM +0000, Torsten Bögershausen wrote:

> And trying to answer an older question:
> 
> >>>The reason appears to be wrong bit mask usage
> >>>#define ADD_CACHE_IGNORE_ERRORS    4
> >>>and
> >>>#define HASH_RENORMALIZE  4
> 
> What if we had renamed "flags" like this ?
> [...]
> -int add_to_index(struct index_state *istate, const char *path, struct stat *st, int flags)
> +int add_to_index(struct index_state *istate, const char *path, struct stat *st, int add_cache_flags)

Yes, changing the name of the variable in the original patch would have
caught this case. I don't know if it is worth doing now or not (the code
as it is now seems pretty clear to me, but of course I've looked at it a
lot lately).

-Peff

```

## SZEDER Gábor, 2019-02-07 23:57

Subject: Re: t0025 flakey?
Message-ID: <20190207235726.GR10587@szeder.dev>
URL: https://gitlist.dev/e/20190207235726.GR10587%40szeder.dev
In-Reply-To: <001501d4bf06$506b8640$f14292c0$@nexbridge.com>

```
On Thu, Feb 07, 2019 at 11:58:08AM -0500, Randall S. Becker wrote:
> > The NonStop port has traditionally had issues with t0025, which we tended
> > to ignore because things did work. We wrote those off as bash issues in
> > t0025 since they seemed to be corrected when we picked up a new bash
> > version about a year ago. I will keep monitoring this, particularly when
> 2.21
> > comes out.
> 
> FYI: t0020-t0027 all passed on the NonStop port for 2.21.0-rc0 - so no
> issues for us on this one.

Note that t0021 is very likely flaky on NonStop, too:

  https://public-inbox.org/git/20190111140408.GC840@szeder.dev/T/#u


```

## Randall S. Becker, 2019-02-08 10:21

Subject: RE: t0025 flakey?
Message-ID: <000901d4bf98$1ab08fe0$5011afa0$@nexbridge.com>
URL: https://gitlist.dev/e/000901d4bf98%241ab08fe0%245011afa0%24%40nexbridge.com
In-Reply-To: <20190207235726.GR10587@szeder.dev>

```
On February 7, 2019 18:57, SZEDER Gábor wrote:
> On Thu, Feb 07, 2019 at 11:58:08AM -0500, Randall S. Becker wrote:
> > > The NonStop port has traditionally had issues with t0025, which we
> > > tended to ignore because things did work. We wrote those off as bash
> > > issues in
> > > t0025 since they seemed to be corrected when we picked up a new bash
> > > version about a year ago. I will keep monitoring this, particularly
> > > when
> > 2.21
> > > comes out.
> >
> > FYI: t0020-t0027 all passed on the NonStop port for 2.21.0-rc0 - so no
> > issues for us on this one.
> 
> Note that t0021 is very likely flaky on NonStop, too:
> 
>   https://public-inbox.org/git/20190111140408.GC840@szeder.dev/T/#u

We will keep a watch on it, thanks. t0021 has been stable on this platform for at least a year and passes for 2.21.0-rc0 as well as 2.20.0.

Cheers,
Randall


```
