Putting svn password in authentication.conf doesn't work

Bug #452121 reported by Torne Wuff
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Bazaar Subversion Plugin
Fix Released
Undecided
Unassigned

Bug Description

I have a bzr-svn checkout from svn://svn.rockbox.org/rockbox/trunk. I can push changes with bzr dpush just fine if I let it prompt me for the password, but if I add the password to authentication.conf, it dies.

My authentication.conf:
[rockbox]
scheme = svn
host = svn.rockbox.org
user = torne
#password = MyPassword

It works if the password line is commented, prompts me for it and when I enter it the push works fine. If I uncomment the password line I get the following backtrace:

torne@whitefang ~/big/rockbox/upstream/tools $ bzr dpush
Using saved location: svn://svn.rockbox.org/rockbox/trunk
bzr: ERROR: exceptions.TypeError: password should be string

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 835, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 1030, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 647, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/foreign.py", line 313, in run
    push_result = source_branch.lossy_push(target_branch)
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 921, in lossy_push
    return lossy_push(stop_revision)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/svn/branch.py", line 906, in lossy_push
    result.revidmap = self._update_revisions_lossy(stop_revision)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/svn/branch.py", line 882, in _update_revisions_lossy
    push_metadata=False, base_revid=base_revid)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/svn/push.py", line 239, in push
    override_svn_revprops=target_config.get_override_svn_revprops())
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/svn/push.py", line 153, in push_revision_tree
    revid = builder.commit(rev.message)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/svn/errors.py", line 137, in convert
    return unbound(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/svn/commit.py", line 775, in commit
    self._svn_revprops, done, None, False)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/svn/errors.py", line 137, in convert
    return unbound(*args, **kwargs)
TypeError: password should be string

bzr 1.17 on python 2.5.2 (linux2)
arguments: ['/usr/bin/bzr', 'dpush']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_GB.UTF-8'
plugins:
  bzrtools /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [1.17]
  interactive /home/torne/.bazaar/plugins/interactive [1.2]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [1.17]
  loom /usr/lib/python2.5/site-packages/bzrlib/plugins/loom [1.4dev]
  netrc_credential_store /usr/lib/python2.5/site-packages/bzrlib/plugins/netrc_credential_store [1.17]
  rebase /usr/lib/python2.5/site-packages/bzrlib/plugins/rebase [0.5.4]
  svn /usr/lib/python2.5/site-packages/bzrlib/plugins/svn [1.0]
  vimdiff /home/torne/.bazaar/plugins/vimdiff [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Related branches

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Sorry, I can't reproduce this. What version of subvertpy are you using? Can you try with bazaar 2.0?

Changed in bzr-svn:
status: New → Incomplete
Revision history for this message
Torne Wuff (torne) wrote :

It's subvertpy 0.6.9. I'll try bzr 2.0 and/or a newer subvertpy when I get a chance...

Revision history for this message
Levi Bard (taktaktaktaktaktaktaktaktaktak) wrote :

I experience this issue as well.
bzr 2.0.1 on python 2.5.4 (Linux-2.6.30-2-686-i686-with-debian-squeeze-sid)
plugins:
  bzrtools /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [2.0.1]
  git /usr/lib/python2.5/site-packages/bzrlib/plugins/git [0.4.1]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [2.0.1]
  netrc_credential_store /usr/lib/python2.5/site-packages/bzrlib/plugins/netrc_credential_store [2.0.1]
  rebase /usr/lib/python2.5/site-packages/bzrlib/plugins/rebase [0.5.4]
  svn /usr/lib/python2.5/site-packages/bzrlib/plugins/svn [1.0.0]

ii python-subvertpy 0.6.9-1

Revision history for this message
Levi Bard (taktaktaktaktaktaktaktaktaktak) wrote :

Same result with subvertpy 0.7.0-1.

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 452121] Re: Putting svn password in authentication.conf doesn't work

On Mon, 2009-10-26 at 15:02 +0000, Levi Bard wrote:
> Same result with subvertpy 0.7.0-1.
Does the password contain non-ascii characters or something like that ?

Cheers,

Jelmer

Revision history for this message
Levi Bard (taktaktaktaktaktaktaktaktaktak) wrote :

Nope. In my test case, it's actually the same as my username.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Can you reproduce this with the tortoisesvn subversion repository ? The
username/password should both be guest.

This is the repository I have been trying to reproduce this bug with.

Revision history for this message
Levi Bard (taktaktaktaktaktaktaktaktaktak) wrote : Re: [Bug 452121] Re: Putting svn password in authentication.conf doesn't work

> Can you reproduce this with the tortoisesvn subversion repository ? The
> username/password should both be guest.
>
> This is the repository I have been trying to reproduce this bug with.

The tortoisesvn repo works for me, either with scheme http or scheme svn.
My other test is with a svn:// url, whereas the tortoise repo uses a
http:// url - could that be the difference?

Revision history for this message
John Spickes (john-spickes) wrote :

I was able to reproduce this problem with bazaar 2.0.0, and I corrected the problem. The issue was in /usr/lib/python2.6/dist-packages/bzrlib/plugins/svn/auth.py, in get_svn_simple(). password was coming back from self.get_password() with type 'unicode' instead of 'str'. I was able to just force password into a string by doing password = str(password), and things started working.

I'm attaching a patch - apologize if it's not of the usual format for launchpad. Hope this helps.

Revision history for this message
Levi Bard (taktaktaktaktaktaktaktaktaktak) wrote :

John's patch, or alternatively encoding the password as the username is encoded in that method, produces the expected behavior for me as well.

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 452121] Re: Putting svn password in authentication.conf doesn't work

  status incomplete

I'd like to understand how this is happening.

How are you entering your password exactly? are you entering it in a
prompt on the console ?

Cheers,

Jelmer

Revision history for this message
Torne Wuff (torne) wrote :

If I let svn prompt me for the password on the console, then typing it at the prompt works. If I put the password in authentication.conf the result is as in the original report.

Revision history for this message
John Spickes (john-spickes) wrote :

The behavior for me is as Torne describes. Entering the password from the console works fine, but putting it in the authentication.conf file doesn't work. The modification to auth.py that I posted has corrected the problem for me.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

  status fixreleased

Thanks, that helps explain what the problem is. The object that is
returned by AuthenticationConfig.get_password() can be either a unicode
or a str object, which of these it is depends on how the password was
obtained.

I have filed a bug against bazaar asking for a consistent return type.

Changed in bzr-svn:
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.