Patchwork [2,of,8,V2] bash_completion: turn off custom debuggers

login
register
mail settings
Submitter Sean Farley
Date Nov. 22, 2013, 8:26 p.m.
Message ID <4870c6bcf56d3b86fd74.1385151962@laptop.local>
Download mbox | patch
Permalink /patch/3093/
State Superseded
Headers show

Comments

Sean Farley - Nov. 22, 2013, 8:26 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1385072985 18000
#      Thu Nov 21 17:29:45 2013 -0500
# Node ID 4870c6bcf56d3b86fd7456b7075cfd0ba86212b9
# Parent  4d30dc9b20a68e8b443da7ebbfa79ea2ea2e5825
bash_completion: turn off custom debuggers

Previously, a user could have set ui.debugger=ipdb which forces a control
(non-printable) character to be prepended to all hg output. This would confuse
compgen enough to not match the first word in a list becuase it thinks
\033[?1034h is the first part of the string of the first word. Therefore, we
force ui.debugger to be unset when calling hg in a subprocess.
Sean Farley - Nov. 25, 2013, 1:03 p.m.
kbullock+mercurial@ringworld.org writes:

> On 22 Nov 2013, at 2:26 PM, Sean Farley <sean.michael.farley@gmail.com> wrote:
>
>> # HG changeset patch
>> # User Sean Farley <sean.michael.farley@gmail.com>
>> # Date 1385072985 18000
>> #      Thu Nov 21 17:29:45 2013 -0500
>> # Node ID 4870c6bcf56d3b86fd7456b7075cfd0ba86212b9
>> # Parent  4d30dc9b20a68e8b443da7ebbfa79ea2ea2e5825
>> bash_completion: turn off custom debuggers
>> 
>> Previously, a user could have set ui.debugger=ipdb which forces a control
>> (non-printable) character to be prepended to all hg output. This would confuse
>> compgen enough to not match the first word in a list becuase it thinks
>> \033[?1034h is the first part of the string of the first word. Therefore, we
>> force ui.debugger to be unset when calling hg in a subprocess.
>> 
>> diff --git a/contrib/bash_completion b/contrib/bash_completion
>> --- a/contrib/bash_completion
>> +++ b/contrib/bash_completion
>> @@ -54,11 +54,11 @@
>> 
>> shopt -s extglob
>> 
>> _hg_cmd()
>> {
>> -    HGPLAIN=1 "$hg" "$@" 2>/dev/null
>> +    HGPLAIN=1 "$hg" --config ui.debugger= "$@" 2>/dev/null
>
> How about making HGPLAIN disable custom debuggers instead?

Yeah, that makes more sense.

Patch

diff --git a/contrib/bash_completion b/contrib/bash_completion
--- a/contrib/bash_completion
+++ b/contrib/bash_completion
@@ -54,11 +54,11 @@ 
 
 shopt -s extglob
 
 _hg_cmd()
 {
-    HGPLAIN=1 "$hg" "$@" 2>/dev/null
+    HGPLAIN=1 "$hg" --config ui.debugger= "$@" 2>/dev/null
 }
 
 _hg_commands()
 {
     local commands