threads / discuss / 52406

RE: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

Subject: RE: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

## tl;dr

20 messages between Dec 8, 2019 and Mar 12, 2020.

replies: 19people: 6as markdown or json

Nadav SInai· Dec 8, 2019, 10:30 UTC · lore

Hi, I'm curious if any of you had any luck in preventing that seg-fault in git-subtree script I'm encountering it myself using git 2.24.0.windows.2., seg-fault is in the same while loop (currently on line 757) When I tried your suggestion of adding the ($parents) ($rev) to the progress print I see that the last commit have only one revision printed like this:

259/290 (523) [271] (843dd34090d36dfabd6a2e3e8459a4887427313b)
(a69ee056f66acf66c63f89f55d26c0cc17036623)
259/290 (525) [273] (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
(843dd34090d36dfabd6a2e3e8459a4887427313b)
259/290 (527) [275] (82303752a428cf1d789ac9f156008adb2798b7b5)
(f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
259/290 (528) [276]
(7187897883c9fb4d33d4c87a02b876f8603728ff05f0945ae2ce9f98a35135)
259/290 (529) [277]
(a00a3665343439a426671958dd90ed0407a22cad9ac9f156008adb2798b7b5)
259/290 (530) [278]
(90beb94ebd331c457d79d05341453f5829a50bfcd4c87a02b876f8603728ff)
259/290 (531) [279]
(9582e0acbed1910173564e250f350b5cc4291a7f671958dd90ed0407a22cad)
259/290 (532) [280]
(f183930d6fabd3dccdddc5ec35d754ad28caf3b879d05341453f5829a50bfc)
259/290 (533) [281]
(c9309f3a38c41f7991d9e78ddb47f7e85b8521eb564e250f350b5cc4291a7f)
259/290 (534) [282]
(3bcf08f63a0e2b93ecc376bd679a16c80e99e7b1ddc5ec35d754ad28caf3b8)
259/290 (535) [283]
(134621bb55a0470cdf6519ce08d6909af43ce0e5d9e78ddb47f7e85b8521eb)
259/290 (536) [284]
(edb3471fbba29748f9784d29b3cee1dee2df4b37c376bd679a16c80e99e7b1)
259/290 (537) [285]
(dd947a095df07a32dfd56666a395a7c42b25ca116519ce08d6909af43ce0e5)
259/290 (538) [286]
(a639e09d2cbe1ea1149c080c1c95b8b018340ae2784d29b3cee1dee2df4b37)
C:/Program Files/Git/mingw64/libexec/git-core\git-subtree: line 757:
8853 Done                    eval "$grl"
      8854 Segmentation fault      (core dumped) | while read rev parents; do
    process_split_commit "$rev" "$parents" 0;
done
I downgraded git to 2.19.0-windows.1 and it works now.

I'm thankful for your insights Nadav Sinai Web Tech lead Philips-Algotec

Strain, Roger L.· Dec 9, 2019, 14:11 UTC · re: Nadav SInai · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

I haven't been able to find anything relating to the issue, but I also haven't had a repo that exposes the problem to test more thoroughly against. If this happens to be a public repo somewhere, I'd be more than happy to take a second look.

That being said, if the community feels it would be better to revert the changes that were introduced, I won't object. I've had to further customize the script for our internal use, and those changes aren't something that would be useful for the public at large. (A few changes relate to the presence/absence of a specific file, which I certainly wouldn't expect anyone else to have.) Short story is we're going to have to use a custom script going forward, so keeping or reverting the changes here make no difference to us. I still feel that the changes which were made make the script more correct, but clearly there's some undiagnosed logic error somewhere.

Honestly, I'm surprised we didn't see this particular issue show up on our own repo; it's ridiculously large and complex. At least if it had, I'd be able to troubleshoot it more reliably.

-- Roger Strain

-----Original Message-----
From: Nadav SInai <ns@nadavsinai.com>
To: roger.strain@swri.org
Cc: Johannes.Schindelin@gmx.de, git@vger.kernel.org, gitster@pobox.com,
marc@msys.ch, pclouds@gmail.com
Subject: RE: Regression in git-subtree.sh, introduced in 2.20.1, after
315a84f9aa0e2e629b0680068646b0032518ebed
Date: Sun, 08 Dec 2019 12:30:48 +0200
[EXTERNAL EMAIL]

Hi, I'm curious if any of you had any luck in preventing that seg-fault in git-subtree script I'm encountering it myself using git 2.24.0.windows.2., seg-fault is in the same while loop (currently on line 757) When I tried your suggestion of adding the ($parents) ($rev) to the progress print I see that the last commit have only one revision printed like this:

259/290 (523) [271] (843dd34090d36dfabd6a2e3e8459a4887427313b)
(a69ee056f66acf66c63f89f55d26c0cc17036623)
259/290 (525) [273] (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
(843dd34090d36dfabd6a2e3e8459a4887427313b)
259/290 (527) [275] (82303752a428cf1d789ac9f156008adb2798b7b5)
(f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
259/290 (528) [276]
(7187897883c9fb4d33d4c87a02b876f8603728ff05f0945ae2ce9f98a35135)
259/290 (529) [277]
(a00a3665343439a426671958dd90ed0407a22cad9ac9f156008adb2798b7b5)
259/290 (530) [278]
(90beb94ebd331c457d79d05341453f5829a50bfcd4c87a02b876f8603728ff)
259/290 (531) [279]
(9582e0acbed1910173564e250f350b5cc4291a7f671958dd90ed0407a22cad)
259/290 (532) [280]
(f183930d6fabd3dccdddc5ec35d754ad28caf3b879d05341453f5829a50bfc)
259/290 (533) [281]
(c9309f3a38c41f7991d9e78ddb47f7e85b8521eb564e250f350b5cc4291a7f)
259/290 (534) [282]
(3bcf08f63a0e2b93ecc376bd679a16c80e99e7b1ddc5ec35d754ad28caf3b8)
259/290 (535) [283]
(134621bb55a0470cdf6519ce08d6909af43ce0e5d9e78ddb47f7e85b8521eb)
259/290 (536) [284]
(edb3471fbba29748f9784d29b3cee1dee2df4b37c376bd679a16c80e99e7b1)
259/290 (537) [285]
(dd947a095df07a32dfd56666a395a7c42b25ca116519ce08d6909af43ce0e5)
259/290 (538) [286]
(a639e09d2cbe1ea1149c080c1c95b8b018340ae2784d29b3cee1dee2df4b37)
C:/Program Files/Git/mingw64/libexec/git-core\git-subtree: line 757:
8853 Done                    eval "$grl"
      8854 Segmentation fault      (core dumped) | while read rev
parents; do
    process_split_commit "$rev" "$parents" 0;
done
I downgraded git to 2.19.0-windows.1 and it works now.

I'm thankful for your insights Nadav Sinai Web Tech lead Philips-Algotec

Marc Balmer· Dec 9, 2019, 14:13 UTC · re: Strain, Roger L. · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

Roger,
I am all for reverting it. if that does not cause any other regressions or headaches (or both...)
- Marc
Show 83 quoted lines
> Am 09.12.2019 um 15:11 schrieb Strain, Roger L. <roger.strain@swri.org>:
> 
> I haven't been able to find anything relating to the issue, but I also
> haven't had a repo that exposes the problem to test more thoroughly
> against. If this happens to be a public repo somewhere, I'd be more
> than happy to take a second look.
> 
> That being said, if the community feels it would be better to revert
> the changes that were introduced, I won't object. I've had to further
> customize the script for our internal use, and those changes aren't
> something that would be useful for the public at large. (A few changes relate to the presence/absence of a specific file, which I certainly wouldn't expect anyone else to have.) Short story is we're going to have to use a custom script going forward, so keeping or reverting the changes here make no difference to us. I still feel that the changes which were made make the script more correct, but clearly there's some undiagnosed logic error somewhere.
> 
> Honestly, I'm surprised we didn't see this particular issue show up on
> our own repo; it's ridiculously large and complex. At least if it had,
> I'd be able to troubleshoot it more reliably.
> 
> --  
> Roger Strain
> 
> -----Original Message-----
> From: Nadav SInai <ns@nadavsinai.com>
> To: roger.strain@swri.org
> Cc: Johannes.Schindelin@gmx.de, git@vger.kernel.org, gitster@pobox.com,
> marc@msys.ch, pclouds@gmail.com
> Subject: RE: Regression in git-subtree.sh, introduced in 2.20.1, after
> 315a84f9aa0e2e629b0680068646b0032518ebed
> Date: Sun, 08 Dec 2019 12:30:48 +0200
> 
> [EXTERNAL EMAIL]
> 
> Hi, I'm curious if any of you had any luck in preventing that
> seg-fault in git-subtree script
> I'm encountering it myself using git 2.24.0.windows.2., seg-fault is
> in the same while loop (currently on line 757)
> When I tried your suggestion of adding the ($parents) ($rev) to the
> progress print I see that the last commit have only one revision
> printed
> like this:
> 
> 259/290 (523) [271] (843dd34090d36dfabd6a2e3e8459a4887427313b)
> (a69ee056f66acf66c63f89f55d26c0cc17036623)
> 259/290 (525) [273] (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
> (843dd34090d36dfabd6a2e3e8459a4887427313b)
> 259/290 (527) [275] (82303752a428cf1d789ac9f156008adb2798b7b5)
> (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
> 259/290 (528) [276]
> (7187897883c9fb4d33d4c87a02b876f8603728ff05f0945ae2ce9f98a35135)
> 259/290 (529) [277]
> (a00a3665343439a426671958dd90ed0407a22cad9ac9f156008adb2798b7b5)
> 259/290 (530) [278]
> (90beb94ebd331c457d79d05341453f5829a50bfcd4c87a02b876f8603728ff)
> 259/290 (531) [279]
> (9582e0acbed1910173564e250f350b5cc4291a7f671958dd90ed0407a22cad)
> 259/290 (532) [280]
> (f183930d6fabd3dccdddc5ec35d754ad28caf3b879d05341453f5829a50bfc)
> 259/290 (533) [281]
> (c9309f3a38c41f7991d9e78ddb47f7e85b8521eb564e250f350b5cc4291a7f)
> 259/290 (534) [282]
> (3bcf08f63a0e2b93ecc376bd679a16c80e99e7b1ddc5ec35d754ad28caf3b8)
> 259/290 (535) [283]
> (134621bb55a0470cdf6519ce08d6909af43ce0e5d9e78ddb47f7e85b8521eb)
> 259/290 (536) [284]
> (edb3471fbba29748f9784d29b3cee1dee2df4b37c376bd679a16c80e99e7b1)
> 259/290 (537) [285]
> (dd947a095df07a32dfd56666a395a7c42b25ca116519ce08d6909af43ce0e5)
> 259/290 (538) [286]
> (a639e09d2cbe1ea1149c080c1c95b8b018340ae2784d29b3cee1dee2df4b37)
> C:/Program Files/Git/mingw64/libexec/git-core\git-subtree: line 757:
> 8853 Done                    eval "$grl"
>      8854 Segmentation fault      (core dumped) | while read rev
> parents; do
>    process_split_commit "$rev" "$parents" 0;
> done
> 
> I downgraded git to 2.19.0-windows.1 and it works now.
> 
> 
> I'm thankful for your insights
> Nadav Sinai
> Web Tech lead
> Philips-Algotec
> 
> 
Strain, Roger L.· Dec 9, 2019, 14:18 UTC · re: Marc Balmer · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

As I said, I'm using a custom script here. I don't know if anybody else benefited from the change and hasn't said anything, but I won't object to someone submitting that revert.

-- 
Roger

-----Original Message-----
From: Marc Balmer <marc@msys.ch>
To: "Strain, Roger L." <roger.strain@swri.org>
Cc: ns@nadavsinai.com <ns@nadavsinai.com>, git@vger.kernel.org <
git@vger.kernel.org>, Johannes.Schindelin@gmx.de <
Johannes.Schindelin@gmx.de>, gitster@pobox.com <gitster@pobox.com>, 
pclouds@gmail.com <pclouds@gmail.com>
Subject: Re: Regression in git-subtree.sh, introduced in 2.20.1, after
315a84f9aa0e2e629b0680068646b0032518ebed
Date: Mon, 09 Dec 2019 15:13:47 +0100

Roger,

I am all for reverting it. if that does not cause any other regressions
or headaches (or both...)

- Marc



Am 09.12.2019 um 15:11 schrieb Strain, Roger L. <roger.strain@swri.org>
:

I haven't been able to find anything relating to the issue, but I also
haven't had a repo that exposes the problem to test more thoroughly
against. If this happens to be a public repo somewhere, I'd be more
than happy to take a second look.

That being said, if the community feels it would be better to revert
the changes that were introduced, I won't object. I've had to further
customize the script for our internal use, and those changes aren't
something that would be useful for the public at large. (A few changes
relate to the presence/absence of a specific file, which I certainly
wouldn't expect anyone else to have.) Short story is we're going to
have to use a custom script going forward, so keeping or reverting the
changes here make no difference to us. I still feel that the changes
which were made make the script more correct, but clearly there's some
undiagnosed logic error somewhere.

Honestly, I'm surprised we didn't see this particular issue show up on
our own repo; it's ridiculously large and complex. At least if it had,
I'd be able to troubleshoot it more reliably.

--  
Roger Strain

-----Original Message-----
From: Nadav SInai <ns@nadavsinai.com>
To: roger.strain@swri.org
Cc: Johannes.Schindelin@gmx.de, git@vger.kernel.org, gitster@pobox.com,
marc@msys.ch, pclouds@gmail.com
Subject: RE: Regression in git-subtree.sh, introduced in 2.20.1, after
315a84f9aa0e2e629b0680068646b0032518ebed
Date: Sun, 08 Dec 2019 12:30:48 +0200

[EXTERNAL EMAIL]

Hi, I'm curious if any of you had any luck in preventing that
seg-fault in git-subtree script
I'm encountering it myself using git 2.24.0.windows.2., seg-fault is
in the same while loop (currently on line 757)
When I tried your suggestion of adding the ($parents) ($rev) to the
progress print I see that the last commit have only one revision
printed
like this:

259/290 (523) [271] (843dd34090d36dfabd6a2e3e8459a4887427313b)
(a69ee056f66acf66c63f89f55d26c0cc17036623)
259/290 (525) [273] (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
(843dd34090d36dfabd6a2e3e8459a4887427313b)
259/290 (527) [275] (82303752a428cf1d789ac9f156008adb2798b7b5)
(f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
259/290 (528) [276]
(7187897883c9fb4d33d4c87a02b876f8603728ff05f0945ae2ce9f98a35135)
259/290 (529) [277]
(a00a3665343439a426671958dd90ed0407a22cad9ac9f156008adb2798b7b5)
259/290 (530) [278]
(90beb94ebd331c457d79d05341453f5829a50bfcd4c87a02b876f8603728ff)
259/290 (531) [279]
(9582e0acbed1910173564e250f350b5cc4291a7f671958dd90ed0407a22cad)
259/290 (532) [280]
(f183930d6fabd3dccdddc5ec35d754ad28caf3b879d05341453f5829a50bfc)
259/290 (533) [281]
(c9309f3a38c41f7991d9e78ddb47f7e85b8521eb564e250f350b5cc4291a7f)
259/290 (534) [282]
(3bcf08f63a0e2b93ecc376bd679a16c80e99e7b1ddc5ec35d754ad28caf3b8)
259/290 (535) [283]
(134621bb55a0470cdf6519ce08d6909af43ce0e5d9e78ddb47f7e85b8521eb)
259/290 (536) [284]
(edb3471fbba29748f9784d29b3cee1dee2df4b37c376bd679a16c80e99e7b1)
259/290 (537) [285]
(dd947a095df07a32dfd56666a395a7c42b25ca116519ce08d6909af43ce0e5)
259/290 (538) [286]
(a639e09d2cbe1ea1149c080c1c95b8b018340ae2784d29b3cee1dee2df4b37)
C:/Program Files/Git/mingw64/libexec/git-core\git-subtree: line 757:
8853 Done                    eval "$grl"
     8854 Segmentation fault      (core dumped) | while read rev
parents; do
   process_split_commit "$rev" "$parents" 0;
done

I downgraded git to 2.19.0-windows.1 and it works now.


I'm thankful for your insights
Nadav Sinai
Web Tech lead
Philips-Algotec
Marc Balmer· Dec 9, 2019, 14:30 UTC · re: Strain, Roger L. · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

I am not familiar with the source code, so I can not send in that revert.  I can, however, say that I am grateful to whomever does it ;)
- Marc
Show 122 quoted lines
> Am 09.12.2019 um 15:18 schrieb Strain, Roger L. <roger.strain@swri.org>:
> 
> As I said, I'm using a custom script here. I don't know if anybody else
> benefited from the change and hasn't said anything, but I won't object
> to someone submitting that revert.
> 
> -- 
> Roger
> 
> -----Original Message-----
> From: Marc Balmer <marc@msys.ch>
> To: "Strain, Roger L." <roger.strain@swri.org>
> Cc: ns@nadavsinai.com <ns@nadavsinai.com>, git@vger.kernel.org <
> git@vger.kernel.org>, Johannes.Schindelin@gmx.de <
> Johannes.Schindelin@gmx.de>, gitster@pobox.com <gitster@pobox.com>, 
> pclouds@gmail.com <pclouds@gmail.com>
> Subject: Re: Regression in git-subtree.sh, introduced in 2.20.1, after
> 315a84f9aa0e2e629b0680068646b0032518ebed
> Date: Mon, 09 Dec 2019 15:13:47 +0100
> 
> Roger,
> 
> I am all for reverting it. if that does not cause any other regressions
> or headaches (or both...)
> 
> - Marc
> 
> 
> 
> Am 09.12.2019 um 15:11 schrieb Strain, Roger L. <roger.strain@swri.org>
> :
> 
> I haven't been able to find anything relating to the issue, but I also
> haven't had a repo that exposes the problem to test more thoroughly
> against. If this happens to be a public repo somewhere, I'd be more
> than happy to take a second look.
> 
> That being said, if the community feels it would be better to revert
> the changes that were introduced, I won't object. I've had to further
> customize the script for our internal use, and those changes aren't
> something that would be useful for the public at large. (A few changes
> relate to the presence/absence of a specific file, which I certainly
> wouldn't expect anyone else to have.) Short story is we're going to
> have to use a custom script going forward, so keeping or reverting the
> changes here make no difference to us. I still feel that the changes
> which were made make the script more correct, but clearly there's some
> undiagnosed logic error somewhere.
> 
> Honestly, I'm surprised we didn't see this particular issue show up on
> our own repo; it's ridiculously large and complex. At least if it had,
> I'd be able to troubleshoot it more reliably.
> 
> --  
> Roger Strain
> 
> -----Original Message-----
> From: Nadav SInai <ns@nadavsinai.com>
> To: roger.strain@swri.org
> Cc: Johannes.Schindelin@gmx.de, git@vger.kernel.org, gitster@pobox.com,
> marc@msys.ch, pclouds@gmail.com
> Subject: RE: Regression in git-subtree.sh, introduced in 2.20.1, after
> 315a84f9aa0e2e629b0680068646b0032518ebed
> Date: Sun, 08 Dec 2019 12:30:48 +0200
> 
> [EXTERNAL EMAIL]
> 
> Hi, I'm curious if any of you had any luck in preventing that
> seg-fault in git-subtree script
> I'm encountering it myself using git 2.24.0.windows.2., seg-fault is
> in the same while loop (currently on line 757)
> When I tried your suggestion of adding the ($parents) ($rev) to the
> progress print I see that the last commit have only one revision
> printed
> like this:
> 
> 259/290 (523) [271] (843dd34090d36dfabd6a2e3e8459a4887427313b)
> (a69ee056f66acf66c63f89f55d26c0cc17036623)
> 259/290 (525) [273] (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
> (843dd34090d36dfabd6a2e3e8459a4887427313b)
> 259/290 (527) [275] (82303752a428cf1d789ac9f156008adb2798b7b5)
> (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
> 259/290 (528) [276]
> (7187897883c9fb4d33d4c87a02b876f8603728ff05f0945ae2ce9f98a35135)
> 259/290 (529) [277]
> (a00a3665343439a426671958dd90ed0407a22cad9ac9f156008adb2798b7b5)
> 259/290 (530) [278]
> (90beb94ebd331c457d79d05341453f5829a50bfcd4c87a02b876f8603728ff)
> 259/290 (531) [279]
> (9582e0acbed1910173564e250f350b5cc4291a7f671958dd90ed0407a22cad)
> 259/290 (532) [280]
> (f183930d6fabd3dccdddc5ec35d754ad28caf3b879d05341453f5829a50bfc)
> 259/290 (533) [281]
> (c9309f3a38c41f7991d9e78ddb47f7e85b8521eb564e250f350b5cc4291a7f)
> 259/290 (534) [282]
> (3bcf08f63a0e2b93ecc376bd679a16c80e99e7b1ddc5ec35d754ad28caf3b8)
> 259/290 (535) [283]
> (134621bb55a0470cdf6519ce08d6909af43ce0e5d9e78ddb47f7e85b8521eb)
> 259/290 (536) [284]
> (edb3471fbba29748f9784d29b3cee1dee2df4b37c376bd679a16c80e99e7b1)
> 259/290 (537) [285]
> (dd947a095df07a32dfd56666a395a7c42b25ca116519ce08d6909af43ce0e5)
> 259/290 (538) [286]
> (a639e09d2cbe1ea1149c080c1c95b8b018340ae2784d29b3cee1dee2df4b37)
> C:/Program Files/Git/mingw64/libexec/git-core\git-subtree: line 757:
> 8853 Done                    eval "$grl"
>     8854 Segmentation fault      (core dumped) | while read rev
> parents; do
>   process_split_commit "$rev" "$parents" 0;
> done
> 
> I downgraded git to 2.19.0-windows.1 and it works now.
> 
> 
> I'm thankful for your insights
> Nadav Sinai
> Web Tech lead
> Philips-Algotec
> 
> 
> 
> 
> 
Johannes Schindelin· Dec 9, 2019, 15:26 UTC · re: Marc Balmer · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

Hi,
On Mon, 9 Dec 2019, Marc Balmer wrote:
> I am not familiar with the source code, so I can not send in that
> revert.  I can, however, say that I am grateful to whomever does it ;)
I am against reverting the change without knowing the root cause.

The recent reporter only compared Git for Windows v2.19.0 vs v2.20.1, which is _quite_ a big difference.

For what I know, the problem might be a change in the MSYS2 runtime that is mistaken by some malware for malicious code (we did introduce some code to emulate Ctrl+C in MinTTY which injects a remote thread and executes ExitProcess() there, which might very well be construed as an attack, even if it is actually very much desired behavior).

These segmentation faults in `git subtree` on Windows have traditionally been _all_ because of overzealous anti-malware.

So first, a much more fine-grained analysis would be required, e.g. comparing v2.20.1 against v2.20.0, then copying _just_ the `git-subtree` file from a working into a non-working version (or vice versa; I would highly recommend using the portable versions for such side-by side comparison).

Ciao, Johannes

Show 128 quoted lines
>
> - Marc
>
>
> > Am 09.12.2019 um 15:18 schrieb Strain, Roger L. <roger.strain@swri.org>:
> >
> > As I said, I'm using a custom script here. I don't know if anybody else
> > benefited from the change and hasn't said anything, but I won't object
> > to someone submitting that revert.
> >
> > --
> > Roger
> >
> > -----Original Message-----
> > From: Marc Balmer <marc@msys.ch>
> > To: "Strain, Roger L." <roger.strain@swri.org>
> > Cc: ns@nadavsinai.com <ns@nadavsinai.com>, git@vger.kernel.org <
> > git@vger.kernel.org>, Johannes.Schindelin@gmx.de <
> > Johannes.Schindelin@gmx.de>, gitster@pobox.com <gitster@pobox.com>,
> > pclouds@gmail.com <pclouds@gmail.com>
> > Subject: Re: Regression in git-subtree.sh, introduced in 2.20.1, after
> > 315a84f9aa0e2e629b0680068646b0032518ebed
> > Date: Mon, 09 Dec 2019 15:13:47 +0100
> >
> > Roger,
> >
> > I am all for reverting it. if that does not cause any other regressions
> > or headaches (or both...)
> >
> > - Marc
> >
> >
> >
> > Am 09.12.2019 um 15:11 schrieb Strain, Roger L. <roger.strain@swri.org>
> > :
> >
> > I haven't been able to find anything relating to the issue, but I also
> > haven't had a repo that exposes the problem to test more thoroughly
> > against. If this happens to be a public repo somewhere, I'd be more
> > than happy to take a second look.
> >
> > That being said, if the community feels it would be better to revert
> > the changes that were introduced, I won't object. I've had to further
> > customize the script for our internal use, and those changes aren't
> > something that would be useful for the public at large. (A few changes
> > relate to the presence/absence of a specific file, which I certainly
> > wouldn't expect anyone else to have.) Short story is we're going to
> > have to use a custom script going forward, so keeping or reverting the
> > changes here make no difference to us. I still feel that the changes
> > which were made make the script more correct, but clearly there's some
> > undiagnosed logic error somewhere.
> >
> > Honestly, I'm surprised we didn't see this particular issue show up on
> > our own repo; it's ridiculously large and complex. At least if it had,
> > I'd be able to troubleshoot it more reliably.
> >
> > --
> > Roger Strain
> >
> > -----Original Message-----
> > From: Nadav SInai <ns@nadavsinai.com>
> > To: roger.strain@swri.org
> > Cc: Johannes.Schindelin@gmx.de, git@vger.kernel.org, gitster@pobox.com,
> > marc@msys.ch, pclouds@gmail.com
> > Subject: RE: Regression in git-subtree.sh, introduced in 2.20.1, after
> > 315a84f9aa0e2e629b0680068646b0032518ebed
> > Date: Sun, 08 Dec 2019 12:30:48 +0200
> >
> > [EXTERNAL EMAIL]
> >
> > Hi, I'm curious if any of you had any luck in preventing that
> > seg-fault in git-subtree script
> > I'm encountering it myself using git 2.24.0.windows.2., seg-fault is
> > in the same while loop (currently on line 757)
> > When I tried your suggestion of adding the ($parents) ($rev) to the
> > progress print I see that the last commit have only one revision
> > printed
> > like this:
> >
> > 259/290 (523) [271] (843dd34090d36dfabd6a2e3e8459a4887427313b)
> > (a69ee056f66acf66c63f89f55d26c0cc17036623)
> > 259/290 (525) [273] (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
> > (843dd34090d36dfabd6a2e3e8459a4887427313b)
> > 259/290 (527) [275] (82303752a428cf1d789ac9f156008adb2798b7b5)
> > (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
> > 259/290 (528) [276]
> > (7187897883c9fb4d33d4c87a02b876f8603728ff05f0945ae2ce9f98a35135)
> > 259/290 (529) [277]
> > (a00a3665343439a426671958dd90ed0407a22cad9ac9f156008adb2798b7b5)
> > 259/290 (530) [278]
> > (90beb94ebd331c457d79d05341453f5829a50bfcd4c87a02b876f8603728ff)
> > 259/290 (531) [279]
> > (9582e0acbed1910173564e250f350b5cc4291a7f671958dd90ed0407a22cad)
> > 259/290 (532) [280]
> > (f183930d6fabd3dccdddc5ec35d754ad28caf3b879d05341453f5829a50bfc)
> > 259/290 (533) [281]
> > (c9309f3a38c41f7991d9e78ddb47f7e85b8521eb564e250f350b5cc4291a7f)
> > 259/290 (534) [282]
> > (3bcf08f63a0e2b93ecc376bd679a16c80e99e7b1ddc5ec35d754ad28caf3b8)
> > 259/290 (535) [283]
> > (134621bb55a0470cdf6519ce08d6909af43ce0e5d9e78ddb47f7e85b8521eb)
> > 259/290 (536) [284]
> > (edb3471fbba29748f9784d29b3cee1dee2df4b37c376bd679a16c80e99e7b1)
> > 259/290 (537) [285]
> > (dd947a095df07a32dfd56666a395a7c42b25ca116519ce08d6909af43ce0e5)
> > 259/290 (538) [286]
> > (a639e09d2cbe1ea1149c080c1c95b8b018340ae2784d29b3cee1dee2df4b37)
> > C:/Program Files/Git/mingw64/libexec/git-core\git-subtree: line 757:
> > 8853 Done                    eval "$grl"
> >     8854 Segmentation fault      (core dumped) | while read rev
> > parents; do
> >   process_split_commit "$rev" "$parents" 0;
> > done
> >
> > I downgraded git to 2.19.0-windows.1 and it works now.
> >
> >
> > I'm thankful for your insights
> > Nadav Sinai
> > Web Tech lead
> > Philips-Algotec
> >
> >
> >
> >
> >
>
>
Marc Balmer· Dec 9, 2019, 15:31 UTC · re: Johannes Schindelin · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

Fwiw, I see the problem on Linux.
It hay nothing to do with overzealos antimalware, it is a regression and it has been well documented.
Show 160 quoted lines
> Am 09.12.2019 um 17:20 schrieb Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> 
> Hi,
> 
>> On Mon, 9 Dec 2019, Marc Balmer wrote:
>> 
>> I am not familiar with the source code, so I can not send in that
>> revert.  I can, however, say that I am grateful to whomever does it ;)
> 
> I am against reverting the change without knowing the root cause.
> 
> The recent reporter only compared Git for Windows v2.19.0 vs v2.20.1,
> which is _quite_ a big difference.
> 
> For what I know, the problem might be a change in the MSYS2 runtime that
> is mistaken by some malware for malicious code (we did introduce some code
> to emulate Ctrl+C in MinTTY which injects a remote thread and executes
> ExitProcess() there, which might very well be construed as an attack, even
> if it is actually very much desired behavior).
> 
> These segmentation faults in `git subtree` on Windows have traditionally
> been _all_ because of overzealous anti-malware.
> 
> So first, a much more fine-grained analysis would be required, e.g.
> comparing v2.20.1 against v2.20.0, then copying _just_ the `git-subtree`
> file from a working into a non-working version (or vice versa; I would
> highly recommend using the portable versions for such side-by side
> comparison).
> 
> Ciao,
> Johannes
> 
>> 
>> - Marc
>> 
>> 
>>>> Am 09.12.2019 um 15:18 schrieb Strain, Roger L. <roger.strain@swri.org>:
>>> 
>>> As I said, I'm using a custom script here. I don't know if anybody else
>>> benefited from the change and hasn't said anything, but I won't object
>>> to someone submitting that revert.
>>> 
>>> --
>>> Roger
>>> 
>>> -----Original Message-----
>>> From: Marc Balmer <marc@msys.ch>
>>> To: "Strain, Roger L." <roger.strain@swri.org>
>>> Cc: ns@nadavsinai.com <ns@nadavsinai.com>, git@vger.kernel.org <
>>> git@vger.kernel.org>, Johannes.Schindelin@gmx.de <
>>> Johannes.Schindelin@gmx.de>, gitster@pobox.com <gitster@pobox.com>,
>>> pclouds@gmail.com <pclouds@gmail.com>
>>> Subject: Re: Regression in git-subtree.sh, introduced in 2.20.1, after
>>> 315a84f9aa0e2e629b0680068646b0032518ebed
>>> Date: Mon, 09 Dec 2019 15:13:47 +0100
>>> 
>>> Roger,
>>> 
>>> I am all for reverting it. if that does not cause any other regressions
>>> or headaches (or both...)
>>> 
>>> - Marc
>>> 
>>> 
>>> 
>>> Am 09.12.2019 um 15:11 schrieb Strain, Roger L. <roger.strain@swri.org>
>>> :
>>> 
>>> I haven't been able to find anything relating to the issue, but I also
>>> haven't had a repo that exposes the problem to test more thoroughly
>>> against. If this happens to be a public repo somewhere, I'd be more
>>> than happy to take a second look.
>>> 
>>> That being said, if the community feels it would be better to revert
>>> the changes that were introduced, I won't object. I've had to further
>>> customize the script for our internal use, and those changes aren't
>>> something that would be useful for the public at large. (A few changes
>>> relate to the presence/absence of a specific file, which I certainly
>>> wouldn't expect anyone else to have.) Short story is we're going to
>>> have to use a custom script going forward, so keeping or reverting the
>>> changes here make no difference to us. I still feel that the changes
>>> which were made make the script more correct, but clearly there's some
>>> undiagnosed logic error somewhere.
>>> 
>>> Honestly, I'm surprised we didn't see this particular issue show up on
>>> our own repo; it's ridiculously large and complex. At least if it had,
>>> I'd be able to troubleshoot it more reliably.
>>> 
>>> --
>>> Roger Strain
>>> 
>>> -----Original Message-----
>>> From: Nadav SInai <ns@nadavsinai.com>
>>> To: roger.strain@swri.org
>>> Cc: Johannes.Schindelin@gmx.de, git@vger.kernel.org, gitster@pobox.com,
>>> marc@msys.ch, pclouds@gmail.com
>>> Subject: RE: Regression in git-subtree.sh, introduced in 2.20.1, after
>>> 315a84f9aa0e2e629b0680068646b0032518ebed
>>> Date: Sun, 08 Dec 2019 12:30:48 +0200
>>> 
>>> [EXTERNAL EMAIL]
>>> 
>>> Hi, I'm curious if any of you had any luck in preventing that
>>> seg-fault in git-subtree script
>>> I'm encountering it myself using git 2.24.0.windows.2., seg-fault is
>>> in the same while loop (currently on line 757)
>>> When I tried your suggestion of adding the ($parents) ($rev) to the
>>> progress print I see that the last commit have only one revision
>>> printed
>>> like this:
>>> 
>>> 259/290 (523) [271] (843dd34090d36dfabd6a2e3e8459a4887427313b)
>>> (a69ee056f66acf66c63f89f55d26c0cc17036623)
>>> 259/290 (525) [273] (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
>>> (843dd34090d36dfabd6a2e3e8459a4887427313b)
>>> 259/290 (527) [275] (82303752a428cf1d789ac9f156008adb2798b7b5)
>>> (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
>>> 259/290 (528) [276]
>>> (7187897883c9fb4d33d4c87a02b876f8603728ff05f0945ae2ce9f98a35135)
>>> 259/290 (529) [277]
>>> (a00a3665343439a426671958dd90ed0407a22cad9ac9f156008adb2798b7b5)
>>> 259/290 (530) [278]
>>> (90beb94ebd331c457d79d05341453f5829a50bfcd4c87a02b876f8603728ff)
>>> 259/290 (531) [279]
>>> (9582e0acbed1910173564e250f350b5cc4291a7f671958dd90ed0407a22cad)
>>> 259/290 (532) [280]
>>> (f183930d6fabd3dccdddc5ec35d754ad28caf3b879d05341453f5829a50bfc)
>>> 259/290 (533) [281]
>>> (c9309f3a38c41f7991d9e78ddb47f7e85b8521eb564e250f350b5cc4291a7f)
>>> 259/290 (534) [282]
>>> (3bcf08f63a0e2b93ecc376bd679a16c80e99e7b1ddc5ec35d754ad28caf3b8)
>>> 259/290 (535) [283]
>>> (134621bb55a0470cdf6519ce08d6909af43ce0e5d9e78ddb47f7e85b8521eb)
>>> 259/290 (536) [284]
>>> (edb3471fbba29748f9784d29b3cee1dee2df4b37c376bd679a16c80e99e7b1)
>>> 259/290 (537) [285]
>>> (dd947a095df07a32dfd56666a395a7c42b25ca116519ce08d6909af43ce0e5)
>>> 259/290 (538) [286]
>>> (a639e09d2cbe1ea1149c080c1c95b8b018340ae2784d29b3cee1dee2df4b37)
>>> C:/Program Files/Git/mingw64/libexec/git-core\git-subtree: line 757:
>>> 8853 Done                    eval "$grl"
>>>    8854 Segmentation fault      (core dumped) | while read rev
>>> parents; do
>>>  process_split_commit "$rev" "$parents" 0;
>>> done
>>> 
>>> I downgraded git to 2.19.0-windows.1 and it works now.
>>> 
>>> 
>>> I'm thankful for your insights
>>> Nadav Sinai
>>> Web Tech lead
>>> Philips-Algotec
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> 
Johannes Schindelin· Dec 9, 2019, 19:38 UTC · re: Marc Balmer · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

Hi Marc,
On Mon, 9 Dec 2019, Marc Balmer wrote:
> Fwiw, I see the problem on Linux.
Okay, I must have overlooked that piece of information.
> It hay nothing to do with overzealos antimalware, it is a regression and
> it has been well documented.

Is there a minimal, complete and verifiable example that other developers could use to analyze the bug?

Ciao, Johannes

Show 164 quoted lines
>
>
> > Am 09.12.2019 um 17:20 schrieb Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> >
> > Hi,
> >
> >> On Mon, 9 Dec 2019, Marc Balmer wrote:
> >>
> >> I am not familiar with the source code, so I can not send in that
> >> revert.  I can, however, say that I am grateful to whomever does it ;)
> >
> > I am against reverting the change without knowing the root cause.
> >
> > The recent reporter only compared Git for Windows v2.19.0 vs v2.20.1,
> > which is _quite_ a big difference.
> >
> > For what I know, the problem might be a change in the MSYS2 runtime that
> > is mistaken by some malware for malicious code (we did introduce some code
> > to emulate Ctrl+C in MinTTY which injects a remote thread and executes
> > ExitProcess() there, which might very well be construed as an attack, even
> > if it is actually very much desired behavior).
> >
> > These segmentation faults in `git subtree` on Windows have traditionally
> > been _all_ because of overzealous anti-malware.
> >
> > So first, a much more fine-grained analysis would be required, e.g.
> > comparing v2.20.1 against v2.20.0, then copying _just_ the `git-subtree`
> > file from a working into a non-working version (or vice versa; I would
> > highly recommend using the portable versions for such side-by side
> > comparison).
> >
> > Ciao,
> > Johannes
> >
> >>
> >> - Marc
> >>
> >>
> >>>> Am 09.12.2019 um 15:18 schrieb Strain, Roger L. <roger.strain@swri.org>:
> >>>
> >>> As I said, I'm using a custom script here. I don't know if anybody else
> >>> benefited from the change and hasn't said anything, but I won't object
> >>> to someone submitting that revert.
> >>>
> >>> --
> >>> Roger
> >>>
> >>> -----Original Message-----
> >>> From: Marc Balmer <marc@msys.ch>
> >>> To: "Strain, Roger L." <roger.strain@swri.org>
> >>> Cc: ns@nadavsinai.com <ns@nadavsinai.com>, git@vger.kernel.org <
> >>> git@vger.kernel.org>, Johannes.Schindelin@gmx.de <
> >>> Johannes.Schindelin@gmx.de>, gitster@pobox.com <gitster@pobox.com>,
> >>> pclouds@gmail.com <pclouds@gmail.com>
> >>> Subject: Re: Regression in git-subtree.sh, introduced in 2.20.1, after
> >>> 315a84f9aa0e2e629b0680068646b0032518ebed
> >>> Date: Mon, 09 Dec 2019 15:13:47 +0100
> >>>
> >>> Roger,
> >>>
> >>> I am all for reverting it. if that does not cause any other regressions
> >>> or headaches (or both...)
> >>>
> >>> - Marc
> >>>
> >>>
> >>>
> >>> Am 09.12.2019 um 15:11 schrieb Strain, Roger L. <roger.strain@swri.org>
> >>> :
> >>>
> >>> I haven't been able to find anything relating to the issue, but I also
> >>> haven't had a repo that exposes the problem to test more thoroughly
> >>> against. If this happens to be a public repo somewhere, I'd be more
> >>> than happy to take a second look.
> >>>
> >>> That being said, if the community feels it would be better to revert
> >>> the changes that were introduced, I won't object. I've had to further
> >>> customize the script for our internal use, and those changes aren't
> >>> something that would be useful for the public at large. (A few changes
> >>> relate to the presence/absence of a specific file, which I certainly
> >>> wouldn't expect anyone else to have.) Short story is we're going to
> >>> have to use a custom script going forward, so keeping or reverting the
> >>> changes here make no difference to us. I still feel that the changes
> >>> which were made make the script more correct, but clearly there's some
> >>> undiagnosed logic error somewhere.
> >>>
> >>> Honestly, I'm surprised we didn't see this particular issue show up on
> >>> our own repo; it's ridiculously large and complex. At least if it had,
> >>> I'd be able to troubleshoot it more reliably.
> >>>
> >>> --
> >>> Roger Strain
> >>>
> >>> -----Original Message-----
> >>> From: Nadav SInai <ns@nadavsinai.com>
> >>> To: roger.strain@swri.org
> >>> Cc: Johannes.Schindelin@gmx.de, git@vger.kernel.org, gitster@pobox.com,
> >>> marc@msys.ch, pclouds@gmail.com
> >>> Subject: RE: Regression in git-subtree.sh, introduced in 2.20.1, after
> >>> 315a84f9aa0e2e629b0680068646b0032518ebed
> >>> Date: Sun, 08 Dec 2019 12:30:48 +0200
> >>>
> >>> [EXTERNAL EMAIL]
> >>>
> >>> Hi, I'm curious if any of you had any luck in preventing that
> >>> seg-fault in git-subtree script
> >>> I'm encountering it myself using git 2.24.0.windows.2., seg-fault is
> >>> in the same while loop (currently on line 757)
> >>> When I tried your suggestion of adding the ($parents) ($rev) to the
> >>> progress print I see that the last commit have only one revision
> >>> printed
> >>> like this:
> >>>
> >>> 259/290 (523) [271] (843dd34090d36dfabd6a2e3e8459a4887427313b)
> >>> (a69ee056f66acf66c63f89f55d26c0cc17036623)
> >>> 259/290 (525) [273] (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
> >>> (843dd34090d36dfabd6a2e3e8459a4887427313b)
> >>> 259/290 (527) [275] (82303752a428cf1d789ac9f156008adb2798b7b5)
> >>> (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
> >>> 259/290 (528) [276]
> >>> (7187897883c9fb4d33d4c87a02b876f8603728ff05f0945ae2ce9f98a35135)
> >>> 259/290 (529) [277]
> >>> (a00a3665343439a426671958dd90ed0407a22cad9ac9f156008adb2798b7b5)
> >>> 259/290 (530) [278]
> >>> (90beb94ebd331c457d79d05341453f5829a50bfcd4c87a02b876f8603728ff)
> >>> 259/290 (531) [279]
> >>> (9582e0acbed1910173564e250f350b5cc4291a7f671958dd90ed0407a22cad)
> >>> 259/290 (532) [280]
> >>> (f183930d6fabd3dccdddc5ec35d754ad28caf3b879d05341453f5829a50bfc)
> >>> 259/290 (533) [281]
> >>> (c9309f3a38c41f7991d9e78ddb47f7e85b8521eb564e250f350b5cc4291a7f)
> >>> 259/290 (534) [282]
> >>> (3bcf08f63a0e2b93ecc376bd679a16c80e99e7b1ddc5ec35d754ad28caf3b8)
> >>> 259/290 (535) [283]
> >>> (134621bb55a0470cdf6519ce08d6909af43ce0e5d9e78ddb47f7e85b8521eb)
> >>> 259/290 (536) [284]
> >>> (edb3471fbba29748f9784d29b3cee1dee2df4b37c376bd679a16c80e99e7b1)
> >>> 259/290 (537) [285]
> >>> (dd947a095df07a32dfd56666a395a7c42b25ca116519ce08d6909af43ce0e5)
> >>> 259/290 (538) [286]
> >>> (a639e09d2cbe1ea1149c080c1c95b8b018340ae2784d29b3cee1dee2df4b37)
> >>> C:/Program Files/Git/mingw64/libexec/git-core\git-subtree: line 757:
> >>> 8853 Done                    eval "$grl"
> >>>    8854 Segmentation fault      (core dumped) | while read rev
> >>> parents; do
> >>>  process_split_commit "$rev" "$parents" 0;
> >>> done
> >>>
> >>> I downgraded git to 2.19.0-windows.1 and it works now.
> >>>
> >>>
> >>> I'm thankful for your insights
> >>> Nadav Sinai
> >>> Web Tech lead
> >>> Philips-Algotec
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
>
>
Tom Clarkson· Dec 11, 2019, 05:43 UTC · re: Johannes Schindelin · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

> Is there a minimal, complete and verifiable example that other developers
> could use to analyze the bug?
I ran into this bug today, and while not much closer to a solution, I believe I understand why it is happening. 
The recursive search is required because the original rev-list based approach could leave out some relevant commits - ie reversion would replace an obvious bug with a hidden one.
The search will stop when it reaches either a root commit or one already mapped to a subtree commit.
If you have a small repo or run git subtree add directly on your master branch, the search will terminate fairly quickly.
However, if you do everything via pull requests, the search will hit a merge commit where one side is just ahead of the subtree mapping, but the other side is several thousand commits with no sign of either a root or any subtrees.
I’m not sure yet if it is the number of commits or merges specifically, but the script seems to be able to handle around 400-500 commits before it falls over.
Show 164 quoted lines
>> 
>> 
>>> Am 09.12.2019 um 17:20 schrieb Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>>> 
>>> Hi,
>>> 
>>>> On Mon, 9 Dec 2019, Marc Balmer wrote:
>>>> 
>>>> I am not familiar with the source code, so I can not send in that
>>>> revert.  I can, however, say that I am grateful to whomever does it ;)
>>> 
>>> I am against reverting the change without knowing the root cause.
>>> 
>>> The recent reporter only compared Git for Windows v2.19.0 vs v2.20.1,
>>> which is _quite_ a big difference.
>>> 
>>> For what I know, the problem might be a change in the MSYS2 runtime that
>>> is mistaken by some malware for malicious code (we did introduce some code
>>> to emulate Ctrl+C in MinTTY which injects a remote thread and executes
>>> ExitProcess() there, which might very well be construed as an attack, even
>>> if it is actually very much desired behavior).
>>> 
>>> These segmentation faults in `git subtree` on Windows have traditionally
>>> been _all_ because of overzealous anti-malware.
>>> 
>>> So first, a much more fine-grained analysis would be required, e.g.
>>> comparing v2.20.1 against v2.20.0, then copying _just_ the `git-subtree`
>>> file from a working into a non-working version (or vice versa; I would
>>> highly recommend using the portable versions for such side-by side
>>> comparison).
>>> 
>>> Ciao,
>>> Johannes
>>> 
>>>> 
>>>> - Marc
>>>> 
>>>> 
>>>>>> Am 09.12.2019 um 15:18 schrieb Strain, Roger L. <roger.strain@swri.org>:
>>>>> 
>>>>> As I said, I'm using a custom script here. I don't know if anybody else
>>>>> benefited from the change and hasn't said anything, but I won't object
>>>>> to someone submitting that revert.
>>>>> 
>>>>> --
>>>>> Roger
>>>>> 
>>>>> -----Original Message-----
>>>>> From: Marc Balmer <marc@msys.ch>
>>>>> To: "Strain, Roger L." <roger.strain@swri.org>
>>>>> Cc: ns@nadavsinai.com <ns@nadavsinai.com>, git@vger.kernel.org <
>>>>> git@vger.kernel.org>, Johannes.Schindelin@gmx.de <
>>>>> Johannes.Schindelin@gmx.de>, gitster@pobox.com <gitster@pobox.com>,
>>>>> pclouds@gmail.com <pclouds@gmail.com>
>>>>> Subject: Re: Regression in git-subtree.sh, introduced in 2.20.1, after
>>>>> 315a84f9aa0e2e629b0680068646b0032518ebed
>>>>> Date: Mon, 09 Dec 2019 15:13:47 +0100
>>>>> 
>>>>> Roger,
>>>>> 
>>>>> I am all for reverting it. if that does not cause any other regressions
>>>>> or headaches (or both...)
>>>>> 
>>>>> - Marc
>>>>> 
>>>>> 
>>>>> 
>>>>> Am 09.12.2019 um 15:11 schrieb Strain, Roger L. <roger.strain@swri.org>
>>>>> :
>>>>> 
>>>>> I haven't been able to find anything relating to the issue, but I also
>>>>> haven't had a repo that exposes the problem to test more thoroughly
>>>>> against. If this happens to be a public repo somewhere, I'd be more
>>>>> than happy to take a second look.
>>>>> 
>>>>> That being said, if the community feels it would be better to revert
>>>>> the changes that were introduced, I won't object. I've had to further
>>>>> customize the script for our internal use, and those changes aren't
>>>>> something that would be useful for the public at large. (A few changes
>>>>> relate to the presence/absence of a specific file, which I certainly
>>>>> wouldn't expect anyone else to have.) Short story is we're going to
>>>>> have to use a custom script going forward, so keeping or reverting the
>>>>> changes here make no difference to us. I still feel that the changes
>>>>> which were made make the script more correct, but clearly there's some
>>>>> undiagnosed logic error somewhere.
>>>>> 
>>>>> Honestly, I'm surprised we didn't see this particular issue show up on
>>>>> our own repo; it's ridiculously large and complex. At least if it had,
>>>>> I'd be able to troubleshoot it more reliably.
>>>>> 
>>>>> --
>>>>> Roger Strain
>>>>> 
>>>>> -----Original Message-----
>>>>> From: Nadav SInai <ns@nadavsinai.com>
>>>>> To: roger.strain@swri.org
>>>>> Cc: Johannes.Schindelin@gmx.de, git@vger.kernel.org, gitster@pobox.com,
>>>>> marc@msys.ch, pclouds@gmail.com
>>>>> Subject: RE: Regression in git-subtree.sh, introduced in 2.20.1, after
>>>>> 315a84f9aa0e2e629b0680068646b0032518ebed
>>>>> Date: Sun, 08 Dec 2019 12:30:48 +0200
>>>>> 
>>>>> [EXTERNAL EMAIL]
>>>>> 
>>>>> Hi, I'm curious if any of you had any luck in preventing that
>>>>> seg-fault in git-subtree script
>>>>> I'm encountering it myself using git 2.24.0.windows.2., seg-fault is
>>>>> in the same while loop (currently on line 757)
>>>>> When I tried your suggestion of adding the ($parents) ($rev) to the
>>>>> progress print I see that the last commit have only one revision
>>>>> printed
>>>>> like this:
>>>>> 
>>>>> 259/290 (523) [271] (843dd34090d36dfabd6a2e3e8459a4887427313b)
>>>>> (a69ee056f66acf66c63f89f55d26c0cc17036623)
>>>>> 259/290 (525) [273] (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
>>>>> (843dd34090d36dfabd6a2e3e8459a4887427313b)
>>>>> 259/290 (527) [275] (82303752a428cf1d789ac9f156008adb2798b7b5)
>>>>> (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
>>>>> 259/290 (528) [276]
>>>>> (7187897883c9fb4d33d4c87a02b876f8603728ff05f0945ae2ce9f98a35135)
>>>>> 259/290 (529) [277]
>>>>> (a00a3665343439a426671958dd90ed0407a22cad9ac9f156008adb2798b7b5)
>>>>> 259/290 (530) [278]
>>>>> (90beb94ebd331c457d79d05341453f5829a50bfcd4c87a02b876f8603728ff)
>>>>> 259/290 (531) [279]
>>>>> (9582e0acbed1910173564e250f350b5cc4291a7f671958dd90ed0407a22cad)
>>>>> 259/290 (532) [280]
>>>>> (f183930d6fabd3dccdddc5ec35d754ad28caf3b879d05341453f5829a50bfc)
>>>>> 259/290 (533) [281]
>>>>> (c9309f3a38c41f7991d9e78ddb47f7e85b8521eb564e250f350b5cc4291a7f)
>>>>> 259/290 (534) [282]
>>>>> (3bcf08f63a0e2b93ecc376bd679a16c80e99e7b1ddc5ec35d754ad28caf3b8)
>>>>> 259/290 (535) [283]
>>>>> (134621bb55a0470cdf6519ce08d6909af43ce0e5d9e78ddb47f7e85b8521eb)
>>>>> 259/290 (536) [284]
>>>>> (edb3471fbba29748f9784d29b3cee1dee2df4b37c376bd679a16c80e99e7b1)
>>>>> 259/290 (537) [285]
>>>>> (dd947a095df07a32dfd56666a395a7c42b25ca116519ce08d6909af43ce0e5)
>>>>> 259/290 (538) [286]
>>>>> (a639e09d2cbe1ea1149c080c1c95b8b018340ae2784d29b3cee1dee2df4b37)
>>>>> C:/Program Files/Git/mingw64/libexec/git-core\git-subtree: line 757:
>>>>> 8853 Done                    eval "$grl"
>>>>>   8854 Segmentation fault      (core dumped) | while read rev
>>>>> parents; do
>>>>> process_split_commit "$rev" "$parents" 0;
>>>>> done
>>>>> 
>>>>> I downgraded git to 2.19.0-windows.1 and it works now.
>>>>> 
>>>>> 
>>>>> I'm thankful for your insights
>>>>> Nadav Sinai
>>>>> Web Tech lead
>>>>> Philips-Algotec
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>> 
>> 
Strain, Roger L.· Dec 11, 2019, 14:39 UTC · re: Tom Clarkson · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

The comment about "400-500 commits" is interesting to me; our repos regularly have to process thousands (!) of commits like this, which is part of the reason I felt a need to try to fix the behavior. When I manage to get things into a reasonably sane state, the commit count may stay in the hundreds, but if things go too long, I've regularly seen counts well over 5000.

This makes me wonder if the problem is perhaps related to the hardware involved; maybe the algorithm is doing exactly what it should, but the available RAM isn't sufficient. If that's the problem, perhaps we could find a way to perform the recursive work without using actual recursion, reducing the number of instances on the stack.

-- 
Roger Strain

On Wed, 2019-12-11 at 16:43 +1100, Tom Clarkson wrote:
> > Is there a minimal, complete and verifiable example that other
> > developers
> > could use to analyze the bug?
> 
> I ran into this bug today, and while not much closer to a solution, I
> believe I understand why it is happening. 
> 
> The recursive search is required because the original rev-list based
> approach could leave out some relevant commits - ie reversion would
> replace an obvious bug with a hidden one.
> 
> The search will stop when it reaches either a root commit or one
> already mapped to a subtree commit.
> 
> If you have a small repo or run git subtree add directly on your
> master branch, the search will terminate fairly quickly.
> 
> However, if you do everything via pull requests, the search will hit
> a merge commit where one side is just ahead of the subtree mapping,
> but the other side is several thousand commits with no sign of either
> a root or any subtrees.
> 
> I’m not sure yet if it is the number of commits or merges
> specifically, but the script seems to be able to handle around 400-
> 500 commits before it falls over.
> 
> > > 
> > > 
> > > > Am 09.12.2019 um 17:20 schrieb Johannes Schindelin <
> > > > Johannes.Schindelin@gmx.de>:
> > > > 
> > > > Hi,
> > > > 
> > > > > On Mon, 9 Dec 2019, Marc Balmer wrote:
> > > > > 
> > > > > I am not familiar with the source code, so I can not send in
> > > > > that
> > > > > revert.  I can, however, say that I am grateful to whomever
> > > > > does it ;)
> > > > 
> > > > I am against reverting the change without knowing the root
> > > > cause.
> > > > 
> > > > The recent reporter only compared Git for Windows v2.19.0 vs
> > > > v2.20.1,
> > > > which is _quite_ a big difference.
> > > > 
> > > > For what I know, the problem might be a change in the MSYS2
> > > > runtime that
> > > > is mistaken by some malware for malicious code (we did
> > > > introduce some code
> > > > to emulate Ctrl+C in MinTTY which injects a remote thread and
> > > > executes
> > > > ExitProcess() there, which might very well be construed as an
> > > > attack, even
> > > > if it is actually very much desired behavior).
> > > > 
> > > > These segmentation faults in `git subtree` on Windows have
> > > > traditionally
> > > > been _all_ because of overzealous anti-malware.
> > > > 
> > > > So first, a much more fine-grained analysis would be required,
> > > > e.g.
> > > > comparing v2.20.1 against v2.20.0, then copying _just_ the
> > > > `git-subtree`
> > > > file from a working into a non-working version (or vice versa;
> > > > I would
> > > > highly recommend using the portable versions for such side-by
> > > > side
> > > > comparison).
> > > > 
> > > > Ciao,
> > > > Johannes
> > > > 
> > > > > 
> > > > > - Marc
> > > > > 
> > > > > 
> > > > > > > Am 09.12.2019 um 15:18 schrieb Strain, Roger L. <
> > > > > > > roger.strain@swri.org>:
> > > > > > 
> > > > > > As I said, I'm using a custom script here. I don't know if
> > > > > > anybody else
> > > > > > benefited from the change and hasn't said anything, but I
> > > > > > won't object
> > > > > > to someone submitting that revert.
> > > > > > 
> > > > > > --
> > > > > > Roger
> > > > > > 
> > > > > > -----Original Message-----
> > > > > > From: Marc Balmer <marc@msys.ch>
> > > > > > To: "Strain, Roger L." <roger.strain@swri.org>
> > > > > > Cc: ns@nadavsinai.com <ns@nadavsinai.com>, 
> > > > > > git@vger.kernel.org <
> > > > > > git@vger.kernel.org>, Johannes.Schindelin@gmx.de <
> > > > > > Johannes.Schindelin@gmx.de>, gitster@pobox.com <
> > > > > > gitster@pobox.com>,
> > > > > > pclouds@gmail.com <pclouds@gmail.com>
> > > > > > Subject: Re: Regression in git-subtree.sh, introduced in
> > > > > > 2.20.1, after
> > > > > > 315a84f9aa0e2e629b0680068646b0032518ebed
> > > > > > Date: Mon, 09 Dec 2019 15:13:47 +0100
> > > > > > 
> > > > > > Roger,
> > > > > > 
> > > > > > I am all for reverting it. if that does not cause any other
> > > > > > regressions
> > > > > > or headaches (or both...)
> > > > > > 
> > > > > > - Marc
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > Am 09.12.2019 um 15:11 schrieb Strain, Roger L. <
> > > > > > roger.strain@swri.org>
> > > > > > :
> > > > > > 
> > > > > > I haven't been able to find anything relating to the issue,
> > > > > > but I also
> > > > > > haven't had a repo that exposes the problem to test more
> > > > > > thoroughly
> > > > > > against. If this happens to be a public repo somewhere, I'd
> > > > > > be more
> > > > > > than happy to take a second look.
> > > > > > 
> > > > > > That being said, if the community feels it would be better
> > > > > > to revert
> > > > > > the changes that were introduced, I won't object. I've had
> > > > > > to further
> > > > > > customize the script for our internal use, and those
> > > > > > changes aren't
> > > > > > something that would be useful for the public at large. (A
> > > > > > few changes
> > > > > > relate to the presence/absence of a specific file, which I
> > > > > > certainly
> > > > > > wouldn't expect anyone else to have.) Short story is we're
> > > > > > going to
> > > > > > have to use a custom script going forward, so keeping or
> > > > > > reverting the
> > > > > > changes here make no difference to us. I still feel that
> > > > > > the changes
> > > > > > which were made make the script more correct, but clearly
> > > > > > there's some
> > > > > > undiagnosed logic error somewhere.
> > > > > > 
> > > > > > Honestly, I'm surprised we didn't see this particular issue
> > > > > > show up on
> > > > > > our own repo; it's ridiculously large and complex. At least
> > > > > > if it had,
> > > > > > I'd be able to troubleshoot it more reliably.
> > > > > > 
> > > > > > --
> > > > > > Roger Strain
> > > > > > 
> > > > > > -----Original Message-----
> > > > > > From: Nadav SInai <ns@nadavsinai.com>
> > > > > > To: roger.strain@swri.org
> > > > > > Cc: Johannes.Schindelin@gmx.de, git@vger.kernel.org, 
> > > > > > gitster@pobox.com,
> > > > > > marc@msys.ch, pclouds@gmail.com
> > > > > > Subject: RE: Regression in git-subtree.sh, introduced in
> > > > > > 2.20.1, after
> > > > > > 315a84f9aa0e2e629b0680068646b0032518ebed
> > > > > > Date: Sun, 08 Dec 2019 12:30:48 +0200
> > > > > > 
> > > > > > [EXTERNAL EMAIL]
> > > > > > 
> > > > > > Hi, I'm curious if any of you had any luck in preventing
> > > > > > that
> > > > > > seg-fault in git-subtree script
> > > > > > I'm encountering it myself using git 2.24.0.windows.2.,
> > > > > > seg-fault is
> > > > > > in the same while loop (currently on line 757)
> > > > > > When I tried your suggestion of adding the ($parents)
> > > > > > ($rev) to the
> > > > > > progress print I see that the last commit have only one
> > > > > > revision
> > > > > > printed
> > > > > > like this:
> > > > > > 
> > > > > > 259/290 (523) [271]
> > > > > > (843dd34090d36dfabd6a2e3e8459a4887427313b)
> > > > > > (a69ee056f66acf66c63f89f55d26c0cc17036623)
> > > > > > 259/290 (525) [273]
> > > > > > (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
> > > > > > (843dd34090d36dfabd6a2e3e8459a4887427313b)
> > > > > > 259/290 (527) [275]
> > > > > > (82303752a428cf1d789ac9f156008adb2798b7b5)
> > > > > > (f5eea1a3cbe1e16acba53e8a9fe07b6525a8b97c)
> > > > > > 259/290 (528) [276]
> > > > > > (7187897883c9fb4d33d4c87a02b876f8603728ff05f0945ae2ce9f98a3
> > > > > > 5135)
> > > > > > 259/290 (529) [277]
> > > > > > (a00a3665343439a426671958dd90ed0407a22cad9ac9f156008adb2798
> > > > > > b7b5)
> > > > > > 259/290 (530) [278]
> > > > > > (90beb94ebd331c457d79d05341453f5829a50bfcd4c87a02b876f86037
> > > > > > 28ff)
> > > > > > 259/290 (531) [279]
> > > > > > (9582e0acbed1910173564e250f350b5cc4291a7f671958dd90ed0407a2
> > > > > > 2cad)
> > > > > > 259/290 (532) [280]
> > > > > > (f183930d6fabd3dccdddc5ec35d754ad28caf3b879d05341453f5829a5
> > > > > > 0bfc)
> > > > > > 259/290 (533) [281]
> > > > > > (c9309f3a38c41f7991d9e78ddb47f7e85b8521eb564e250f350b5cc429
> > > > > > 1a7f)
> > > > > > 259/290 (534) [282]
> > > > > > (3bcf08f63a0e2b93ecc376bd679a16c80e99e7b1ddc5ec35d754ad28ca
> > > > > > f3b8)
> > > > > > 259/290 (535) [283]
> > > > > > (134621bb55a0470cdf6519ce08d6909af43ce0e5d9e78ddb47f7e85b85
> > > > > > 21eb)
> > > > > > 259/290 (536) [284]
> > > > > > (edb3471fbba29748f9784d29b3cee1dee2df4b37c376bd679a16c80e99
> > > > > > e7b1)
> > > > > > 259/290 (537) [285]
> > > > > > (dd947a095df07a32dfd56666a395a7c42b25ca116519ce08d6909af43c
> > > > > > e0e5)
> > > > > > 259/290 (538) [286]
> > > > > > (a639e09d2cbe1ea1149c080c1c95b8b018340ae2784d29b3cee1dee2df
> > > > > > 4b37)
> > > > > > C:/Program Files/Git/mingw64/libexec/git-core\git-subtree:
> > > > > > line 757:
> > > > > > 8853 Done                    eval "$grl"
> > > > > >   8854 Segmentation fault      (core dumped) | while read
> > > > > > rev
> > > > > > parents; do
> > > > > > process_split_commit "$rev" "$parents" 0;
> > > > > > done
> > > > > > 
> > > > > > I downgraded git to 2.19.0-windows.1 and it works now.
> > > > > > 
> > > > > > 
> > > > > > I'm thankful for your insights
> > > > > > Nadav Sinai
> > > > > > Web Tech lead
> > > > > > Philips-Algotec
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > 
> > > > > 
> > > 
> > > 
> 
> 
Tom Clarkson· Dec 12, 2019, 05:02 UTC · re: Strain, Roger L. · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

Show 5 quoted lines
> This makes me wonder if the problem is perhaps related to the hardware
> involved; maybe the algorithm is doing exactly what it should, but the
> available RAM isn't sufficient. If that's the problem, perhaps we could
> find a way to perform the recursive work without using actual
> recursion, reducing the number of instances on the stack.
It’s not so much hardware as OS I think - After adding stack depth (the indent parameter on check_parents) to the log, I have been able to get different results with ulimit settings.
With the default stack size on macOS of 8MB, It falls over at depth 445. Being less than the shortest path to the root commit, that matches my initial count, which was just the number of lines in the log.
Reducing the stack size with ulimit -s 4096 makes it fall over at 225
Increasing to the hard limit of 64MB should allow a depth of around 4000, and as it turns out that did allow the script to complete, reaching a maximum depth of 1148.
I’m not seeing any issues with the hashes being wrong (all show no parents or subtree) but processing all those commits that resolve to nothing does take forever.
The mainline commit test seems to work ok on my repo, but it’s fairly easy to see scenarios where it would break, such as having a  subfolder with the same name within the subtree.
So while part of the fix will be a more reliable test, it also needs to work before parent commits are processed to mitigate the recursion issues.
The rules I have  come up with so far are below. There are still scenarios where the recursion is unavoidable such as running an initial split on a large repo, but that should be much less common than using a small subtree with a more complex existing repo.
In the initial setup of cmd_split, collect some extra information:
	- Add rev-list of all git-subtree-split values to the cache. I’d expect subtrees to usually be smaller than mainline, but since we can do that non-recursively we may as well.
	- Find the git-subtree-mainline value from subtree add/rejoin. Anything in its rev list should only be reachable by mainline commits. If not (which probably requires doing something convoluted like having subtree include mainline as its own subtree), this is a good place to check that and fall back to the existing behavior. 
When processing each commit:
If no prior splits were found, we only have mainline commits.
 	- If $dir exists, it is a mainline commit needing copy - use existing process.
	- If $dir does not exist, it is a mainline commit that will map to nothing - no need to process further.
If we do have some known subtree commits:
	- If it is in the cache, it is a subtree commit we don’t need to process further.
	- If subtree root is not reachable (rev-list or merge-base), must be mainline pre subtree add. Map to nothing and skip further processing.
	- If any subtree root is reachable, could be either mainline commit with subtree merged in, or subtree commit newer than the last add/squash (subtree pull/merge without squash does not use a custom commit message)
		- If $dir does not exist, must be subtree - add to the cache as mapped to self, no need to process parents.
		- If the folder does exist, it is  either a mainline commit to be processed normally, or a subtree that happens to contain a folder with the same name.  Check if mainline root is reachable.
Johannes Schindelin· Dec 13, 2019, 13:41 UTC · re: Tom Clarkson · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

Hi Tom,
On Thu, 12 Dec 2019, Tom Clarkson wrote:
Show 8 quoted lines
>
> > This makes me wonder if the problem is perhaps related to the hardware
> > involved; maybe the algorithm is doing exactly what it should, but the
> > available RAM isn't sufficient. If that's the problem, perhaps we could
> > find a way to perform the recursive work without using actual
> > recursion, reducing the number of instances on the stack.
>
> It’s not so much hardware as OS I think - After adding stack depth (the indent parameter on check_parents) to the log, I have been able to get different results with ulimit settings.

Do you mean to say that the stack overflow is reported as a segmentation fault? If so, that message was sure a red herring...

Thanks, Dscho

Show 40 quoted lines
>
> With the default stack size on macOS of 8MB, It falls over at depth 445. Being less than the shortest path to the root commit, that matches my initial count, which was just the number of lines in the log.
>
> Reducing the stack size with ulimit -s 4096 makes it fall over at 225
>
> Increasing to the hard limit of 64MB should allow a depth of around 4000, and as it turns out that did allow the script to complete, reaching a maximum depth of 1148.
>
> I’m not seeing any issues with the hashes being wrong (all show no parents or subtree) but processing all those commits that resolve to nothing does take forever.
>
> The mainline commit test seems to work ok on my repo, but it’s fairly easy to see scenarios where it would break, such as having a  subfolder with the same name within the subtree.
>
> So while part of the fix will be a more reliable test, it also needs to work before parent commits are processed to mitigate the recursion issues.
>
> The rules I have  come up with so far are below. There are still scenarios where the recursion is unavoidable such as running an initial split on a large repo, but that should be much less common than using a small subtree with a more complex existing repo.
>
> In the initial setup of cmd_split, collect some extra information:
>
> 	- Add rev-list of all git-subtree-split values to the cache. I’d expect subtrees to usually be smaller than mainline, but since we can do that non-recursively we may as well.
>
> 	- Find the git-subtree-mainline value from subtree add/rejoin. Anything in its rev list should only be reachable by mainline commits. If not (which probably requires doing something convoluted like having subtree include mainline as its own subtree), this is a good place to check that and fall back to the existing behavior.
>
>
> When processing each commit:
>
> If no prior splits were found, we only have mainline commits.
>
>  	- If $dir exists, it is a mainline commit needing copy - use existing process.
> 	- If $dir does not exist, it is a mainline commit that will map to nothing - no need to process further.
>
> If we do have some known subtree commits:
>
> 	- If it is in the cache, it is a subtree commit we don’t need to process further.
> 	- If subtree root is not reachable (rev-list or merge-base), must be mainline pre subtree add. Map to nothing and skip further processing.
> 	- If any subtree root is reachable, could be either mainline commit with subtree merged in, or subtree commit newer than the last add/squash (subtree pull/merge without squash does not use a custom commit message)
> 		- If $dir does not exist, must be subtree - add to the cache as mapped to self, no need to process parents.
> 		- If the folder does exist, it is  either a mainline commit to be processed normally, or a subtree that happens to contain a folder with the same name.  Check if mainline root is reachable.
>
>
>
>
Marc Balmer· Dec 14, 2019, 08:29 UTC · re: Johannes Schindelin · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

Show 17 quoted lines
> Am 13.12.2019 um 14:41 schrieb Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> 
> Hi Tom,
> 
> On Thu, 12 Dec 2019, Tom Clarkson wrote:
> 
>> 
>>> This makes me wonder if the problem is perhaps related to the hardware
>>> involved; maybe the algorithm is doing exactly what it should, but the
>>> available RAM isn't sufficient. If that's the problem, perhaps we could
>>> find a way to perform the recursive work without using actual
>>> recursion, reducing the number of instances on the stack.
>> 
>> It’s not so much hardware as OS I think - After adding stack depth (the indent parameter on check_parents) to the log, I have been able to get different results with ulimit settings.
> 
> Do you mean to say that the stack overflow is reported as a segmentation
> fault? If so, that message was sure a red herring...
FWIW, changing the stack limit using ulimit does not change anything on my (Fedora) system.  At some point, with exactly the same two leading numbers (those separated with a /)it seems to enter an endless (recursive) loop, eventually eating up all memory.  And then, after some time, it segfaults.
Show 44 quoted lines
> 
> Thanks,
> Dscho
> 
>> 
>> With the default stack size on macOS of 8MB, It falls over at depth 445. Being less than the shortest path to the root commit, that matches my initial count, which was just the number of lines in the log.
>> 
>> Reducing the stack size with ulimit -s 4096 makes it fall over at 225
>> 
>> Increasing to the hard limit of 64MB should allow a depth of around 4000, and as it turns out that did allow the script to complete, reaching a maximum depth of 1148.
>> 
>> I’m not seeing any issues with the hashes being wrong (all show no parents or subtree) but processing all those commits that resolve to nothing does take forever.
>> 
>> The mainline commit test seems to work ok on my repo, but it’s fairly easy to see scenarios where it would break, such as having a  subfolder with the same name within the subtree.
>> 
>> So while part of the fix will be a more reliable test, it also needs to work before parent commits are processed to mitigate the recursion issues.
>> 
>> The rules I have  come up with so far are below. There are still scenarios where the recursion is unavoidable such as running an initial split on a large repo, but that should be much less common than using a small subtree with a more complex existing repo.
>> 
>> In the initial setup of cmd_split, collect some extra information:
>> 
>> 	- Add rev-list of all git-subtree-split values to the cache. I’d expect subtrees to usually be smaller than mainline, but since we can do that non-recursively we may as well.
>> 
>> 	- Find the git-subtree-mainline value from subtree add/rejoin. Anything in its rev list should only be reachable by mainline commits. If not (which probably requires doing something convoluted like having subtree include mainline as its own subtree), this is a good place to check that and fall back to the existing behavior.
>> 
>> 
>> When processing each commit:
>> 
>> If no prior splits were found, we only have mainline commits.
>> 
>> 	- If $dir exists, it is a mainline commit needing copy - use existing process.
>> 	- If $dir does not exist, it is a mainline commit that will map to nothing - no need to process further.
>> 
>> If we do have some known subtree commits:
>> 
>> 	- If it is in the cache, it is a subtree commit we don’t need to process further.
>> 	- If subtree root is not reachable (rev-list or merge-base), must be mainline pre subtree add. Map to nothing and skip further processing.
>> 	- If any subtree root is reachable, could be either mainline commit with subtree merged in, or subtree commit newer than the last add/squash (subtree pull/merge without squash does not use a custom commit message)
>> 		- If $dir does not exist, must be subtree - add to the cache as mapped to self, no need to process parents.
>> 		- If the folder does exist, it is  either a mainline commit to be processed normally, or a subtree that happens to contain a folder with the same name.  Check if mainline root is reachable.
>> 
>> 
>> 
>> 
Tom Clarkson· Dec 16, 2019, 03:50 UTC · re: Tom Clarkson · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

I have put together a patch (currently testing on GitGitGadget) that at least fixes things for my repo - Commits from before subtree add are recognized as a dead end, so it no longer runs out of stack space while finding its way to a root commit.
I think the issue Marc ran into is a bit more complex in that the recursion eventually producing the wrong result suggests that correct identification of mainline commits remains an issue. While I have some ideas on how to improve that, it’s probably best handled separately.
However, there is a decent chance that excluding a large number of known irrelevant commits will catch the problematic ones in that scenario - and should match the previous behavior of treating the problem commits as initial.
Ed Maste· Dec 9, 2019, 11:45 UTC · re: Strain, Roger L. · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

On Mon, 9 Dec 2019 at 09:29, Strain, Roger L. <roger.strain@swri.org> wrote:
>
> I've had to further
> customize the script for our internal use, and those changes aren't
> something that would be useful for the public at large.

Would you describe the sort of problem you have to work around with custom changes?

I'm starting on a path of trying to fix git-subtree for failures[1] encountered in a prototype conversion of the FreeBSD repository from svn to git. The misbehaviour I encounter occurs when split encounters a commit for which the path being split is empty in 'git ls-tree', and the commit is actually not a subtree commit. I'm currently experimenting with hacks to skip specific hashes during the initial subtree split. On reading your mail I realize I could address my issue by testing for the existence of a specific file though, which makes me wonder if the issue you have is similar.

[1] https://lore.kernel.org/git/CAPyFy2AsmaxU-BDf_teZJE5hiaVpTSZc8fftnuXPb_4-j7j5Fw@mail.gmail.com/
Strain, Roger L.· Dec 9, 2019, 16:19 UTC · re: Ed Maste · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

So it's been quite a while since I made this specific change, but I'll attach the relevant portion of the diff below. I may be completely misremembering portions, and apologize in advance. This was based on an earlier version of the script, and I can see some other changes have been made since I forked, but perhaps this will still explain what I tried to do to work around our problem.

Within process_split_commit, there's logic that tries to distinguish between commits which are mainline and commits which are subtree. There's even a comment in the relevant section asking "Is there no better way? Does it matter?" Well, the answer was yes, it mattered, because we were picking up mainline commits that there before the initial add of a subtree, and those were getting sucked in as if they were subtree commits, and then all the remaining hashes were off.

What this change was meant to do was to check for the existence of a single, known file. We keep a file called "subtrees.csv" in the root of our mainline repo, and it defines the various subtrees that comprise the mainline. Therefore, if that file exists, I can say with certainty that it is a mainline commit. So when that dodgy check comes up, it checks for the file first, then falls back to the old behavior.

Partial diff follows, feel free to try it out if it sounds like a similar problem that you're facing. Change the specific filename for your needs, obviously.

To be clear, this is NOT something I'm submitting for inclusion in the general release; it's very repo-specific, and I just hope it might help a fellow soul.

@@ -506,6 +499,20 @@ subtree_for_commit () {
        done
 }
 
+subtree_for_csv () {
+       commit="$1"
+       dir="$2"
+       git ls-tree "$commit" -- "$dir" |
+       while read mode type tree name
+       do
+               assert test "$name" = "$dir"
+               assert test "$type" = "blob" -o "$type" = "commit"
+               test "$type" = "commit" && continue  # ignore
submodules
+               echo $tree
+               break
+       done
+}
+
 tree_changed () {
        tree=$1
        shift
@@ -667,9 +674,17 @@ process_split_commit () {
        if test -z "$tree"
        then
                set_notree "$rev"
-               if test -n "$newparents"
+               subtreescsv=$(subtree_for_csv "$rev" "subtrees.csv")
+               debug "${indentprefix}  subtrees.csv tree is:
$subtreescsv"
+
+               # ugly.  is there no better way to tell if this is a
subtree
+               # vs. a mainline commit?  Does it matter?
+               if test -z "$subtreescsv"
                then
-                       cache_set "$rev" "$rev"
+                       if test -n "$newparents"
+                       then
+                               cache_set "$rev" "$rev"
+                       fi
                fi
                return
        fi
-- 
Roger Strain

-----Original Message-----
From: Ed Maste <emaste@freebsd.org>
To: "Strain, Roger L." <roger.strain@swri.org>
Cc: git@vger.kernel.org <git@vger.kernel.org>, marc@msys.ch <
marc@msys.ch>
Subject: Re: Regression in git-subtree.sh, introduced in 2.20.1, after
315a84f9aa0e2e629b0680068646b0032518ebed
Date: Mon, 09 Dec 2019 06:45:57 -0500

[EXTERNAL EMAIL]

On Mon, 9 Dec 2019 at 09:29, Strain, Roger L. <roger.strain@swri.org>
wrote:

I've had to further
customize the script for our internal use, and those changes aren't
something that would be useful for the public at large.

Would you describe the sort of problem you have to work around with
custom changes?

I'm starting on a path of trying to fix git-subtree for failures[1]
encountered in a prototype conversion of the FreeBSD repository from
svn to git. The misbehaviour I encounter occurs when split encounters
a commit for which the path being split is empty in 'git ls-tree', and
the commit is actually not a subtree commit. I'm currently
experimenting with hacks to skip specific hashes during the initial
subtree split. On reading your mail I realize I could address my issue
by testing for the existence of a specific file though, which makes me
wonder if the issue you have is similar.

[1] 
https://lore.kernel.org/git/CAPyFy2AsmaxU-BDf_teZJE5hiaVpTSZc8fftnuXPb_4-j7j5Fw@mail.gmail.com/
Tom Clarkson· Dec 14, 2019, 14:27 UTC · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

>> FWIW, changing the stack limit using ulimit does not change anything on my (Fedora) system.  At some point, with exactly the same two leading numbers (those separated with a /)it seems to enter an endless (recursive) loop, eventually eating up all memory.  And then, after some time, it segfaults.
>> 
> 
> So today I tried a subtree push again.  It took hours.... Then it pushed every single commit that was ever done to repository.
So not actually an infinite loop, but close enough to make no difference?  I think we have about three bugs interacting in interesting ways here - Is your repo one where the subtree was originally extracted from mainline?
When you say it pushed every commit, does that mean that a bunch of mainline commits erroneously ended up in the subtree repo?
Ed Maste· Dec 16, 2019, 11:30 UTC · re: Tom Clarkson · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

On Sat, 14 Dec 2019 at 09:27, Tom Clarkson <tqclarkson@icloud.com> wrote:
>
> When you say it pushed every commit, does that mean that a bunch of mainline commits erroneously ended up in the subtree repo?

We encounter this case when trying to use subtree on the FreeBSD repository. In our case it's caused by commit that should not be classified as a commit to the subtree, but has no files in the subtree. In our case it looks like an artifact of svn-git conversion of an odd working branch, but the same issue is reproducible in other ways. For example, it will appear if the subtree is deleted at some point and later re-added.

Tom Clarkson· Dec 18, 2019, 00:15 UTC · re: Ed Maste · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

Show 13 quoted lines
> On 16 Dec 2019, at 10:30 pm, Ed Maste <emaste@freebsd.org> wrote:
> 
> On Sat, 14 Dec 2019 at 09:27, Tom Clarkson <tqclarkson@icloud.com> wrote:
>> 
>> When you say it pushed every commit, does that mean that a bunch of mainline commits erroneously ended up in the subtree repo?
> 
> We encounter this case when trying to use subtree on the FreeBSD
> repository. In our case it's caused by commit that should not be
> classified as a commit to the subtree, but has no files in the
> subtree. In our case it looks like an artifact of svn-git conversion
> of an odd working branch, but the same issue is reproducible in other
> ways. For example, it will appear if the subtree is deleted at some
> point and later re-added.
Deleting and re-adding a subtree is an interesting case. My patch won’t avoid the recursion there, because it can only be certain about the irrelevance of commits from before the first add.
However, I think that may be ok to leave in as something of an edge case - you may get more recursion than your system can handle, but assuming process_split_commit is correct, you can work around it by increasing ulimit, and can avoid any subsequent performance issues with a rejoin commit. Maybe we could display some sort of “your repo is doing something weird” warning to make it clearer where there are problems to be worked around.
Although the recursion would no doubt fall over on pretty much any machine when depth gets to 200k, it looks like the FreeBSD repo isn’t getting to that point, so let’s  cover the details of more reliable mainline detection on its own thread.
Marc Balmer· Mar 12, 2020, 10:40 UTC · lore

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed

G'day
Due to some issue in git subtree, a subtree push pushed all commits (over 8000) ever done to the main repository.  So the history of the subtree'ed repository not only showed commits done to the particular subtree, but all commits in the whole project (see E-mail exchange below).
Today we decided to no longer use subtrees, but to use two independend repository and managing merges manually.
How can we get rid of a subtree cache data?  Is it enough to remove the .git/subtree-cache directory?  Or is that dangerous?  Does git-subtree store any data anywhere else?

Thanks and regards, Marc

Show 76 quoted lines
> Am 14.12.2019 um 14:59 schrieb Marc Balmer <marc@msys.ch>:
> 
> 
> 
>> Am 14.12.2019 um 09:29 schrieb Marc Balmer <marc@msys.ch>:
>> 
>> 
>> 
>>> Am 13.12.2019 um 14:41 schrieb Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>>> 
>>> Hi Tom,
>>> 
>>> On Thu, 12 Dec 2019, Tom Clarkson wrote:
>>> 
>>>> 
>>>>> This makes me wonder if the problem is perhaps related to the hardware
>>>>> involved; maybe the algorithm is doing exactly what it should, but the
>>>>> available RAM isn't sufficient. If that's the problem, perhaps we could
>>>>> find a way to perform the recursive work without using actual
>>>>> recursion, reducing the number of instances on the stack.
>>>> 
>>>> It’s not so much hardware as OS I think - After adding stack depth (the indent parameter on check_parents) to the log, I have been able to get different results with ulimit settings.
>>> 
>>> Do you mean to say that the stack overflow is reported as a segmentation
>>> fault? If so, that message was sure a red herring...
>> 
>> FWIW, changing the stack limit using ulimit does not change anything on my (Fedora) system.  At some point, with exactly the same two leading numbers (those separated with a /)it seems to enter an endless (recursive) loop, eventually eating up all memory.  And then, after some time, it segfaults.
>> 
>> 
> 
> So today I tried a subtree push again.  It took hours.... Then it pushed every single commit that was ever done to repository.
> 
> I can definitely say that git subtree is totally broken and unusable at this moment.
> 
> We will now split out what once was a subtree into a proper repository of it's own.  git subtree was a nice idea, but it does not work.
> 
>>> 
>>> Thanks,
>>> Dscho
>>> 
>>>> 
>>>> With the default stack size on macOS of 8MB, It falls over at depth 445. Being less than the shortest path to the root commit, that matches my initial count, which was just the number of lines in the log.
>>>> 
>>>> Reducing the stack size with ulimit -s 4096 makes it fall over at 225
>>>> 
>>>> Increasing to the hard limit of 64MB should allow a depth of around 4000, and as it turns out that did allow the script to complete, reaching a maximum depth of 1148.
>>>> 
>>>> I’m not seeing any issues with the hashes being wrong (all show no parents or subtree) but processing all those commits that resolve to nothing does take forever.
>>>> 
>>>> The mainline commit test seems to work ok on my repo, but it’s fairly easy to see scenarios where it would break, such as having a  subfolder with the same name within the subtree.
>>>> 
>>>> So while part of the fix will be a more reliable test, it also needs to work before parent commits are processed to mitigate the recursion issues.
>>>> 
>>>> The rules I have  come up with so far are below. There are still scenarios where the recursion is unavoidable such as running an initial split on a large repo, but that should be much less common than using a small subtree with a more complex existing repo.
>>>> 
>>>> In the initial setup of cmd_split, collect some extra information:
>>>> 
>>>> 	- Add rev-list of all git-subtree-split values to the cache. I’d expect subtrees to usually be smaller than mainline, but since we can do that non-recursively we may as well.
>>>> 
>>>> 	- Find the git-subtree-mainline value from subtree add/rejoin. Anything in its rev list should only be reachable by mainline commits. If not (which probably requires doing something convoluted like having subtree include mainline as its own subtree), this is a good place to check that and fall back to the existing behavior.
>>>> 
>>>> 
>>>> When processing each commit:
>>>> 
>>>> If no prior splits were found, we only have mainline commits.
>>>> 
>>>> 	- If $dir exists, it is a mainline commit needing copy - use existing process.
>>>> 	- If $dir does not exist, it is a mainline commit that will map to nothing - no need to process further.
>>>> 
>>>> If we do have some known subtree commits:
>>>> 
>>>> 	- If it is in the cache, it is a subtree commit we don’t need to process further.
>>>> 	- If subtree root is not reachable (rev-list or merge-base), must be mainline pre subtree add. Map to nothing and skip further processing.
>>>> 	- If any subtree root is reachable, could be either mainline commit with subtree merged in, or subtree commit newer than the last add/squash (subtree pull/merge without squash does not use a custom commit message)
>>>> 		- If $dir does not exist, must be subtree - add to the cache as mapped to self, no need to process parents.
>>>> 		- If the folder does exist, it is  either a mainline commit to be processed normally, or a subtree that happens to contain a folder with the same name.  Check if mainline root is reachable.

← back to recent threads