threads / bug / 49431

Triggering "BUG: wt-status.c:476: multiple renames on the same target? how?"

Subject: Triggering "BUG: wt-status.c:476: multiple renames on the same target? how?"

## tl;dr

4 messages between Sep 26, 2018 and Sep 27, 2018.

replies: 3people: 3as markdown or json

Andrea Stacchiotti· Sep 26, 2018, 20:27 UTC · lore
Dear maintainer(s),

the following script, when executed with git 2.19 triggers the bug in the subject line. The problem seems to be the interaction between add -N and rename detection.

The git binary used is the one currently packaged in Debian unstable.

I have searched the list for the bug text and have found nothing, apologies if the bug is already known.

System information, script content and script output follow.
Andrea Stacchiotti
--------------------------

andreas@trelitri:/tmp$ uname -a Linux trelitri 4.17.0-3-amd64 #1 SMP Debian 4.17.17-1 (2018-08-18) x86_64 GNU/Linux andreas@trelitri:/tmp$ git --version git version 2.19.0

andreas@trelitri:/tmp$ cat bugscript.sh # Make a test repo git init testrepo cd testrepo git config user.name A git config user.email B

# Add a file called orig echo 'a' > orig git add orig git commit -m'orig'

# Copy orig in new and modify orig cp orig new echo 'b' > orig

# add -N and then commit trigger the bug git add -N new git commit

# Cleanup cd .. rm -rf testrepo

andreas@trelitri:/tmp$ LANG=C ./bugscript.sh
Initialized empty Git repository in /tmp/testrepo/.git/
[master (root-commit) 5dedf30] orig
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 orig
BUG: wt-status.c:476: multiple renames on the same target? how?
./bugscript.sh: line 18: 22762 Aborted                 git commit
Ævar Arnfjörð Bjarmason· Sep 26, 2018, 20:56 UTC · re: Andrea Stacchiotti · lore

Re: Triggering "BUG: wt-status.c:476: multiple renames on the same target? how?"

On Wed, Sep 26 2018, Andrea Stacchiotti wrote:
Show 54 quoted lines
> Dear maintainer(s),
>
> the following script, when executed with git 2.19 triggers the bug in
> the subject line.
> The problem seems to be the interaction between add -N and rename detection.
>
> The git binary used is the one currently packaged in Debian unstable.
>
> I have searched the list for the bug text and have found nothing,
> apologies if the bug is already known.
>
> System information, script content and script output follow.
>
> Andrea Stacchiotti
>
> --------------------------
>
> andreas@trelitri:/tmp$ uname -a
> Linux trelitri 4.17.0-3-amd64 #1 SMP Debian 4.17.17-1 (2018-08-18)
> x86_64 GNU/Linux
> andreas@trelitri:/tmp$ git --version
> git version 2.19.0
>
> andreas@trelitri:/tmp$ cat bugscript.sh
> # Make a test repo
> git init testrepo
> cd testrepo
> git config user.name A
> git config user.email B
>
> # Add a file called orig
> echo 'a' > orig
> git add orig
> git commit -m'orig'
>
> # Copy orig in new and modify orig
> cp orig new
> echo 'b' > orig
>
> # add -N and then commit trigger the bug
> git add -N new
> git commit
>
> # Cleanup
> cd ..
> rm -rf testrepo
>
> andreas@trelitri:/tmp$ LANG=C ./bugscript.sh
> Initialized empty Git repository in /tmp/testrepo/.git/
> [master (root-commit) 5dedf30] orig
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  create mode 100644 orig
> BUG: wt-status.c:476: multiple renames on the same target? how?
> ./bugscript.sh: line 18: 22762 Aborted                 git commit

I can't reproduce this on Debian AMD64 either 2.19.0 in unstable, or 2.19.0.605.g01d371f741 in experimental. I tried moving my ~/.gitconfig out of the way, do you have some config options there that might be contributing to this?

Andrea Stacchiotti· Sep 26, 2018, 21:02 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: Triggering "BUG: wt-status.c:476: multiple renames on the same target? how?"

I'm very sorry, I indeed forgot the `diff.renames=copies`.
The following script can reproduce the bug even with a blank config:
---------------------

# Make a test repo git init testrepo cd testrepo git config user.name A git config user.email B git config diff.renames copies

# Add a file called orig echo 'a' > orig git add orig git commit -m'orig'

# Copy orig in new and modify orig cp orig new echo 'b' > orig

# add -N and then commit trigger the bug git add -N new git commit

# Cleanup cd .. rm -rf testrepo

Il 26/09/18 22:56, Ævar Arnfjörð Bjarmason ha scritto:
Show 63 quoted lines
> 
> On Wed, Sep 26 2018, Andrea Stacchiotti wrote:
> 
>> Dear maintainer(s),
>>
>> the following script, when executed with git 2.19 triggers the bug in
>> the subject line.
>> The problem seems to be the interaction between add -N and rename detection.
>>
>> The git binary used is the one currently packaged in Debian unstable.
>>
>> I have searched the list for the bug text and have found nothing,
>> apologies if the bug is already known.
>>
>> System information, script content and script output follow.
>>
>> Andrea Stacchiotti
>>
>> --------------------------
>>
>> andreas@trelitri:/tmp$ uname -a
>> Linux trelitri 4.17.0-3-amd64 #1 SMP Debian 4.17.17-1 (2018-08-18)
>> x86_64 GNU/Linux
>> andreas@trelitri:/tmp$ git --version
>> git version 2.19.0
>>
>> andreas@trelitri:/tmp$ cat bugscript.sh
>> # Make a test repo
>> git init testrepo
>> cd testrepo
>> git config user.name A
>> git config user.email B
>>
>> # Add a file called orig
>> echo 'a' > orig
>> git add orig
>> git commit -m'orig'
>>
>> # Copy orig in new and modify orig
>> cp orig new
>> echo 'b' > orig
>>
>> # add -N and then commit trigger the bug
>> git add -N new
>> git commit
>>
>> # Cleanup
>> cd ..
>> rm -rf testrepo
>>
>> andreas@trelitri:/tmp$ LANG=C ./bugscript.sh
>> Initialized empty Git repository in /tmp/testrepo/.git/
>> [master (root-commit) 5dedf30] orig
>>  1 file changed, 0 insertions(+), 0 deletions(-)
>>  create mode 100644 orig
>> BUG: wt-status.c:476: multiple renames on the same target? how?
>> ./bugscript.sh: line 18: 22762 Aborted                 git commit
> 
> I can't reproduce this on Debian AMD64 either 2.19.0 in unstable, or
> 2.19.0.605.g01d371f741 in experimental. I tried moving my ~/.gitconfig
> out of the way, do you have some config options there that might be
> contributing to this?
> 
Elijah Newren· Sep 27, 2018, 04:20 UTC · lore

Re: Triggering "BUG: wt-status.c:476: multiple renames on the same target? how?"

On Wed, Sep 26, 2018, 2:27 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 6 quoted lines
>
> On Wed, Sep 26 2018, Andrea Stacchiotti wrote:
>
> > I'm very sorry, I indeed forgot the `diff.renames=copies`.
> >
> > The following script can reproduce the bug even with a blank config:
Thanks for the bug report and the simple testcase.
Show 29 quoted lines
> > ---------------------
> >
> > # Make a test repo
> > git init testrepo
> > cd testrepo
> > git config user.name A
> > git config user.email B
> > git config diff.renames copies
> >
> > # Add a file called orig
> > echo 'a' > orig
> > git add orig
> > git commit -m'orig'
> >
> > # Copy orig in new and modify orig
> > cp orig new
> > echo 'b' > orig
> >
> > # add -N and then commit trigger the bug
> > git add -N new
> > git commit
> >
> > # Cleanup
> > cd ..
> > rm -rf testrepo
>
> Thanks. Bisecting shows that the bug is in dc6b1d92ca ("wt-status: use
> settings from git_diff_ui_config", 2018-05-04) first released with
> 2.18.0.

The bisect is slightly misleading; the bug was introduced in 2.17.0 for renames, and when copy detection became a thing in 2.18.0 it also incidentally would trigger with copies. I'll post a patch soon.

← back to recent threads