Cannot send first --add

Bug #234890 reported by Prodigious Penguin
4
Affects Status Importance Assigned to Milestone
five-a-day
Fix Released
Undecided
Unassigned

Bug Description

I just installed, updated my SSH key, echoed my LP username, echoed (and deleted) my LP team, and I am getting this error every time I try to add bug numbers:

Traceback (most recent call last):
  File "/usr/bin/5-a-day", line 39, in <module>
    sys.exit(main())
  File "/usr/bin/5-a-day", line 32, in main
    return bzr.add(args[1:])
  File "/usr/lib/python2.5/site-packages/fiveaday/bzr.py", line 82, in add
    log = files.LogFile()
  File "/usr/lib/python2.5/site-packages/fiveaday/files.py", line 95, in __init__
    self.entries)
  File "/usr/lib/python2.5/site-packages/fiveaday/files.py", line 94, in <lambda>
    self.correct_new_entries = filter(lambda a: first_element_is_int(a),
  File "/usr/lib/python2.5/site-packages/fiveaday/files.py", line 79, in first_element_is_int
    a = s.split()[0]
IndexError: list index out of range

Revision history for this message
Daniel Holbach (dholbach) wrote :

What did you type in the command line? What does ~/.5-a-day and ~/.5-a-day-team contain? Which version of five-a-day do you use?

Changed in five-a-day:
status: New → Incomplete
Revision history for this message
Prodigious Penguin (prodigiouspenguin) wrote :

I originally tried five-a-day 0.37 from the repositories, but updated revision to #79 from bzr.

Command line:
daniel@peng1:~$ 5-a-day --add 234260 234211 234099 201017 234487

~/.5-a-day:
prodigiouspenguin

~/.5-a-day-team did not exist when this bug was reported, but I added it and tried again, generating a different error:

daniel@peng1:~$ echo ubuntu-michigan > ~/.5-a-day-team
daniel@peng1:~$ 5-a-day --add 234260 234211 234099 201017 234487
Traceback (most recent call last):
  File "/usr/bin/5-a-day", line 39, in <module>
    sys.exit(main())
  File "/usr/bin/5-a-day", line 32, in main
    return bzr.add(args[1:])
  File "/usr/lib/python2.5/site-packages/fiveaday/bzr.py", line 81, in add
    update_team_file()
  File "/usr/lib/python2.5/site-packages/fiveaday/bzr.py", line 76, in update_team_file
    tof.add(files.get_lpid(), tf.teams)
  File "/usr/lib/python2.5/site-packages/fiveaday/files.py", line 74, in add
    f = open(tof_name, "a")
NameError: global name 'tof_name' is not defined

Revision history for this message
Daniel Holbach (dholbach) wrote :

The bug in comment 2 should be fixed in version 0.39, which is in the PPA. I still can't understand how the initial crash could have happened.

I'll try to make the code more robust later today and we can see if that fixes the problem.

Thanks for following up.

Changed in five-a-day:
status: Incomplete → New
Revision history for this message
Daniel Holbach (dholbach) wrote :

Can you attach ~/.5-a-day-data/prodigiouspenguin to the bug report?

Revision history for this message
Daniel Holbach (dholbach) wrote :

I hope this is going to help:

------------------------------------------------------------
revno: 82
committer: Daniel Holbach <email address hidden>
branch nick: 5-a-day
timestamp: Tue 2008-05-27 10:49:53 +0200
message:
  fiveaday/files.py: filter out empty lines in the bug log file, re-use some
  more code (LP: #234890)
------------------------------------------------------------

Changed in five-a-day:
status: New → Fix Committed
Revision history for this message
Prodigious Penguin (prodigiouspenguin) wrote :

Unpacking five-a-day (from .../five-a-day_0.39~hardy1_all.deb) ...
Setting up five-a-day (0.39~hardy1) ...

daniel@peng1:~$ 5-a-day --add 234260 234211 234099 201017 234487
bzr: ERROR: No WorkingTree exists for "file:///home/daniel/.5-a-day-data/.bzr/checkout/".
Traceback (most recent call last):
  File "/usr/bin/5-a-day", line 39, in <module>
    sys.exit(main())
  File "/usr/bin/5-a-day", line 32, in main
    return bzr.add(args[1:])
  File "/usr/lib/python2.5/site-packages/fiveaday/bzr.py", line 82, in add
    log = files.LogFile()
  File "/usr/lib/python2.5/site-packages/fiveaday/files.py", line 96, in __init__
    self.entries)
  File "/usr/lib/python2.5/site-packages/fiveaday/files.py", line 95, in <lambda>
    self.correct_new_entries = filter(lambda a: first_element_is_int(a),
  File "/usr/lib/python2.5/site-packages/fiveaday/files.py", line 80, in first_element_is_int
    a = s.split()[0]
IndexError: list index out of range

Revision history for this message
Daniel Holbach (dholbach) wrote :

You mentioned bzr above that's why I only released it in bzr. I did an upload to PPA now - let's hope that fixes it.

Revision history for this message
Daniel Holbach (dholbach) wrote :

Did you edit ~/.5-a-day-data/prodigiouspenguin yourself?

Revision history for this message
Prodigious Penguin (prodigiouspenguin) wrote :

Oh, when I checked bzr, it had the same revision from a few weeks ago that I already had installed. Guess I was looking at the wrong page? Anyway, I wiped ~/.5-a-day-data/prodigiouspenguin after the first time the program crashed in hopes that it would reset or something. There seems to be data there now though, uploading the new file.

Here's the crash after installing 0.40

daniel@peng1:~$ 5-a-day --add 234260 234211 234099 201017 234487
Traceback (most recent call last):
  File "/usr/bin/5-a-day", line 39, in <module>
    sys.exit(main())
  File "/usr/bin/5-a-day", line 32, in main
    return bzr.add(args[1:])
  File "/usr/lib/python2.5/site-packages/fiveaday/bzr.py", line 91, in add
    err = commit_changes(bool(filter(lambda a: a in ["-f", "--force"], args)))
  File "/usr/lib/python2.5/site-packages/fiveaday/bzr.py", line 39, in commit_changes
    last_rev = b.repository.get_revision(b.last_revision())
  File "<string>", line 4, in get_revision_read_locked
  File "/usr/lib/python2.5/site-packages/bzrlib/repofmt/knitrepo.py", line 196, in get_revision
    return self.get_revision_reconcile(revision_id)
  File "<string>", line 4, in get_revision_reconcile_read_locked
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 1082, in get_revision_reconcile
    return self._get_revisions([revision_id])[0]
  File "<string>", line 4, in _get_revisions_read_locked
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 1096, in _get_revisions
    self.get_transaction())
  File "/usr/lib/python2.5/site-packages/bzrlib/store/revision/knit.py", line 88, in get_revisions
    texts = self._get_serialized_revisions(revision_ids, transaction)
  File "/usr/lib/python2.5/site-packages/bzrlib/store/revision/knit.py", line 104, in _get_serialized_revisions
    return vf.get_texts(revision_ids)
  File "/usr/lib/python2.5/site-packages/bzrlib/knit.py", line 1132, in get_texts
    return [''.join(l) for l in self.get_line_list(version_ids)]
  File "/usr/lib/python2.5/site-packages/bzrlib/knit.py", line 1137, in get_line_list
    self.check_not_reserved_id(version_id)
  File "/usr/lib/python2.5/site-packages/bzrlib/versionedfile.py", line 62, in check_not_reserved_id
    revision.check_not_reserved_id(version_id)
  File "/usr/lib/python2.5/site-packages/bzrlib/revision.py", line 456, in check_not_reserved_id
    raise errors.ReservedId(revision_id)
bzrlib.errors.ReservedId: Reserved revision-id {null:}

Revision history for this message
Daniel Holbach (dholbach) wrote :

Now bzr is confused because your file is still in version control, but you removed it.

Can you wipe ~/.5-a-day-data completely? It should check out the branch again and ignore the empty entry in ~/.5-a-day-data/prodigiouspenguin now.

Revision history for this message
Daniel Hahler (blueyed) wrote :

I rather think the problem here is that we pass b.last_revision() (which is probably null) to b.repository.get_revision.

The attached patch should fix this.

Please note, that I've only skimmed the traceback and haven't tested/verified the patch.

Revision history for this message
Prodigious Penguin (prodigiouspenguin) wrote :

Wiping ~/.5-a-day-data did the trick. Didn't need to try the bzr patch.

Thank you guys, I'd say it's fixed. :)

Revision history for this message
Daniel Holbach (dholbach) wrote :

 five-a-day (0.41) intrepid; urgency=low
 .
   * fiveaday/files.py: also strip "[]()" from bug arguments - thanks a lot
     Daniel Hahler <email address hidden> for the patch. (LP: #235597)
   * fiveaday/bzr.py: check for branch.last_revision() to avoid bzr crashing in
     corner cases. Thanks a lot Daniel Hahler <email address hidden> for the
     patch. (LP: #234890)

Changed in five-a-day:
status: Fix Committed → Fix Released
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.