editor paths containing spaces are not parsed correctly

Bug #220331 reported by Tom X. Tobin
0
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Martin Pool

Bug Description

In bzr's commit message editor support, editor paths containing spaces are incorrectly parsed; there is no way to work around this (e.g., by escaping spaces with backslashes).

This behavior is due to bzrlib.msgeditor._run_editor() performing a naive .split(' ') rather than correctly parsing the editor path.

(Discovered in bzr 1.4rc2)

Tags: editor trivial

Related branches

Tom X. Tobin (tomxtobin)
description: updated
description: updated
Revision history for this message
John A Meinel (jameinel) wrote :

Seems like we could use "shlex.split()" or something else that would let you quote the path with spaces.

We need to *allow* for arguments, because sometimes you have to run the editor with flags. (For example, you need to run 'gvim -f' so that it doesn't disconnect from the calling process, so we know when you are finished editing.)

Changed in bzr:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Tom X. Tobin (tomxtobin) wrote :

shlex is likely the wrong solution; it's quite old (introduced in 1.5.2) and doesn't understand Unicode. If I knew what should be supported (e.g., backslash escapes of spaces, quotation mark quoting), I'd be happy to whip something up.

Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 220331] Re: editor paths containing spaces are not parsed correctly

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tom Tobin wrote:
> shlex is likely the wrong solution; it's quite old (introduced in 1.5.2)
> and doesn't understand Unicode.

Yes, but we've already worked around that. See
bzrlib.commands.shlex_split_unicode

Consistency is a virtue, so we should use the same mechanism for
splitting commandlines everywhere we can.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIDgE40F+nu1YWqI0RAiWWAJ4j/2U+UHiJhsA/RmlFIihZ/MJtwgCfRd0g
7mKqjzwZeGjV5R+fC70nE1g=
=to1M
-----END PGP SIGNATURE-----

Revision history for this message
Tom X. Tobin (tomxtobin) wrote :

Argh! You developers and your time machines! :-)

You're absolutely right regarding consistency; if no one beats me to it, I'll try to come up with a fix using shlex_split_unicode.

Tom X. Tobin (tomxtobin)
Changed in bzr:
assignee: nobody → korpios
status: Triaged → In Progress
Revision history for this message
Tomasz Magulski (magul) wrote :

Hi,

I have a question, what can we do with this bug for now, because I have check actual code and the function, that the Aaron Bentley have written, is deprecated from version 2.2?

Martin Pool (mbp)
Changed in bzr:
assignee: Tom X. Tobin (tomxtobin) → Martin Pool (mbp)
Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 2.4b1
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.