Comment 1 for bug 431241

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

So I tracked down the cause. It seems to be this line in bzrtools:
  === modified file 'shell.py'
--- shell.py 2008-02-13 04:58:32 +0000
+++ shell.py 2009-09-22 18:09:52 +0000
@@ -99,7 +99,7 @@
         self.identchars += '-'
         ensure_config_dir_exists()
         self.history_file = osutils.pathjoin(config_dir(), 'shell-history')
- readline.set_completer_delims(string.whitespace)
+ readline.set_completer_delims(string.whitespace[:-1])
         if os.access(self.history_file, os.R_OK) and \
             os.path.isfile(self.history_file):
             readline.read_history_file(self.history_file)

I don't know 100% how to trigger it, but I know we have this comment in 'osutils.py':
def contains_whitespace(s):
    """True if there are any whitespace characters in s."""
    # string.whitespace can include '\xa0' in certain locales, because it is
    # considered "non-breaking-space" as part of ISO-8859-1. But it
    # 1) Isn't a breaking whitespace
    # 2) Isn't one of ' \t\r\n' which are characters we sometimes use as
    # separators
    # 3) '\xa0' isn't unicode safe since it is >128.

    # This should *not* be a unicode set of characters in case the source
    # string is not a Unicode string. We can auto-up-cast the characters since
    # they are ascii, but we don't want to auto-up-cast the string in case it
    # is utf-8
    for ch in ' \t\n\r\v\f':
        if ch in s:
            return True
    else:
        return False

What is really really weird is that if I do:

  python -c "import string; print repr(string.whitespace)"
It *doesn't* contain '\xa0'

But if i do:
  bzr shell

And change shell.py to read:
+ print repr(string.whitespace)
         readline.set_completer_delims(string.whitespace)

It *does* contain '\xa0'.

But I haven't figured out anywhere that actually mutates the value...