I've gotten some time to debug this.

  The culprit is gnc_account_lookup_by_full_name.  When called with
what looks like a pointer to the root account and the fully qualified
name of the account in question, it fails to find the account.

  What happens is this:
  
  (1) it splits the name into path segments at colon characters.
      The input name is "A:B:C", so the path elements are "A",
      "B", and "C".

  (2) it starts traversing the account tree from the root.
      First it finds "A" and recurs into it.  But at the next
      level of search, the node "B" is not present, but the
      node "B:C" is.  In other words, *a path separator appears
      in the name of an account*.  (don't ask me how this happened,
      it's not my software that wrote the file :) )

      Predictably, gnucash fails to find the account and pops up
      the dialog asking if I want to create a new account.

  I can also see this in the GNUCash data file: the <act:name> element
contains a colon character.  If I change the account name to not contain
a colon character, the problem goes away.  If I change it back, the
problem reappears.

  An easy fix, then, would be to

  (a) do input validation and reject account names that contain a
      path separator, and
  (b) when reading the file, change colons into some harmless character
      (e.g., commas)

  Obviously there are better alternatives to (b): for instance, you
could automatically convert commas into new nesting levels or modify
gnc_account_lookup_by_name_full() to recognize colons within account
names.  (the latter should be fairly straightforward, and I could
attempt a patch if you'd like)  Anyway, though, the current behavior is
hideously confusing for the user.

  Daniel



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to