bzr should not try to guess username but require setting it with whoami

Bug #549310 reported by William Grant
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Wishlist
Parth Malwankar

Bug Description

I see too many people committing with a bad 'First Last <user@hostname>' whoami. bzr should probably warn if the whoami domain is simply a hostname.

Tags: easy

Related branches

Revision history for this message
Vincent Ladeuil (vila) wrote :

Sounds like a good idea since a warning will not block anyone and help people that want to share their code realize that email maybe the only way to reach them.

Changed in bzr:
status: New → Confirmed
importance: Undecided → Wishlist
tags: added: easy
Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 549310] Re: Should warn if default whoami is insane

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

Vincent Ladeuil wrote:
> Sounds like a good idea since a warning will not block anyone and help
> people that want to share their code realize that email maybe the only
> way to reach them.
>
> ** Changed in: bzr
> Status: New => Confirmed
>
> ** Changed in: bzr
> Importance: Undecided => Wishlist
>
> ** Tags added: easy
>

We've had people complain about it requiring emails before...

'bzr whoami' does have the code:
        try:
            config.extract_email_address(name)
        except errors.NoEmailInUsername, e:
            warning('"%s" does not seem to contain an email address. '
                    'This is allowed, but not recommended.', name)

We could *probably* extend that to also checking if there is a '.' in
the email address.

However, I have a very strong feeling that people who are committing
with "<joe@host>" are actually *never* running 'bzr whoami', and we are
just inferring their username from the system.

So we would have to complain at some other time (like every time the
user tries to commit). This is sort of fallout of a decision to minimize
the number of steps you need to do to 'get going'. We could:

1) Abort if we need a username and the user has not supplied one.
  a) Only do this for 'commit' style actions
  b) Also do this for 'checkout', since we use the user info in the
     'lock' file to indicate to other people who locked this.
2) Give a warning whenever we guess an identity, rather than an
   explicitly stated one. (Also subject to a & b)
3) Give a warning if we use an guessed identity, but it doesn't quite
   fit what we think a real one should look like. (No User, no '.' in
   email, etc.)
4) Just use the guessed identity (status quo).

I might be ok with "2a". Warn if we are guessing the user identity
during commit, but don't warn for stuff like lock files. Certainly many
of us have a "foo@newmachine" commit in our history.

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

iEYEARECAAYFAkuuC3MACgkQJdeBCYSNAAO8ggCg0jjYVL6jYovv9P1T4gMGNatW
3eAAnAxsMcTddN81YksxqJhEq2h9m/uu
=bxIH
-----END PGP SIGNATURE-----

Revision history for this message
Parth Malwankar (parthm) wrote : Re: Should warn if default whoami is insane

I have been bitten by this issue in much the same way as John describes.

Basically, I do my changes on Linux. Switch to a windows machine test something and forget that I haven't really done a 'bzr whoami <email address hidden>' there. After doing some minor fix I checkin. The problem is that at that point I don't even realize that the checkin was from testlogin@testpc. Some time later, my lauchpad branch view says 'X commit by 2 people' and I have not idea whats going on as I am the only committer to the project :-)

I think at a minimum commit actions should at least give a warning if some default user is being user.

However, personally I would also prefer an error say something like 'Please use `bzr whoami "First Last <email address hidden>"` to set user id for commit' as it may be better to fail and inform the user of the bzr whoami command rather than add a bad name to the commit and expect him to undo. In the above example which I quoted, I discovered the problem while viewing the branch in launchpad after a whole lot of commits so there wasn't much I could do about it.

Also, this causes plugins like lp:bzr-stats to give inaccurate results.

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 549310] Re: Should warn if default whoami is insane

On Sat, 2010-03-27 at 14:07 +0000, Parth Malwankar wrote:
> Also, this causes plugins like lp:bzr-stats to give inaccurate results.
bzr-stats should be able to figure out what authors are the same by looking at the full names.

Ideally, Bazaar would need to have some mechanism to allow aliasing
different identities, much like git's .mailmap feature. Even if we do
warn people when a default identity is being used, you can't really
expect people's email addresses to never change.

Cheers,

Jelmer

Revision history for this message
Martin Pool (mbp) wrote :

Perhaps the simplest thing is to remove auto-guessing of usernames.
If you have not set a userid and we need one, whether for commit or
for a lockdir, we should just ask you to set it. We could probably
trust $EMAIL if it's set, but not $user@$host.

--
Martin <http://launchpad.net/~mbp/>

Revision history for this message
William Grant (wgrant) wrote : Re: Should warn if default whoami is insane

Martin, that is an excellent proposal. It's what I've thought for a long time now, but I felt it too intrusive to propose.

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 549310] Re: Should warn if default whoami is insane

On 29/03/10 03:49, Martin Pool wrote:
> Perhaps the simplest thing is to remove auto-guessing of usernames.
> If you have not set a userid and we need one, whether for commit or
> for a lockdir, we should just ask you to set it. We could probably
> trust $EMAIL if it's set, but not $user@$host.
>
Yeah, that sounds sensible.

Cheers,

Jelmer

Parth Malwankar (parthm)
Changed in bzr:
status: Confirmed → In Progress
assignee: nobody → Parth Malwankar (parthm)
summary: - Should warn if default whoami is insane
+ bzr should not try to guess username but require setting it with whoami
Parth Malwankar (parthm)
Changed in bzr:
status: In Progress → Fix Released
milestone: none → 2.2b3
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.