[PATCH] encoding fix

Olaf Conradi oohlaf at gmail.com
Tue Apr 4 07:43:42 BST 2006


On 04/04/06, Robert Collins <robertc at robertcollins.net> wrote:
> On Mon, 2006-03-27 at 12:51 +0200, Olaf Conradi wrote:
> > === modified file 'a/bzrlib/osutils.py'
> > --- a/bzrlib/osutils.py
> > +++ b/bzrlib/osutils.py
> > @@ -186,7 +186,7 @@
> >      # choke on a Unicode string containing a relative path if
> >      # os.getcwd() returns a non-sys.getdefaultencoding()-encoded
> >      # string.
> > -    _fs_enc = sys.getfilesystemencoding()
> > +    _fs_enc = sys.getfilesystemencoding() or 'ascii'
> >      def abspath(path):
> >          return os.path.abspath(path.encode(_fs_enc)).decode(_fs_enc)
>
> We have multiple uses of getfilesystemencoding in bzrlib. We should
> consolidate them so we dont have shotgun surgery with bugs like this.

There is only one place in bzrlib where getfilesystemencoding is
called. Other two places are in test cases (test_selftest.py and
test_msgeditor.py).

> Also, a test case is -strongly- desired - encoding issues are some of
> the most pernacious bugs we encounter.

I would not know how to make a test case for such a lowlevel system
function. It's not like you can set it. Either your system returns
None or a proper encoding. I think it gets triggered on openbsd
systems.

> Lastly, johns encoding branch is the penultimate fix for this, I'm going
> to see about getting it passing tests today.

OK, hope you add a check for this function returning None, as the
pythondoc mentions None can be retuned.

Cheers
 -Olaf




More information about the bazaar mailing list