commit uses system user-id to generate revision-id even when committer id is supplied

Bug #614404 reported by Aaron Bentley
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Low
Unassigned
Launchpad itself
Fix Released
Medium
Unassigned

Bug Description

The supplied traceback was generated with "committer" set, but system username unset.

While the text of revision-ids is arguably unimportant, the requirement that a system username be set even if it's not being used as the commit-id is a burden for bzrlib clients.

  File "/home/abentley/launchpad/stable/eggs/testtools-0.9.2-py2.6.egg/testtools/runtest.py", line 128, in _run_user
    return fn(*args)
  File "/home/abentley/launchpad/stable/eggs/testtools-0.9.2-py2.6.egg/testtools/testcase.py", line 368, in _run_test_method
    testMethod()
  File "/home/abentley/launchpad/new-bzr/lib/lp/code/tests/test_directbranchcommit.py", line 93, in test_commit_returns_revision_id
    revision_id = self.committer.commit('')
  File "/home/abentley/launchpad/new-bzr/lib/lp/code/model/directbranchcommit.py", line 194, in commit
    self.bzrbranch, commit_message, committer=committer_id)
  File "/home/abentley/launchpad/stable/eggs/bzr-2.2b4-py2.6-linux-x86_64.egg/bzrlib/transform.py", line 980, in commit
    revision_id=revision_id)
  File "/home/abentley/launchpad/stable/eggs/bzr-2.2b4-py2.6-linux-x86_64.egg/bzrlib/branch.py", line 704, in get_commit_builder
    timestamp, timezone, committer, revprops, revision_id)
  File "/home/abentley/launchpad/stable/eggs/bzr-2.2b4-py2.6-linux-x86_64.egg/bzrlib/repository.py", line 1765, in get_commit_builder
    timestamp, timezone, committer, revprops, revision_id)
  File "/home/abentley/launchpad/stable/eggs/bzr-2.2b4-py2.6-linux-x86_64.egg/bzrlib/repofmt/pack_repo.py", line 117, in __init__
    revprops=revprops, revision_id=revision_id)
  File "/home/abentley/launchpad/stable/eggs/bzr-2.2b4-py2.6-linux-x86_64.egg/bzrlib/repository.py", line 138, in __init__
    self._generate_revision_if_needed()
  File "/home/abentley/launchpad/stable/eggs/bzr-2.2b4-py2.6-linux-x86_64.egg/bzrlib/repository.py", line 258, in _generate_revision_if_needed
    self._new_revision_id = self._gen_revision_id()
  File "/home/abentley/launchpad/stable/eggs/bzr-2.2b4-py2.6-linux-x86_64.egg/bzrlib/repository.py", line 245, in _gen_revision_id
    return generate_ids.gen_revision_id(self._config.username(),
  File "/home/abentley/launchpad/stable/eggs/bzr-2.2b4-py2.6-linux-x86_64.egg/bzrlib/config.py", line 279, in username
    raise errors.NoWhoami()
NoWhoami: Unable to determine your name.

Tags: lp-code

Related branches

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 614404] [NEW] commit uses system user-id to generate revision-id even when committer id is supplied

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

Aaron Bentley wrote:
> Public bug reported:
>
> The supplied traceback was generated with "committer" set, but system
> username unset.
>
> While the text of revision-ids is arguably unimportant, the requirement
> that a system username be set even if it's not being used as the commit-
> id is a burden for bzrlib clients.

It isn't a strict requirement for the revision-ids. We *did* decide to
make it a strict requirement for commit to put a correct username into
the Revision record.

I'm pretty sure this is WontFix, as it was an explicit decision in the
last release.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxcLRUACgkQJdeBCYSNAAOZUgCfTlDchkGRxIkzp1vUrTz01Ayz
2r4Ani+yEheE0cFqsaZjDdGZY9+tsck8
=Q80y
-----END PGP SIGNATURE-----

Revision history for this message
Aaron Bentley (abentley) wrote :

It is a strict requirement in bzr 2.2b4. As shown above, you get a traceback when the system username is not set, even if the commit-id is set. It doesn't seem likely that it was a deliberate decision to require a system username even when a commit-id was supplied explicitly.

Revision history for this message
John A Meinel (jameinel) wrote :

In talking over this with Aaron on IRC, I think a fix like this would be reasonable:
=== modified file 'bzrlib/repository.py'
--- bzrlib/repository.py 2010-05-25 17:27:52 +0000
+++ bzrlib/repository.py 2010-08-06 19:11:55 +0000
@@ -242,7 +242,7 @@

     def _gen_revision_id(self):
         """Return new revision-id."""
- return generate_ids.gen_revision_id(self._config.username(),
+ return generate_ids.gen_revision_id(self._committer,
                                             self._timestamp)

     def _generate_revision_if_needed(self):

self._committer is already set to self._config.username() if one is not supplied, and this way if one *is* specified then it gets used.

Changed in bzr:
importance: Undecided → Low
status: New → Confirmed
Paul Hummer (rockstar)
Changed in launchpad-code:
status: New → Triaged
importance: Undecided → Medium
Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 2.2.1
status: Confirmed → Fix Released
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

This fix breaks when the person in question does not have a preferred email set; format_address_for_person blindly assumes there's a person.preferredemail. This is now breaking translations exports in production, to team-owned branches in particular.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

The translations failure this causes is bug 643445.

Jelmer Vernooij (jelmer)
Changed in launchpad:
status: Triaged → 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.