login
Header Space

 
 

Re: [PATCH 2/2] read-cache.c: fix timestamp comparison

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <gitster@...>
Cc: <git@...>
Date: Monday, January 21, 2008 - 2:47 pm

On Mon, 21 Jan 2008, Junio C Hamano wrote:

I really don't think this is the right fix.

The real problem seems to be that the whole "racy_timestamp()" thing 
*hides* the bug, and your change actually makes racy_timestamp() just hide 
things even more (by making it trigger all the time).

Adding a "sleep 1" to your test-case (appended) actually makes it fail 
reliably (without your hack - with your "+1" hack I assume you'd need to 
make the sleep longer).

So the problem is that the test-suite actually *hid* the bug by doing 
thigns so fast that the racy code triggered, and that in turn somehow 
fixed things up. 

Will experiment more now that I have a case that reliably fails. The 
commit that causes this literally shouldn't have caused any semantic 
changes at all, so this is rather interesting.

		Linus

---
#!/bin/sh

test_description='reduced 7501'

. ./test-lib.sh

test_expect_success setup '

        >file &&
        git add file &&
        test_tick &&
        git commit -m initial

'

if test -f ../trace.log
then
        mv ../trace.log ../trace.log.old
fi

test_expect_success 'partial commit that involves removal (1)' '

        test_tick &&
        git rm --cached file &&
        mv file elif &&
	sleep 1 &&
        git add elif &&
	sleep 1 &&

        strace -v -o ../trace.log git commit -m "Partial: add elif" elif &&

        git diff-tree --name-status HEAD^ HEAD >current &&
        echo "A	elif" >expected &&
        diff expected current

'

test_done

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
What's not in 'master', and likely not to be in, until 1.5.4, Junio C Hamano, (Sun Jan 20, 10:37 pm)
[PATCH 2/2] read-cache.c: fix timestamp comparison, Junio C Hamano, (Mon Jan 21, 4:46 am)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Linus Torvalds, (Mon Jan 21, 2:47 pm)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Linus Torvalds, (Mon Jan 21, 3:09 pm)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Linus Torvalds, (Mon Jan 21, 3:24 pm)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Junio C Hamano, (Mon Jan 21, 4:38 pm)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Linus Torvalds, (Mon Jan 21, 5:22 pm)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Linus Torvalds, (Tue Jan 22, 6:00 pm)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Junio C Hamano, (Tue Jan 22, 11:34 pm)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Linus Torvalds, (Tue Jan 22, 11:53 pm)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Junio C Hamano, (Tue Jan 22, 5:47 am)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Linus Torvalds, (Tue Jan 22, 1:25 pm)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Junio C Hamano, (Mon Jan 21, 6:02 pm)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Johannes Schindelin, (Mon Jan 21, 3:26 pm)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Linus Torvalds, (Mon Jan 21, 3:47 pm)
Re: [PATCH 2/2] read-cache.c: fix timestamp comparison, Johannes Schindelin, (Mon Jan 21, 3:06 pm)
speck-geostationary