{"thread":{"id":"34082","subject":"[PATCH] completion: remove ancient \"ensure colon in COMP_WORDBREAKS\" workaround","startedAt":"2013-06-09T23:59:21Z","lastAt":"2013-06-10T20:48:52Z","messageCount":5,"participants":["SZEDER Gábor","Jonathan Nieder","Eric Sunshine","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"220217","messageId":"1370822361-15637-1-git-send-email-szeder@ira.uka.de","threadId":"34082","inReplyTo":null,"subject":"[PATCH] completion: remove ancient \"ensure colon in COMP_WORDBREAKS\" workaround","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2013-06-09T23:59:21Z","receivedAt":"2013-06-09T23:59:21Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Fedore 9 shipped the gvfs package with a buggy Bash completion script:\nit removed the ':' character from COMP_WORDBREAKS, thereby breaking\ncertain features of git's completion script.  We worked this around in\ndb8a9ff0 (bash completion: Resolve git show ref:path<tab> losing ref:\nportion, 2008-07-15).\n\nThe bug was fixed in Fedora 10 and Fedora 9 reached its EOL on\n2009-07-10, almost four years ago.  It's about time to remove our\nworkaround.\n\nSigned-off-by: SZEDER Gábor <szeder@ira.uka.de>\n---\n contrib/completion/git-completion.bash | 14 --------------\n 1 file changed, 14 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 91234d47..2f78dcfa 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -24,11 +24,6 @@\n #    3) Consider changing your PS1 to also show the current branch,\n #       see git-prompt.sh for details.\n \n-case \"$COMP_WORDBREAKS\" in\n-*:*) : great ;;\n-*)   COMP_WORDBREAKS=\"$COMP_WORDBREAKS:\"\n-esac\n-\n # __gitdir accepts 0 or 1 arguments (i.e., location)\n # returns location of .git repo\n __gitdir ()\n@@ -458,11 +453,6 @@ __git_complete_revlist_file ()\n \t\t\t;;\n \t\tesac\n \n-\t\tcase \"$COMP_WORDBREAKS\" in\n-\t\t*:*) : great ;;\n-\t\t*)   pfx=\"$ref:$pfx\" ;;\n-\t\tesac\n-\n \t\t__gitcomp_nl \"$(git --git-dir=\"$(__gitdir)\" ls-tree \"$ls\" 2>/dev/null \\\n \t\t\t\t| sed '/^100... blob /{\n \t\t\t\t           s,^.*\t,,\n@@ -560,10 +550,6 @@ __git_complete_remote_or_refspec ()\n \t[ \"$remote\" = \".\" ] && remote=\n \tcase \"$cur_\" in\n \t*:*)\n-\t\tcase \"$COMP_WORDBREAKS\" in\n-\t\t*:*) : great ;;\n-\t\t*)   pfx=\"${cur_%%:*}:\" ;;\n-\t\tesac\n \t\tcur_=\"${cur_#*:}\"\n \t\tlhs=0\n \t\t;;\n-- \n1.8.0.269.g97125f4\n"},{"id":"220218","messageId":"20130610000954.GA6464@elie.Belkin","threadId":"34082","inReplyTo":"1370822361-15637-1-git-send-email-szeder@ira.uka.de","subject":"Re: [PATCH] completion: remove ancient \"ensure colon in COMP_WORDBREAKS\" workaround","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-06-10T00:09:54Z","receivedAt":"2013-06-10T00:09:54Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"SZEDER Gábor wrote:\n\n> Fedore 9 shipped the gvfs package with a buggy Bash completion script:\n> it removed the ':' character from COMP_WORDBREAKS, thereby breaking\n> certain features of git's completion script.  We worked this around in\n> db8a9ff0 (bash completion: Resolve git show ref:path<tab> losing ref:\n> portion, 2008-07-15).\n>\n> The bug was fixed in Fedora 10 and Fedora 9 reached its EOL on\n> 2009-07-10, almost four years ago.  It's about time to remove our\n> workaround.\n\nNice!  I had wondered what that workaround was about but never\nended up digging into it.\n\nSearching for COMP_WORDBREAKS in /etc/bash_completion.d/* finds\nsimilar breakage (removal of '=' and '@') in the npm completion\nscript, but nothing involving colon.  So this looks like a good\nchange.\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"220229","messageId":"CAPig+cQZUa1mD0+dutNYowGbAXqEqWvfMUm-Vf+-1ap3xy3A-g@mail.gmail.com","threadId":"34082","inReplyTo":"1370822361-15637-1-git-send-email-szeder@ira.uka.de","subject":"Re: [PATCH] completion: remove ancient \"ensure colon in COMP_WORDBREAKS\" workaround","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-06-10T01:58:18Z","receivedAt":"2013-06-10T01:58:18Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jun 9, 2013 at 7:59 PM, SZEDER Gábor <szeder@ira.uka.de> wrote:\n> Fedore 9 shipped the gvfs package with a buggy Bash completion script:\n\ns/Fedore/Fedora/\n\n> it removed the ':' character from COMP_WORDBREAKS, thereby breaking\n> certain features of git's completion script.  We worked this around in\n> db8a9ff0 (bash completion: Resolve git show ref:path<tab> losing ref:\n> portion, 2008-07-15).\n>\n> The bug was fixed in Fedora 10 and Fedora 9 reached its EOL on\n> 2009-07-10, almost four years ago.  It's about time to remove our\n> workaround.\n>\n> Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>\n"},{"id":"220266","messageId":"20130610091419.GF2091@goldbirke","threadId":"34082","inReplyTo":"20130610000954.GA6464@elie.Belkin","subject":"Re: [PATCH] completion: remove ancient \"ensure colon in COMP_WORDBREAKS\" workaround","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2013-06-10T09:14:19Z","receivedAt":"2013-06-10T09:14:19Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"\nFirst things first: Junio, please don't pick up this patch.\n\nOn Sun, Jun 09, 2013 at 05:09:54PM -0700, Jonathan Nieder wrote:\n> SZEDER Gábor wrote:\n> \n> > Fedore 9 shipped the gvfs package with a buggy Bash completion script:\n> > it removed the ':' character from COMP_WORDBREAKS, thereby breaking\n> > certain features of git's completion script.  We worked this around in\n> > db8a9ff0 (bash completion: Resolve git show ref:path<tab> losing ref:\n> > portion, 2008-07-15).\n> >\n> > The bug was fixed in Fedora 10 and Fedora 9 reached its EOL on\n> > 2009-07-10, almost four years ago.  It's about time to remove our\n> > workaround.\n> \n> Nice!  I had wondered what that workaround was about but never\n> ended up digging into it.\n\nMeh, not nice at all.\n\n> Searching for COMP_WORDBREAKS in /etc/bash_completion.d/* finds\n> similar breakage (removal of '=' and '@') in the npm completion\n> script, but nothing involving colon.  So this looks like a good\n> change.\n\nAnd apparently I have a completion script called axi-cache (from\npackage apt-xapian-index) which removes ':' [1].  However, it doesn't\nremove the ':' upon loading the script but the removal is done in the\ncompletion function, i.e. it takes effect only when the user actually\nattempts to complete its options.  I never use axi-cache, whatever the\nhell it might be, so I didn't notice.\n\nUnfortunately, with my above patch applied I get this in a new shell:\n\n$ git show master:q<TAB>\n$ git show master:quote.<TAB>\nmaster:quote.c   master:quote.h   \n\n$ axi-cache <TAB>\nagain     depends   help      madison   more      policy    rdepends\nsearch    show      showpkg   showsrc   \n\n$ git show master:q<TAB>\n$ git show quote.<TAB>\nquote.c  quote.h  quote.o\n\nNot good.\n\nI don't have the npm package, but manually removing '=' from\nCOMP_WORDBREAKS leads to similar breakage with e.g. 'git log\n--pretty='.\n\nNeither this axi-cache not npm completion script comes from the\nbash-completion project.  Apparently some developers providing\ncompletion scripts for their projects lack the necessary expertise to\nconsider the effects their script might have on other completion\nscripts.  Perhaps distributions should adopt a policy not to allow\ncompletion scripts messing with COMP_WORDBREAKS, dunno.\n\nAnyway.  Although the completion script in Fedora's gvfs package might\nbe fixed, there are other completion scripts making the same mistake,\nso I'm afraid we should keep the workaround and drop this patch.\nMoreover, we should even consider extending our workaround by adding\nback '=' to COMP_WORDBREAKS, too.  Oh, well.\n\n\n[1] - This might not be accurate nowadays, as my system is a bit\noldish...\n\n\nBest,\nGábor\n"},{"id":"220374","messageId":"7vhah5g097.fsf@alter.siamese.dyndns.org","threadId":"34082","inReplyTo":"20130610091419.GF2091@goldbirke","subject":"Re: [PATCH] completion: remove ancient \"ensure colon in COMP_WORDBREAKS\" workaround","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-10T20:48:52Z","receivedAt":"2013-06-10T20:48:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder@ira.uka.de> writes:\n\n> Anyway.  Although the completion script in Fedora's gvfs package might\n> be fixed, there are other completion scripts making the same mistake,\n> so I'm afraid we should keep the workaround and drop this patch.\n> Moreover, we should even consider extending our workaround by adding\n> back '=' to COMP_WORDBREAKS, too.  Oh, well.\n\nThanks.\n\nPerhaps the summary of your problem analysis deserves to be added as\na in-code comment to make sure others won't later try to remove it\nonly by checking how old Fedora 9 is?\n"}]}