bzr add: exceptions.AttributeError: children on add

Bug #251864 reported by rodent
46
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Martin Packman

Bug Description

during a bzr add, bzr complains

------8<--------
bash-3.2$ bzr add information/graph/ontology/instances
bzr: ERROR: exceptions.AttributeError: children

Traceback (most recent call last):
  File "commands.py", line 846, in run_bzr_catch_errors
  File "commands.py", line 802, in run_bzr
  File "commands.py", line 504, in run_argv_aliases
  File "builtins.py", line 387, in run
  File "mutabletree.py", line 52, in tree_write_locked
  File "mutabletree.py", line 413, in smart_add
AttributeError: children

bzr 1.4 on python 2.5.1 (cygwin)
arguments: ['/usr/bin/bzr', 'add', 'information/graph/ontology/instances']
encoding: 'US-ASCII', fsenc: 'US-ASCII', lang: None
plugins:
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.
------8<--------

Before, a bzr status delivered:

------8<--------
bash-3.2$ bzr status
kind changed:
  information/graph/ontology/instances (file => directory)
modified:
  .gnupg/pubring.gpg
  .gnupg/trustdb.gpg
unknown:
  .bzr.log
  .gnupg/random_seed
  .gnupg/secring.gpg
  information/graph/ontology/biomed/
  information/graph/ontology/instances/EXACT-EXPO-May2008.owl
  information/graph/ontology/instances/EXACT-EXPO-May2008.pprj
  information/graph/ontology/instances/EXACT-OBI-May2008.owl
  information/graph/ontology/instances/EXACT-OBI-May2008.pprj
  information/graph/ontology/instances/EXACT-example.owl
  information/graph/ontology/instances/EXACT-example.pprj
  information/graph/ontology/instances/FEA.owl
  information/graph/ontology/instances/QVT.owl
  information/graph/ontology/instances/Thesaurus.owl
  information/graph/ontology/instances/UML2-Super-MDL-041007.owl
  information/graph/ontology/instances/odm_2006_04_03_kludge.owl
  information/graph/ontology/instances/references
------8<--------

The exotic situation seems to have arisen from the fact, that some time before a

  mv information/graph/ontology/instances information/graph/ontology/references
  mkdir information/graph/ontology/instances
  mv information/graph/ontology/references information/graph/ontology/instances/

had been done "without informing" bzr.

Undoing the described manual "mv" activities and doing the move in a bzr-aware style {bzr mv ...} let the problem disappear.

At least would the innocent benefit from a more transparent error message than above.

Related branches

Revision history for this message
James Westby (james-w) wrote :

Hi,

Thanks for taking the time to report this bug.

It looks like bug 192859, but that is about a symlink, whereas
it appears your tree changes a file to a directory. Is that correct?

Thanks,

James

Revision history for this message
rodent (markus-pilzecker) wrote : RE: [Bug 251864] Re: bzr add: exceptions.AttributeError: children

Hello James,

From: <email address hidden> [mailto:<email address hidden>] On
>
> Hi,
>
> Thanks for taking the time to report this bug.
>
Thanks for taking care of the bug ;-)

> It looks like bug 192859, but that is about a symlink, whereas
> it appears your tree changes a file to a directory. Is that correct?
>
Yes.

Cheers,

   Markus

Revision history for this message
James Westby (james-w) wrote : Re: bzr add: exceptions.AttributeError: children on committing a kind change
Download full text (4.2 KiB)

jw2328@flash:/tmp:1002:0% bzr init aaa
cd aaa
jw2328@flash:/tmp:1003:0% cd aaa
jw2328@flash:/tmp/aaa:1004:0% mkdira
zsh: command not found: mkdira
zsh: exit 127 mkdira
jw2328@flash:/tmp/aaa:1005:127% mkdir a
jw2328@flash:/tmp/aaa:1006:0% touch a/a
jw2328@flash:/tmp/aaa:1007:0% bzr add
added a
added a/a
jw2328@flash:/tmp/aaa:1008:0% bzr ci -m foo
Committing to: /tmp/aaa/
added a
added a/a
Committed revision 1.
jw2328@flash:/tmp/aaa:1009:0% mv a b
jw2328@flash:/tmp/aaa:1010:0% ln -s b a
jw2328@flash:/tmp/aaa:1011:0% bzr add
added b
added b/a
jw2328@flash:/tmp/aaa:1012:0% ls
total 1
lrwxrwxrwx 1 jw2328 jw2328 1 2008-07-28 13:19 a -> b
drwxr-xr-x 2 jw2328 jw2328 1024 2008-07-28 13:19 b
jw2328@flash:/tmp/aaa:1013:0% bzr ci -m asdf
Committing to: /tmp/aaa/
modified a
added b
bzr: ERROR: exceptions.AttributeError: children

Traceback (most recent call last):
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/commands.py", line 857, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/builtins.py", line 2340, in run
    author=author)
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/workingtree_4.py", line 242, in commit
    result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/mutabletree.py", line 197, in commit
    revprops=revprops, *args, **kwargs)
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/commit.py", line 355, in commit
    self._update_builder_with_changes()
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/commit.py", line 655, in _update_builder_with_changes
    self._populate_from_inventory(specific_files)
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/commit.py", line 783, in _populate_from_inventory
    content_summary)
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/commit.py", line 825, in _record_entry
    self.parent_invs, path, self.work_tree, content_summary)
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/repository.py", line 268, in record_entry_contents
    self.new_inventory.add(ie)
  File "/home/jw2328/devel/bzr/bzr.dev/bzrlib/inventory.py", line 1074, in add
    if entry.name in parent.children:
AttributeError: children

bzr 1.6b3 on python 2.5.2 (linux2)
arguments: ['/home/jw2328/bin//bzr', 'ci', '-m', 'asdf']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_GB.UTF-8'
plugins:
  addremove /home/jw2328/.bazaar/plugins/addremove [unknown]
  bisect /home/jw2328/.bazaar/plugins/bisect [1.1.0pre0]
  builddeb /home/jw2328/.bazaar/plugins/builddeb [0.92.0dev0]
  bzrtools /home/jw2328/.bazaar/plugins/bzrtools [1.6.0]
  dbus /usr/lib/python2.5/site-packages/bzrlib/plugins/dbus [unknown]
  e...

Read more...

Revision history for this message
James Westby (james-w) wrote :

Hi,

I reproduced a different bug.

There is definitely some similarity with bug 192859 here, but
it seems like there may be between 1 and 3 bugs.

Thanks,

James

Revision history for this message
James Westby (james-w) wrote :

Hi,

I can't reproduce this on current bzr.dev. Could you please
provide steps to reproduce this in a simple test branch, and
if possible test on a newer version of bzr.

Thanks,

James

Changed in bzr:
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Reproduced with 1.8rc1:

avallach:/tmp% bzr init p
avallach:/tmp% cd p
avallach:/tmp/p% touch a
avallach:/tmp/p% bzr add a
added a
avallach:/tmp/p% bzr ci -m a
Committing to: /tmp/p/
added a
Committed revision 1.
avallach:/tmp/p% rm a
avallach:/tmp/p% mkdir a
avallach:/tmp/p% touch a/bla
avallach:/tmp/p% bzr add a
<breakage>

Changed in bzr:
status: Incomplete → Confirmed
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

A workaround seems to be to run "bzr status" before "bzr add a"

Revision history for this message
Vitali Sokhin (vitalius) wrote :

I got it with bzr2.1.0. For some reason I already had a directory ("kuku/muku") without any file under it in my repo. So when I tried to add a file under this directory I got:

------------------------------8<--------------------------------------
adding kuku/muku
bzr: ERROR: exceptions.AttributeError: children

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 853, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 1055, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 661, in run_argv_aliases
    return self.run_direct(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 665, in run_direct
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/cleanup.py", line 122, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/cleanup.py", line 156, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 659, in run
    no_recurse, action=action, save=not dry_run)
  File "/usr/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 49, in tree_write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 417, in smart_add
    added.extend(_add_one_and_parent(self, inv, None, rf, kind, action))
  File "/usr/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 671, in _add_one_and_parent
    _FastPath(osutils.dirname(path.raw_path)), 'directory', action)
  File "/usr/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 674, in _add_one_and_parent
    _add_one(tree, inv, parent_ie, path, kind, action)
  File "/usr/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 691, in _add_one
    inv.add(entry)
  File "/usr/lib/python2.5/site-packages/bzrlib/inventory.py", line 1301, in add
    if entry.name in parent.children:
AttributeError: children

bzr 2.1.0 on python 2.5.1 (Linux-2.6.18-92.el5-i686-with-redhat-5.2-Tikanga)
arguments: ['/usr/bin/bzr', 'add', 'kuku/muku/myfile.h']
encoding: 'ISO-8859-1', fsenc: 'ISO-8859-1', lang: 'en_US'
plugins:
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [2.1.0]
  netrc_credential_store /usr/lib/python2.5/site-packages/bzrlib/plugins/netrc_credential_store [2.1.0]
  news_merge /usr/lib/python2.5/site-packages/bzrlib/plugins/news_merge [2.1.0]
  svn /afs/haifa/home/vitali/.bazaar/plugins/svn [1.0.2]
------------------------------8<--------------------------------------

The workaround was to remove this directory:
> bzr rm --kep kuku/muku

Revision history for this message
Martin Packman (gz) wrote :

Similar to bug 205636 but unlike that one bug 192859 didn't resolve it. Can do a similar kind of fix though.

Changed in bzr:
assignee: nobody → Martin [gz] (gz)
status: Confirmed → In Progress
Vincent Ladeuil (vila)
Changed in bzr:
status: In Progress → Fix Released
milestone: none → 2.3b3
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.