Re: [PATCH] completion: remove ancient ensure colon in COMP_WORDBREAKS workaround

2013-06-10 Thread SZEDER Gábor

First things first: Junio, please don't pick up this patch.

On Sun, Jun 09, 2013 at 05:09:54PM -0700, Jonathan Nieder wrote:
 SZEDER Gábor wrote:
 
  Fedore 9 shipped the gvfs package with a buggy Bash completion script:
  it removed the ':' character from COMP_WORDBREAKS, thereby breaking
  certain features of git's completion script.  We worked this around in
  db8a9ff0 (bash completion: Resolve git show ref:pathtab losing ref:
  portion, 2008-07-15).
 
  The bug was fixed in Fedora 10 and Fedora 9 reached its EOL on
  2009-07-10, almost four years ago.  It's about time to remove our
  workaround.
 
 Nice!  I had wondered what that workaround was about but never
 ended up digging into it.

Meh, not nice at all.

 Searching for COMP_WORDBREAKS in /etc/bash_completion.d/* finds
 similar breakage (removal of '=' and '@') in the npm completion
 script, but nothing involving colon.  So this looks like a good
 change.

And apparently I have a completion script called axi-cache (from
package apt-xapian-index) which removes ':' [1].  However, it doesn't
remove the ':' upon loading the script but the removal is done in the
completion function, i.e. it takes effect only when the user actually
attempts to complete its options.  I never use axi-cache, whatever the
hell it might be, so I didn't notice.

Unfortunately, with my above patch applied I get this in a new shell:

$ git show master:qTAB
$ git show master:quote.TAB
master:quote.c   master:quote.h   

$ axi-cache TAB
again depends   help  madison   more  policyrdepends
searchshow  showpkg   showsrc   

$ git show master:qTAB
$ git show quote.TAB
quote.c  quote.h  quote.o

Not good.

I don't have the npm package, but manually removing '=' from
COMP_WORDBREAKS leads to similar breakage with e.g. 'git log
--pretty='.

Neither this axi-cache not npm completion script comes from the
bash-completion project.  Apparently some developers providing
completion scripts for their projects lack the necessary expertise to
consider the effects their script might have on other completion
scripts.  Perhaps distributions should adopt a policy not to allow
completion scripts messing with COMP_WORDBREAKS, dunno.

Anyway.  Although the completion script in Fedora's gvfs package might
be fixed, there are other completion scripts making the same mistake,
so I'm afraid we should keep the workaround and drop this patch.
Moreover, we should even consider extending our workaround by adding
back '=' to COMP_WORDBREAKS, too.  Oh, well.


[1] - This might not be accurate nowadays, as my system is a bit
oldish...


Best,
Gábor

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] completion: remove ancient ensure colon in COMP_WORDBREAKS workaround

2013-06-09 Thread SZEDER Gábor
Fedore 9 shipped the gvfs package with a buggy Bash completion script:
it removed the ':' character from COMP_WORDBREAKS, thereby breaking
certain features of git's completion script.  We worked this around in
db8a9ff0 (bash completion: Resolve git show ref:pathtab losing ref:
portion, 2008-07-15).

The bug was fixed in Fedora 10 and Fedora 9 reached its EOL on
2009-07-10, almost four years ago.  It's about time to remove our
workaround.

Signed-off-by: SZEDER Gábor sze...@ira.uka.de
---
 contrib/completion/git-completion.bash | 14 --
 1 file changed, 14 deletions(-)

diff --git a/contrib/completion/git-completion.bash 
b/contrib/completion/git-completion.bash
index 91234d47..2f78dcfa 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -24,11 +24,6 @@
 #3) Consider changing your PS1 to also show the current branch,
 #   see git-prompt.sh for details.
 
-case $COMP_WORDBREAKS in
-*:*) : great ;;
-*)   COMP_WORDBREAKS=$COMP_WORDBREAKS:
-esac
-
 # __gitdir accepts 0 or 1 arguments (i.e., location)
 # returns location of .git repo
 __gitdir ()
@@ -458,11 +453,6 @@ __git_complete_revlist_file ()
;;
esac
 
-   case $COMP_WORDBREAKS in
-   *:*) : great ;;
-   *)   pfx=$ref:$pfx ;;
-   esac
-
__gitcomp_nl $(git --git-dir=$(__gitdir) ls-tree $ls 
2/dev/null \
| sed '/^100... blob /{
   s,^.*,,
@@ -560,10 +550,6 @@ __git_complete_remote_or_refspec ()
[ $remote = . ]  remote=
case $cur_ in
*:*)
-   case $COMP_WORDBREAKS in
-   *:*) : great ;;
-   *)   pfx=${cur_%%:*}: ;;
-   esac
cur_=${cur_#*:}
lhs=0
;;
-- 
1.8.0.269.g97125f4

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] completion: remove ancient ensure colon in COMP_WORDBREAKS workaround

2013-06-09 Thread Jonathan Nieder
SZEDER Gábor wrote:

 Fedore 9 shipped the gvfs package with a buggy Bash completion script:
 it removed the ':' character from COMP_WORDBREAKS, thereby breaking
 certain features of git's completion script.  We worked this around in
 db8a9ff0 (bash completion: Resolve git show ref:pathtab losing ref:
 portion, 2008-07-15).

 The bug was fixed in Fedora 10 and Fedora 9 reached its EOL on
 2009-07-10, almost four years ago.  It's about time to remove our
 workaround.

Nice!  I had wondered what that workaround was about but never
ended up digging into it.

Searching for COMP_WORDBREAKS in /etc/bash_completion.d/* finds
similar breakage (removal of '=' and '@') in the npm completion
script, but nothing involving colon.  So this looks like a good
change.

Reviewed-by: Jonathan Nieder jrnie...@gmail.com
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] completion: remove ancient ensure colon in COMP_WORDBREAKS workaround

2013-06-09 Thread Eric Sunshine
On Sun, Jun 9, 2013 at 7:59 PM, SZEDER Gábor sze...@ira.uka.de wrote:
 Fedore 9 shipped the gvfs package with a buggy Bash completion script:

s/Fedore/Fedora/

 it removed the ':' character from COMP_WORDBREAKS, thereby breaking
 certain features of git's completion script.  We worked this around in
 db8a9ff0 (bash completion: Resolve git show ref:pathtab losing ref:
 portion, 2008-07-15).

 The bug was fixed in Fedora 10 and Fedora 9 reached its EOL on
 2009-07-10, almost four years ago.  It's about time to remove our
 workaround.

 Signed-off-by: SZEDER Gábor sze...@ira.uka.de
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html