From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4271 invoked by alias); 28 Jan 2012 16:56:45 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30135 Received: (qmail 5179 invoked from network); 28 Jan 2012 16:56:32 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.215.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=1anRgt4XsTW7Zf98o6JFvZB2WXwGXOCXL+KytWaLvKQ=; b=VBv2Gpo6M2KSCKebuVUhUaewea542A2IXb22iotAa/t6Kf4Vi0HFYqTTRa9UpS+CG+ 6WasK8T4oV2uHysuv4+vDlFev4ZSgKZzvnEpPzIwCv+vn6NxuwbZHv1G5tEfrEqpvFZb ExDCOK6BOTCx/5Mg6lba8N/2d1oeZDRCA80VI= From: Felipe Contreras To: zsh-workers@zsh.org Cc: Felipe Contreras Subject: [PATCH 0/5] bashcompinit: several fixes Date: Sat, 28 Jan 2012 18:55:46 +0200 Message-Id: <1327769751-6806-1-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.7.8.3 Hi, While trying to resolve the issue I reported before[1], I stumbled upon many problems in the current code, here are a bunch of patches that should address all the issues I found. I used the following test script to verify my changes, and now all the tests pass, just like in bash :) --- #!/bin/sh if [[ -n ${ZSH_VERSION-} ]]; then autoload -U +X bashcompinit && bashcompinit fi cwords[1]='first ' cwords[2]='second and space ' cwords[3]='third\\ quoted\\ space ' cwords[4]='fourth\\ quoted\\ space plus' unescape() { printf "%b" "$1" } prepare() { local IFS=$'\n' echo "== prepare ==" mkdir -p tmp for e in "${cwords[@]}" do u=$(unescape "$e") touch "tmp/$u" done } compare() { test "$1" != "$2" && echo -e "error: '$1' != '$2'" && return -1 || return 0 } _foo() { local IFS=$'\n' COMPREPLY=( $(compgen -W "${cwords[*]}" -- "$2") ) } test_3() { local fail echo "== test 3 ==" pushd "tmp" for e in "${cwords[@]}" do compare "$(compgen -o filenames -f -- ${e:0:2})" "$(unescape "$e")" || fail=true done popd test $fail || echo "OK" } test_2() { local fail echo "== test 2 ==" for e in "${cwords[@]}" do compare "$(compgen -F _foo -- ${e:0:2})" "$(unescape "$e")" || fail=true done test $fail || echo "OK" } test_1() { local IFS=$'\n' local fail echo "== test 1 ==" for e in "${cwords[@]}" do compare "$(compgen -W "${cwords[*]}" -- ${e:0:2})" "$(unescape "$e")" || fail=true done test $fail || echo "OK" } prepare test_1 test_2 test_3 --- [1] http://article.gmane.org/gmane.comp.shells.zsh.devel/24279 Felipe Contreras (5): bashcompinit: remove _compgen_opt_words bashcompinit: fix COMP_POINT bashcompinit: fix quoting code bashcompinit: simplify result matching code bashcompinit: improve compgen -F argument passing Completion/bashcompinit | 28 +++++++++++----------------- 1 files changed, 11 insertions(+), 17 deletions(-) -- 1.7.8.3