tab completion broken by string.whitespace

Bug #285470 reported by Glen Mailer
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
BzrTools
New
Undecided
Unassigned

Bug Description

When using the tab-completion provided by bzrtools' "shell" command, string.whitespace somehow includes the character \xa0 - the non-breaking space.

As this character is outside of the ascii range, any attempt at tab completion causes pyreadline to throw a UnicodeDecodeError.

I have managed to trace this to the delimiter setting in shell.py - the fix would be to use "\t\n\x0b\x0c\r " instead of string.whitespace when setting the delims.

Tags: windows
Revision history for this message
pdf23ds (pdf23ds) wrote :

Please fix this! (Is it enough to vote on a bug to mark the "this affects me" flag? Does anyone see that?)

Revision history for this message
Aaron Bentley (abentley) wrote :

"This affects me" is sufficient.

I can't reproduce the problem here, even doing
$ LANG="C" bzr shell

What's your terminal encoding and python version? On Python 2.5, string.whitespace is '\t\n\x0b\x0c\r '

Revision history for this message
Glen Mailer (glenjamin) wrote :

I'm running windows Vista x64, terminal encoding is 'cp850' for both stdin and stdout. Using python 2.5.2.

If I just run python from the command line then string.whitespace is '\t\n\x0b\x0c\r '

However when debugging the stack trace I was getting whenever I tried to use tab completion I discovered that string.whitespace contained the non-breaking space.

For a slightly more elegant solution that manually setting the delimiters, you could just do a string replace to remove the non-breaking space - which obviously would just have no effect if the character isn't already there.

Revision history for this message
pdf23ds (pdf23ds) wrote :

I'm running XP SP2. Dunno what the terminal encoding is, I'm running from the windows console, using the python built into bazaar 1.8rc1. I made Glen's first suggested patch and it fixed the problem for me.

Revision history for this message
Kirill Müller (krlmlr) wrote :

I'd like to confirm this bug. The fix works for me.

Revision history for this message
Glen Mailer (glenjamin) wrote :

I would like to mention that this bug is still reproducible using python 2.5.4, bzr 1.13 (still on Vista x64).

As this has been confirmed by a few people on windows, is there any chance of a fix being included soon? (and would it be useful for me to knock out a patch to attach here?)

Jelmer Vernooij (jelmer)
tags: added: windows
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.