mv --auto does not handle directory adds mixed with the contents of a directory splitting in two: InconsistentDelta error

Bug #373319 reported by Frits Jalvingh
74
This bug affects 13 people
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
High
mnn
Breezy
Fix Released
Medium
Jelmer Vernooij

Bug Description

#!/bin/bash
rm -rf testrepo
bzr init testrepo
cd testrepo

mkdir a
echo 1 > a/file1.java
echo 2 > a/file2.java
echo 3 > a/file3.java

bzr add
bzr commit -m "Initial commit"

mkdir c
mv a/file1.java c/file1new.java
mv a/file2.java a/file2new.java
mv a/file3.java a/file3new.java

echo "-------- moving ---------------"
bzr mv --auto

...

a => c
a/file1.java => c/file1new.java
a/file2.java => a/file2new.java
a/file3.java => a/file3new.java
bzr: ERROR: An inconsistent delta was supplied involving u'a', 'a-id-1'
reason: This parent is not present.

Related branches

Revision history for this message
Martin Pool (mbp) wrote : Re: dirstate AssertionError: "Could not find target parent in wt" after auto mv/rename

This is a similar traceback to and may represent a regression of bug 150438.

summary: - AssertionError: Could not find target parent in wt
+ dirstate AssertionError: "Could not find target parent in wt" after
+ auto mv/rename
Changed in bzr:
importance: Undecided → High
status: New → Confirmed
summary: dirstate AssertionError: "Could not find target parent in wt" after
- auto mv/rename
+ auto mv/rename or deleting directory
Revision history for this message
Martin Pool (mbp) wrote :

In bug 277476 this occurred after deleting a directory

tags: added: dirstate
Revision history for this message
Robert Collins (lifeless) wrote : Re: dirstate AssertionError: "Could not find target parent in wt" after auto mv/rename or deleting directory

Fritz, could you try to duplicate this with current bzr.dev ? Its quite complex to reproduce exactly without sample data, so I'd like it if:
 - you can confirm that its still not fixed
 - you could create a small script that demonstrates the problem.

something like:
bzr init trunk
cd trunk
echo 1 > 1
echo 2 > 2
#...
bzr add
bzr commit -m "1"
# make the changes you need to setup the failure you're getting
bzr mv --auto

Revision history for this message
Robert Collins (lifeless) wrote :

Ping? Fritz, can you please try as I asked...

Changed in bzr:
status: Confirmed → Incomplete
Revision history for this message
Frits Jalvingh (fjalvingh) wrote :
Download full text (8.8 KiB)

Oops... I missed your request, sorry.

I am able to reproduce in our full tree, I will try to make a script for you.

The base cause seems very clear though in the topmost trace, the bzr mv --auto **renames**:

vp-soap-server/test/nl/itris/soap/server => vp-soap-server/test/nl/itris/soap/util

but the source dir (vp-soap-server/test/nl/itris/soap/server) contains files and they are actually touched afterwards - this cannot be the case after the move..

I made a new testcase and tried it with bzr-1.17:
jal@odeon:~/bzr/xxx$ bzr status
removed:
  vp-soap-server/test/nl/itris/soap/server/DummySoapCallClass1.java
  vp-soap-server/test/nl/itris/soap/server/JaxbInputObject.java
  vp-soap-server/test/nl/itris/soap/server/TestAnnotatedCall.java
  vp-soap-server/test/nl/itris/soap/server/TestFormatDecoders.java
  vp-soap-server/test/nl/itris/soap/server/TestJaxb.java
  vp-soap-server/test/nl/itris/soap/server/TestMimeDecoders.java
  vp-soap-server/test/nl/itris/soap/server/TestXmlExecutor.java
unknown:
  vp-soap-server/test/nl/itris/soap/newone/
  vp-soap-server/test/nl/itris/soap/server/FormatDecodersTest.java
  vp-soap-server/test/nl/itris/soap/server/JaxbTest.java
  vp-soap-server/test/nl/itris/soap/server/SoapDummyCallClass1.java
  vp-soap-server/test/nl/itris/soap/server/XmlExecutorTest.java
jal@odeon:~/bzr/xxx$ tar czf ~/testbzr-xxx .
jal@odeon:~/bzr/xxx$ bzr mv --auto
vp-soap-server/test/nl/itris/soap/server => vp-soap-server/test/nl/itris/soap/newone
vp-soap-server/test/nl/itris/soap/server/DummySoapCallClass1.java => vp-soap-server/test/nl/itris/soap/server/SoapDummyCallClass1.java
vp-soap-server/test/nl/itris/soap/server/TestFormatDecoders.java => vp-soap-server/test/nl/itris/soap/server/FormatDecodersTest.java
vp-soap-server/test/nl/itris/soap/server/TestJaxb.java => vp-soap-server/test/nl/itris/soap/server/JaxbTest.java
vp-soap-server/test/nl/itris/soap/server/TestXmlExecutor.java => vp-soap-server/test/nl/itris/soap/server/XmlExecutorTest.java
jal@odeon:~/bzr/xxx$ bzr status
bzr: ERROR: exceptions.AssertionError: Could not find target parent in wt: vp-soap-server/test/nl/itris/soap/server
parent of: (('vp-soap-server/test/nl/itris/soap/server', 'FormatDecodersTest.java', 'testformatdecoders.j-20090811164112-c8rqxirf7yq88zvh-1190'), [('f', '', 0L, 0, 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'), ('r', 'vp-soap-server/test/nl/itris/soap/server/TestFormatDecoders.java', 0L, 0, '')])

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 835, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 1030, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 647, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 1045, in ignore_pipe
    result = func(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 310, in run
    show_pending=(not no_pending), verbose=verbose)
  File "/usr/lib/python2.6/dist-packages/bzrlib/status.py", line 118, in show_tree_status
    want_unversioned=wan...

Read more...

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 373319] Re: dirstate AssertionError: "Could not find target parent in wt" after auto mv/rename or deleting directory

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Frits Jalvingh wrote:
> Oops... I missed your request, sorry.

Thats fine.

erver/TestJaxb.java =>
vp-soap-server/test/nl/itris/soap/server/JaxbTest.java
> vp-soap-server/test/nl/itris/soap/server/TestXmlExecutor.java => vp-soap-server/test/nl/itris/soap/server/XmlExecutorTest.java
> bzr: ERROR: An inconsistent delta was supplied involving u'vp-soap-server/test/nl/itris/soap/server', 'server-20090811164112-c8rqxirf7yq88zvh-706'
> reason: This parent is not present.
>
> Different error, same problem.
>
> I will try to make a script for this but need to find some time to do
> so.

That would be great. It looks slightly different to a [similar] bug with
mv --auto and unversioned directories.

bzr 1.18 will no longer corrupt your dirstate, so you won't get ongoing
errors after this happens, only at the specific command that fails.

- -Rob
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqOn2IACgkQ42zgmrPGrq74dgCfd4LjScVeM/6CFPDB1vGpBsVR
L0YAnj2shw3dBvaGJsJFOF6pao7xtO7o
=ZmrL
-----END PGP SIGNATURE-----

Revision history for this message
Frits Jalvingh (fjalvingh) wrote : Re: dirstate AssertionError: "Could not find target parent in wt" after auto mv/rename or deleting directory

This script shows the observed problem. Key points:
* From an original directory move some files to a new directory
* Cause a RENAME change in the original source directory too (it must be a rename change)

The root cause is that mv --auto almost always sees the moving of a few files to a new directory as a rename of the directory - and that is only the case in a very limited number of circumstances:
* If the source directory is empty or gone (certainty)
* if the number of files moved to the new dir is bigger than the remaining number in the source one might say the directory moved (and some files were then moved back).

You can see this wrong behaviour also if you just move a few files from the original to the new without renaming stuff in the source dir: bzr will not die but it will mark the source as renamed to new, and it will have an "unknown" (= not added) status for the remaining source - which is very wrong also (the files that are still left in it were version controlled).

Execution of the above script:
jal@cluny:~/j$ ./tbzr
2.0dev
Created a standalone tree (format: 2a)
adding a
adding a/file1.java
adding a/file2.java
adding a/file3.java
adding a/file4.java
adding a/file5.java
Committing to: /home/jal/j/testrepo/
added a
added a/file1.java
added a/file2.java
added a/file3.java
added a/file4.java
added a/file5.java
Missing checkcommit.jar, not checking commits.
Committed revision 1.
removed:
  a/file1.java
  a/file2.java
  a/file3.java
modified:
  a/file4.java
unknown:
  c/
  a/file3new.java
  a/file4new.java
-------- moving ---------------
a => c
a/file1.java => c/file1new.java
a/file2.java => c/file2new.java
a/file3.java => a/file3new.java
bzr: ERROR: An inconsistent delta was supplied involving u'a', 'a-20090822092805-y0z3pmiccyt4ymgf-1'
reason: This parent is not present.
-------- status ---------------
removed:
  a/file1.java
  a/file2.java
  a/file3.java
modified:
  a/file4.java
unknown:
  c/
  a/file3new.java
  a/file4new.java

Changed in bzr:
status: Incomplete → Confirmed
Revision history for this message
Robert Collins (lifeless) wrote :

smaller reproduction script. Seems to rename c, and then operate on a.

#!/bin/bash
rm -rf testrepo
bzr init testrepo
cd testrepo

mkdir a
echo 1 > a/file1.java
echo 2 > a/file2.java
echo 3 > a/file3.java

bzr add
bzr commit -m "Initial commit"

mkdir c
mv a/file1.java c/file1new.java
mv a/file2.java a/file2new.java
mv a/file3.java a/file3new.java

echo "-------- moving ---------------"
bzr mv --auto

summary: - dirstate AssertionError: "Could not find target parent in wt" after
- auto mv/rename or deleting directory
+ mv --auto does not handle directory adds mixed with the contents of a
+ directory splitting in two: InconsistentDelta error
tags: removed: dirstate
description: updated
Revision history for this message
Erik de Castro Lopo (erikd) wrote :

I have a broken repo. Poolie suggested I branch from the broken repo to a new one when I got a new crash. He asked me to post the traceback.

Revision history for this message
Fabian Köster (maestro-alubia) wrote :

I also ran into this after using 'bzr mv'.

Can we expect a new release with a fix soon? Please let me know if I can help!

Jelmer Vernooij (jelmer)
tags: added: case-sensitivity
tags: added: mv
Revision history for this message
mnn (mnn282) wrote :

I've been able to fix this - required a few changes in RenameMap.

Changed in bzr:
assignee: nobody → mnn (mnn282)
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
Changed in brz:
status: New → Triaged
importance: Undecided → Medium
Jelmer Vernooij (jelmer)
Changed in brz:
assignee: nobody → Jelmer Vernooij (jelmer)
status: Triaged → In Progress
Jelmer Vernooij (jelmer)
Changed in brz:
status: In Progress → Fix Released
milestone: none → 3.0.0
tags: removed: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.