config_dir() is inconsistent about type it returns

Bug #825826 reported by Jelmer Vernooij
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Martin Packman

Bug Description

depending on how it determines the config directory, bzrlib.config.config_dir() is inconsistent in what type it returns.

In some cases it returns a unicode string, and in some cases it returns a byte string. It would be nice if it was consistent, so callers could rely on it.

Tags: config easy

Related branches

Vincent Ladeuil (vila)
tags: added: config
Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 825826] Re: config_dir() is inconsistent about type it returns

On 13/08/11 17:40, Vincent Ladeuil wrote:
> ** Tags added: config
What would be the best thing to return in this case, a _fs_enc-encoded
bytestring?

Cheers,

Jelmer

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

> What would be the best thing to return in this case, a _fs_enc-encoded bytestring?

An fs-decoded URL :)

Failing that, whatever the transport API is expecting (do we even need a bytestring ? Shouldn't a transport be enough ?) .

The config dir should probably not leaks anywhere else than to operations related to its creation or its content which should be handled via the transport API anyway.

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

By the way, how did you find that config_dir does not always return the some type ? Do you have (by chance) tests reproducing the different cases ?

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

On 08/13/2011 07:31 PM, Vincent Ladeuil wrote:
> By the way, how did you find that config_dir does not always return the
> some type ? Do you have (by chance) tests reproducing the different
> cases ?
bzr-svn asserts that it returns a bye string. Apparently, the only way
to not get a byte string back (on Linux) is to set the BZR_HOME
environment variable.

Cheers,

Jelmer

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

> Apparently, the only way to not get a byte string back (on Linux) is to set the BZR_HOME environment variable.

Rats, related to my recent fix ?

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

On 13/08/11 21:34, Vincent Ladeuil wrote:
>> Apparently, the only way to not get a byte string back (on Linux) is
> to set the BZR_HOME environment variable.
>
> Rats, related to my recent fix ?
Yeah, it looks like it :-/

Cheers,

Jelmer

Martin Packman (gz)
Changed in bzr:
assignee: nobody → Martin Packman (gz)
status: Confirmed → In Progress
Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 2.5b6
status: In Progress → 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.