Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts

2018-07-11 Thread Junio C Hamano
Elijah Newren  writes:

> On Mon, Jul 9, 2018 at 1:22 PM, Elijah Newren  wrote:
>> On Mon, Jul 9, 2018 at 10:53 AM, Junio C Hamano  wrote:
>>> Elijah Newren  writes:
>>>
 When a merge succeeds, we expect the resulting contents to depend only
 upon the trees and blobs of the branches involved and of their merge
 base(s).  Unfortunately, there are currently about half a dozen cases
 where the contents of a "successful" merge depend on the relative
 commit timestamps of the merge bases.  Document these with testcases.

 (This series came out of looking at modifying how file collision
 conflict types are handled, as discussed at [1].  I discovered these
 issues while working on that topic.)
>>>
>>> I have a topic branch for this series but not merged to 'pu' as
>>> test-lint gives these:
>>>
> ...
>>
>> ... here's a fixup to the topic; as you pointed out, the exact contents
>> of the script being written were actually irrelevant; it was just an
>> input to a merge.
>>
>> -- 8< --
>> Subject: [PATCH] fixup! t6036: add a failed conflict detection case: regular
>>  files, different modes
>>
>
> Does a 'fixup!' commit require a Signed-off-by?  Just realized that
> this one didn't have it, though I don't know if it's necessary.  If it
> is:
>
> Signed-off-by: Elijah Newren 

Thanks.  I queued it separately before running out of time Monday,
but will actually squash it in to the main patch.



Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts

2018-07-10 Thread Elijah Newren
On Mon, Jul 9, 2018 at 1:22 PM, Elijah Newren  wrote:
> On Mon, Jul 9, 2018 at 10:53 AM, Junio C Hamano  wrote:
>> Elijah Newren  writes:
>>
>>> When a merge succeeds, we expect the resulting contents to depend only
>>> upon the trees and blobs of the branches involved and of their merge
>>> base(s).  Unfortunately, there are currently about half a dozen cases
>>> where the contents of a "successful" merge depend on the relative
>>> commit timestamps of the merge bases.  Document these with testcases.
>>>
>>> (This series came out of looking at modifying how file collision
>>> conflict types are handled, as discussed at [1].  I discovered these
>>> issues while working on that topic.)
>>
>> I have a topic branch for this series but not merged to 'pu' as
>> test-lint gives these:
>>
...
>
> ... here's a fixup to the topic; as you pointed out, the exact contents
> of the script being written were actually irrelevant; it was just an
> input to a merge.
>
> -- 8< --
> Subject: [PATCH] fixup! t6036: add a failed conflict detection case: regular
>  files, different modes
>

Does a 'fixup!' commit require a Signed-off-by?  Just realized that
this one didn't have it, though I don't know if it's necessary.  If it
is:

Signed-off-by: Elijah Newren 


Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts

2018-07-10 Thread Jeff King
On Tue, Jul 10, 2018 at 08:42:04AM -0700, Elijah Newren wrote:

> > test-lint is supposed to be run automatically as part of "make test" (or
> > "make prove"), unless you've specifically disabled it by setting
> > TEST_LINT. And it does complain for me with your patches. If it doesn't
> > for you, then we have a bug to fix. :)
> 
> Oh, this may be my bad.  Years ago someone pointed out that the
> testsuite could be run under 'prove', which provided nicer output and
> made sure to run the longest tests (e.g. the horrifically slow
> t9001-send-email.sh) first.  So my test alias is:
> 
>time prove -j7 --timer --state failed,slow,save t[0-9]*.sh ::
> "--root=/dev/shm"

Heh, OK, that makes sense.

> (with possibly different -j settings on different machines) and I just
> stopped running make test.  Didn't learn about the 'make prove'
> target, even though it's apparently now been there for nearly 8 years.

I have:

  GIT_TEST_OPTS = --root=/var/ram/git-tests
  GIT_PROVE_OPTS = -j16 --state=slow,save
  DEFAULT_TEST_TARGET = prove

in my config.mak. That lets me just do:

  make test

from the top-level to get a build-and-test. It also allows just "make"
from the "t" directory to do the right thing.  Slightly annoyingly,
"make test" in the "t" directory does the wrong thing, which bites me
about once a month. ;)

-Peff


Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts

2018-07-10 Thread Elijah Newren
On Mon, Jul 9, 2018 at 9:44 PM, Jeff King  wrote:
> On Mon, Jul 09, 2018 at 01:22:29PM -0700, Elijah Newren wrote:
>
>> Oh, I didn't know about test-lint.  Is there a place that documents
>> the various checks you run, so I can avoid slowing you down?  Ones I
>> know about:
>>
>> Already documented:
>>   * `make DEVELOPER=1` (from CodingGuidelines)
>>   * running tests (from SubmittingPatches)
>>
>> Stuff I've seen you mention in emails over time:
>>   * linux/scripts/checkpatch.pl
>>   * git grep -e '\' --and --not -e 'static inline' -- \*.h
>>   * make -C t/ test-lint
>
> test-lint is supposed to be run automatically as part of "make test" (or
> "make prove"), unless you've specifically disabled it by setting
> TEST_LINT. And it does complain for me with your patches. If it doesn't
> for you, then we have a bug to fix. :)

Oh, this may be my bad.  Years ago someone pointed out that the
testsuite could be run under 'prove', which provided nicer output and
made sure to run the longest tests (e.g. the horrifically slow
t9001-send-email.sh) first.  So my test alias is:

   time prove -j7 --timer --state failed,slow,save t[0-9]*.sh ::
"--root=/dev/shm"

(with possibly different -j settings on different machines) and I just
stopped running make test.  Didn't learn about the 'make prove'
target, even though it's apparently now been there for nearly 8 years.

> I won't be surprised, though, if you just ran "./t6036" manually before
> sending, since your patches literally didn't touch any other files.

That may also be true, though I would have missed it even if I had
code changes due to not being aware of 'make prove'.

> In theory we could push some of the linting down into the test scripts
> themselves (some of it, like the &&-linter, is there already by
> necessity). But it might also end up annoying, since usually dropping
> down to manual single-test runs means you're trying to debug something,
> and extra linting processes could get in the way.
>
>> Are there others?
>
> I like:
>
>   make SANITIZE=address,undefined test
>
> though it's pretty heavy-weight (but not nearly as much as valgrind).
> You probably also need BLK_SHA1=Yes, since the default DC_SHA1 has some
> unaligned loads that make UBSan complain. We should maybe teach the
> Makefile to do that by default.
>
> I've also been playing with clang's scan-build. It _did_ find a real bug
> recently, but it has a bunch of false positives.
>
> Stefan runs Coverity against pu periodically. IIRC It's a pain to run
> yourself, but the shared results can be mailed to you, or you can poke
> around at https://scan.coverity.com/projects/git. That _also_ has a ton
> of false positives, but it's good about cataloguing them so the periodic
> email usually just mentions the new ones.

Cool, thanks for the pointers.


Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts

2018-07-09 Thread Jeff King
On Mon, Jul 09, 2018 at 01:22:29PM -0700, Elijah Newren wrote:

> Oh, I didn't know about test-lint.  Is there a place that documents
> the various checks you run, so I can avoid slowing you down?  Ones I
> know about:
> 
> Already documented:
>   * `make DEVELOPER=1` (from CodingGuidelines)
>   * running tests (from SubmittingPatches)
> 
> Stuff I've seen you mention in emails over time:
>   * linux/scripts/checkpatch.pl
>   * git grep -e '\' --and --not -e 'static inline' -- \*.h
>   * make -C t/ test-lint

test-lint is supposed to be run automatically as part of "make test" (or
"make prove"), unless you've specifically disabled it by setting
TEST_LINT. And it does complain for me with your patches. If it doesn't
for you, then we have a bug to fix. :)

I won't be surprised, though, if you just ran "./t6036" manually before
sending, since your patches literally didn't touch any other files.

In theory we could push some of the linting down into the test scripts
themselves (some of it, like the &&-linter, is there already by
necessity). But it might also end up annoying, since usually dropping
down to manual single-test runs means you're trying to debug something,
and extra linting processes could get in the way.

> Are there others?

I like:

  make SANITIZE=address,undefined test

though it's pretty heavy-weight (but not nearly as much as valgrind).
You probably also need BLK_SHA1=Yes, since the default DC_SHA1 has some
unaligned loads that make UBSan complain. We should maybe teach the
Makefile to do that by default.

I've also been playing with clang's scan-build. It _did_ find a real bug
recently, but it has a bunch of false positives.

Stefan runs Coverity against pu periodically. IIRC It's a pain to run
yourself, but the shared results can be mailed to you, or you can poke
around at https://scan.coverity.com/projects/git. That _also_ has a ton
of false positives, but it's good about cataloguing them so the periodic
email usually just mentions the new ones.

-Peff


Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts

2018-07-09 Thread Elijah Newren
On Mon, Jul 9, 2018 at 10:53 AM, Junio C Hamano  wrote:
> Elijah Newren  writes:
>
>> When a merge succeeds, we expect the resulting contents to depend only
>> upon the trees and blobs of the branches involved and of their merge
>> base(s).  Unfortunately, there are currently about half a dozen cases
>> where the contents of a "successful" merge depend on the relative
>> commit timestamps of the merge bases.  Document these with testcases.
>>
>> (This series came out of looking at modifying how file collision
>> conflict types are handled, as discussed at [1].  I discovered these
>> issues while working on that topic.)
>
> I have a topic branch for this series but not merged to 'pu' as
> test-lint gives these:
>
> t6036-recursive-corner-cases.sh:1222: error: "export FOO=bar" is not portable 
> (please use FOO=bar && export FOO):   echo "export 
> PATH=~/bin:$PATH" >source_me.bash &&
> t6036-recursive-corner-cases.sh:1227: error: "export FOO=bar" is not portable 
> (please use FOO=bar && export FOO):   echo "export 
> PATH=~/bin:$PATH" >source_me.bash &&
> Makefile:77: recipe for target 'test-lint-shell-syntax' failed
> make: *** [test-lint-shell-syntax] Error 1
>
> Arguably these are false positives because "source_me.bash" file is
> a mere payload to go through the merge process to be munged and we
> never intend to actually execute its contents with bash, but then
> the test payload probably does not even have to be a string that
> triggers such a false positive to begin with ;-)

Oh, I didn't know about test-lint.  Is there a place that documents the various 
checks you run, so I can avoid slowing you down?  Ones I know about:

Already documented:
  * `make DEVELOPER=1` (from CodingGuidelines)
  * running tests (from SubmittingPatches)

Stuff I've seen you mention in emails over time:
  * linux/scripts/checkpatch.pl
  * git grep -e '\' --and --not -e 'static inline' -- \*.h
  * make -C t/ test-lint

Are there others?


Also, here's a fixup to the topic; as you pointed out, the exact contents
of the script being written were actually irrelevant; it was just an
input to a merge.

-- 8< --
Subject: [PATCH] fixup! t6036: add a failed conflict detection case: regular
 files, different modes

---
 t/t6036-recursive-corner-cases.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t6036-recursive-corner-cases.sh 
b/t/t6036-recursive-corner-cases.sh
index f8f7b30460..5a8fe061ab 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -1219,12 +1219,12 @@ test_expect_success 'setup conflicting modes for 
regular file' '
git tag A &&
 
git checkout -b B A &&
-   echo "export PATH=~/bin:$PATH" >source_me.bash &&
+   echo "command_to_run" >source_me.bash &&
git add source_me.bash &&
git commit -m B &&
 
git checkout -b C A &&
-   echo "export PATH=~/bin:$PATH" >source_me.bash &&
+   echo "command_to_run" >source_me.bash &&
git add source_me.bash &&
test_chmod +x source_me.bash &&
git commit -m C &&
-- 
2.18.0.135.gd4ea5491ab



Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts

2018-07-09 Thread Junio C Hamano
Elijah Newren  writes:

> SPOILER ALERT: This series contains answers to the "fun puzzle" at
>   
> https://public-inbox.org/git/CABPp-BFc1OLYKzS5rauOehvEugPc0oGMJp-NMEAmVMW7QR=4...@mail.gmail.com/
>
> When a merge succeeds, we expect the resulting contents to depend only
> upon the trees and blobs of the branches involved and of their merge
> base(s).  Unfortunately, there are currently about half a dozen cases
> where the contents of a "successful" merge depend on the relative
> commit timestamps of the merge bases.  Document these with testcases.
>
> (This series came out of looking at modifying how file collision
> conflict types are handled, as discussed at [1].  I discovered these
> issues while working on that topic.)

I have a topic branch for this series but not merged to 'pu' as
test-lint gives these:

t6036-recursive-corner-cases.sh:1222: error: "export FOO=bar" is not portable 
(please use FOO=bar && export FOO):   echo "export 
PATH=~/bin:$PATH" >source_me.bash &&
t6036-recursive-corner-cases.sh:1227: error: "export FOO=bar" is not portable 
(please use FOO=bar && export FOO):   echo "export 
PATH=~/bin:$PATH" >source_me.bash &&
Makefile:77: recipe for target 'test-lint-shell-syntax' failed
make: *** [test-lint-shell-syntax] Error 1

Arguably these are false positives because "source_me.bash" file is
a mere payload to go through the merge process to be munged and we
never intend to actually execute its contents with bash, but then
the test payload probably does not even have to be a string that
triggers such a false positive to begin with ;-)