delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=2.6 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,LONGWORDS,RCVD_IN_DNSWL_NONE,TW_CX,TW_KX,TW_RG,TW_SX,TW_VC,TW_VW,TW_YG,T_RP_MATCHES_RCVD |
X-Spam-Check-By: | sourceware.org |
From: | "Andy Hall" <fixpertise-consulting AT comcast DOT net> |
To: | <cygwin AT cygwin DOT com> |
Subject: | File name completion broken in 1.7.7? |
Date: | Fri, 5 Nov 2010 10:13:32 -0700 |
Message-ID: | <77C3D8678FF44B69AE06DD6975C7CEAA@ahallpc> |
MIME-Version: | 1.0 |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
I have recently upgraded to 1.7.7 from 1.5.X. In 1.5.X, it used to be that in bash I could type lines like P4 edit hydra_c and hit the tab key to complete the file name. A command like p4 edit hydra_config would be then executed. In 1.7.7, when I type P4 edit hydra_c and hit the tab key to complete the file name, I get the text "bash: _get_comp_words_by_ref(): `preprev': unknown argument" followed by the missing part of the filename. The command completes successfully as below: ahall AT ahall-pc /cygdrive/c/konaware/builder $ p4 edit hydra_cbash: _get_comp_words_by_ref(): `preprev': unknown argument onfig //konaware/builder/hydra_config#6 - opened for edit Now I do not get this behavior on other commands when I use filename completion. It turns out that my p4 command is an alias that converts the current working directory to a windows path name which is added to the real p4 command as an option as below: ahall AT ahall-pc /cygdrive/c/konaware/builder $ alias p4 alias p4='p4 -d "`cygpath -w \"$PWD\"`"' So I set the -x option and ran the command again. ahall AT ahall-pc /cygdrive/c/konaware/builder $ set -x Wierdly, bash seems to run all sorts or stuff including p4 commands that have nothing to do with the command I wanted executed. It does finally get around to executing the correct command. See the last 2 lines below. ahall AT ahall-pc /cygdrive/c/konaware/builder $ p4 edit hydra_c+ local cur prev preprev p4commands p4filetypes + COMPREPLY=() + _get_comp_words_by_ref cur prev preprev + local exclude flag i OPTIND=1 + words=() + local cur cword words + upargs=() + upvars=() + local upargs upvars vcur vcword vprev vwords + getopts c:i:n:p:w: flag cur prev preprev + [[ 3 -ge 1 ]] + case ${!OPTIND} in + vcur=cur + let 'OPTIND += 1' + [[ 3 -ge 2 ]] + case ${!OPTIND} in + vprev=prev + let 'OPTIND += 1' + [[ 3 -ge 3 ]] + case ${!OPTIND} in + echo 'bash: _get_comp_words_by_ref(): `preprev'\'': unknown argument' bash: _get_comp_words_by_ref(): `preprev': unknown argument + return 1 ++ awk 'NF>3 {print $1}' +++ cygpath -w /cygdrive/c/konaware/builder ++ p4 -d 'C:\konaware\builder' help commands + p4commands='add admin branch branches change changes client clients counter counters delete depot depots describe diff diff2 dirs edit filelog files fix fixes flush fstat group groups have help info integrate integrated job jobs jobspec label labels labelsync lock obliterate opened passwd print protect rename reopen resolve resolved revert review reviews set submit sync triggers unlock user users verify where' + p4filetypes='ctext cxtext ktext kxtext ltext tempobj ubinary uresource uxbinary xbinary xltext xtempobj xtext text binary resource' + '[' 2 -eq 1 ']' + '[' 2 -eq 2 ']' + case $prev in + return 0 onfig ++ cygpath -w /cygdrive/c/konaware/builder + p4 -d 'C:\konaware\builder' edit hydra_config //konaware/builder/hydra_config#6 - currently opened for edit If I don't use file name completion, everything progresses normally! $ p4 edit hydra_config ++ cygpath -w /cygdrive/c/konaware/builder + p4 -d 'C:\konaware\builder' edit hydra_config //konaware/builder/hydra_config#6 - currently opened for edit If I run a command that does not involve an alias, such as vi hydra_c and hit the tab key to complete the file name, hydra_config, I get a completely different but presumably correct result. ahall AT ahall-pc /cygdrive/c/konaware/builder $ vi hydra_c+ local IFS cur xspec + IFS=' ' + COMPREPLY=() + _get_comp_words_by_ref cur + local exclude flag i OPTIND=1 + words=() + local cur cword words + upargs=() + upvars=() + local upargs upvars vcur vcword vprev vwords + getopts c:i:n:p:w: flag cur + [[ 1 -ge 1 ]] + case ${!OPTIND} in + vcur=cur + let 'OPTIND += 1' + [[ 1 -ge 2 ]] + __get_cword_at_cursor_by_ref '' words cword cur + words=() + local cword words + __reassemble_comp_words_by_ref '' words cword + local exclude i j ref + [[ -n '' ]] + eval cword=1 ++ cword=1 + [[ -n '' ]] + eval 'words=(' '"${COMP_WORDS[@]}"' ')' ++ words=("${COMP_WORDS[@]}") + local i cur2 + local 'cur=vi hydra_c' + local index=10 + (( i = 0 )) + (( i <= cword )) + [[ 10 -ge 2 ]] + [[ vi != \v\i ]] + [[ 0 -lt 1 ]] + local old_size=10 + cur=' hydra_c' + local new_size=8 + index=8 + (( ++i )) + (( i <= cword )) + [[ 8 -ge 7 ]] + [[ hydra_ != \h\y\d\r\a\_\c ]] + cur=hydra_c + (( index-- )) + [[ 7 -ge 7 ]] + [[ hydra_c != \h\y\d\r\a\_\c ]] + [[ 1 -lt 1 ]] + (( ++i )) + (( i <= cword )) + [[ hydra_c != \h\y\d\r\a\_\c ]] + cur2=hydra_c + local words cword cur + _upvars -a2 words vi hydra_c -v cword 1 -v cur hydra_c + (( 10 )) + (( 10 )) + case $1 in + [[ -n 2 ]] + printf %d 2 + [[ -n words ]] + unset -v words + eval 'words=("${@:3:2}")' ++ words=("${@:3:2}") + shift 4 + (( 6 )) + case $1 in + [[ -n cword ]] + unset -v cword + eval 'cword="$3"' ++ cword=1 + shift 3 + (( 3 )) + case $1 in + [[ -n cur ]] + unset -v cur + eval 'cur="$3"' ++ cur=hydra_c + shift 3 + (( 0 )) + [[ -n cur ]] + upvars+=("$vcur") + upargs+=(-v $vcur "$cur") + [[ -n '' ]] + [[ -n '' ]] + [[ -n '' ]] + (( 1 )) + local cur + _upvars -v cur hydra_c + (( 3 )) + (( 3 )) + case $1 in + [[ -n cur ]] + unset -v cur + eval 'cur="$3"' ++ cur=hydra_c + shift 3 + (( 0 )) + _expand + [[ hydra_c == \~*/* ]] + [[ hydra_c == \~* ]] ++ awk '/^complete[ \t]+.*[ \t]vi([ \t]|$)/ { print $0; exit }' /etc/bash_completion + xspec='complete -f -X '\''*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|av i|AVI|asf|ASF|ogg|OG G|class|CLASS)'\'' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite' + xspec=''\''*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g |MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' \'' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite' + xspec=''\''*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g |MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' \''' + local -a toks + local tmp + toks=(${toks[@]-} $( compgen -d -- "$(quote_readline "$cur")" | { while read -r tmp; do # see long TODO comment in _filedir() --David printf '%s\n' $tmp done } )) ++ read -r tmp +++ quote_readline hydra_c +++ local quoted +++ _quote_readline_by_ref hydra_c ret +++ [[ h == \' ]] +++ [[ 3 -le 3 ]] +++ [[ h == \" ]] +++ printf -v ret %q hydra_c +++ [[ h == \$ ]] +++ printf %s hydra_c ++ compgen -d -- hydra_c + toks=(${toks[@]-} $( eval compgen -f -X "$xspec" -- "\$(quote_readline "\$cur")" | { while read -r tmp; do [ -n $tmp ] && printf '%s\n' $tmp done } )) ++ eval compgen -f -X ''\''*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|a vi|AVI|asf|ASF|ogg|OGG |class|CLASS)'\''' -- '$(quote_readline $cur)' ++ read -r tmp ++++ quote_readline hydra_c ++++ local quoted ++++ _quote_readline_by_ref hydra_c ret ++++ [[ h == \' ]] ++++ [[ 3 -le 3 ]] ++++ [[ h == \" ]] ++++ printf -v ret %q hydra_c ++++ [[ h == \$ ]] ++++ printf %s hydra_c +++ compgen -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|A VI|asf|ASF|ogg|OGG|class|C LASS)' -- hydra_c ++ '[' -n hydra_config ']' ++ printf '%s\n' hydra_config ++ read -r tmp + COMPREPLY=("${toks[@]}") onfig -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |