Thread: XML writing and bzr hanging

  1. #1
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057

    XML writing and bzr hanging

    I was wondering what the best way to do this would be. I want to read an XML file into memory, modify the DOM tree (I can build this myself if I need to), and write the XML data out again, preserving the original formatting wherever possible. This means, of course, that the XML reader has to take into account whitespace and comments originally in the XML file, and have some sort of scheme for generating whitespace so that new tags line up reasonably well with the existing ones.

    I don't mind trying to write something like this myself, but I thought I'd ask for opinions before I started. Perhaps something like this already exists? It seems like it would be a relatively common problem.

    ----

    Also, I was starting a new project the other day, and I decided to use C++ and bzr just to be different (i.e. instead of C and git). But I must have recently upgraded my (Debian Lenny) bzr, because it always hangs while running (pre-commit?) hook number 3/5, and messes up the repository.

    I'm assuming that this is a Debian thing, because I've used bzr before and it worked just fine. I'm not expecting much help with this right now, because I haven't posted the error messages (which I do have, in ~/.bazaar.log, just not on this machine). I just thought I would mention it to see if someone else is having similar problems . . . .

    [I put these two seemingly different topics into one thread because they pertain to the same program, which I'll probably have more questions about in the future . . . .]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    But I must have recently upgraded my (Debian Lenny) bzr, because it always hangs while running (pre-commit?) hook number 3/5, and messes up the repository.
    I believe that bzr is pretty much always backward compatible. What is your current version of bzr?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Here's what I mean.
    Code:
    ~$ bzr init test
    ~$ cd test
    ~/test$ touch this that
    ~/test$ ls -a
    .  ..  .bzr  that  this
    ~/test$ bzr add *
    added that
    added this
    ~/test$ bzr commit
    Committing to: ~/test/
    added that
    added this
    [========================                ] Running pre_commit hooks - Stage 3/5
    At this point it hangs. It's not using any CPU or disk time, it's just frozen. (For over an hour -- I waited once.) I have to press CTRL-C. Here's the relevent part of ~/.bzr.log. (I replaced the path to my repository with '~' in this output.)
    Code:
    0.173  encoding stdout as sys.stdout encoding 'UTF-8'
    0.173  bzr arguments: [u'commit']
    0.174  looking for plugins in ~/.bazaar/plugins
    0.174  looking for plugins in /usr/lib/python2.5/site-packages/bzrlib/plugins
    0.174  Plugin name __init__ already loaded
    0.174  Plugin name __init__ already loaded
    0.266  bzr-svn: using Subversion 1.4.6 (/var/lib/python-support/python2.5/svn/core.pyc)
    0.431  encoding stdout as sys.stdout encoding 'UTF-8'
    0.519  opening working tree '~/test'
    0.542  preparing to commit
    [20619] 2008-06-13 17:48:14.584 INFO: Committing to: ~/test/
    0.559  Selecting files for commit with filter None
    [20619] 2008-06-13 17:48:14.614 INFO: added that
    [20619] 2008-06-13 17:48:14.616 INFO: added this
    0.665  check paths: None
    6.145  added revision_id {[email protected]}
    97.390  Traceback (most recent call last):
      File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 846, in run_bzr_catch_errors
        return run_bzr(argv)
      File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 797, in run_bzr
        ret = run(*run_argv)
      File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
        return self.run(**all_cmd_args)
      File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 2364, in run
        author=author)
      File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 165, in write_locked
        return unbound(self, *args, **kwargs)
      File "/usr/lib/python2.5/site-packages/bzrlib/workingtree_4.py", line 240, in commit
        result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
      File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 165, in write_locked
        return unbound(self, *args, **kwargs)
      File "/usr/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 197, in commit
        revprops=revprops, *args, **kwargs)
      File "/usr/lib/python2.5/site-packages/bzrlib/commit.py", line 395, in commit
        self.branch.set_last_revision_info(new_revno, self.rev_id)
      File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 165, in write_locked
        return unbound(self, *args, **kwargs)
      File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 1913, in set_last_revision_info
        self._run_post_change_branch_tip_hooks(old_revno, old_revid)
      File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 1431, in _run_post_change_branch_tip_hooks
        hook(params)
      File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/hook.py", line 50, in on_post_change_branch_tip
        activity.Activity().advertise_branch(params.branch)
      File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/activity.py", line 75, in advertise_branch
        self.announce_revision(branch.last_revision(), branch.base)
      File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/activity.py", line 86, in announce_revision
        self._call_on_broadcast('announce_revision', revision, url)
      File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/activity.py", line 136, in _call_on_broadcast
        mainloop.run()
      File "/var/lib/python-support/python2.5/dbus/connection.py", line 509, in _signal_func
        signal_name):
      File "/var/lib/python-support/python2.5/dbus/connection.py", line 425, in _iter_easy_matches
        for path in path_keys:
    KeyboardInterrupt
    
    97.390  return code 3
    Oh, and here's my version of bzr:
    Code:
    $ bzr --version
    Bazaar (bzr) 1.5
      Python interpreter: /usr/bin/python 2.5.2
      Python standard library: /usr/lib/python2.5
      bzrlib: /usr/lib/python2.5/site-packages/bzrlib
      Bazaar configuration: /home/dwk/.bazaar
      Bazaar log file: /home/dwk/.bzr.log
    
    Copyright 2005, 2006, 2007, 2008 Canonical Ltd.
    http://bazaar-vcs.org/
    
    bzr comes with ABSOLUTELY NO WARRANTY.  bzr is free software, and
    you may use, modify and redistribute it under the terms of the GNU
    General Public License version 2 or later.
    
    $
    It's the latest Lenny version. I just updated and the problem remains.

    Anyway, this is a silly place to start complaining about this. I should report a bug to Debian or perhaps try to figure out what's wrong myself. I'm unfortunately out of time at the moment, though, so I don't think I'll be able to.

    [edit] Oh, and the only interesting file in ~/.bazaar is bazaar.conf, which only contains this:
    Code:
    [DEFAULT]
    email = dwk <[email protected]>
    [/edit]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    problem of a mate was, that bzr didn't found the editor to open it so it seemed to "hang" for ever. just to be sure: try bzr commit -m"bla"

    what protocol are you using? ssh? is it working without bzr? ssh login@server?

Popular pages Recent additions subscribe to a feed