[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.90-140-gd7a6fb1

Ville Skyttä ville.skytta at iki.fi
Wed Jan 18 21:44:23 UTC 2012


The following commit has been merged in the master branch:
commit 6f3d650e2309feff4f3e80717409ebccb2d38362
Author: guns <self at sungpae.com>
Date:   Wed Jan 11 04:10:27 2012 -0600

    Workaround bash bug that fails to complete <, >
    
    There is a bug in bash that causes completions of some of the
    redirection operators to fail if a default completion function is
    defined.
    
    The details are in the following bug-bash mailing list message, but put
    simply, when completing a command line "> ", bash mistakenly searches
    the completions table for an empty string, and failing that, sends
    the default completion function not an empty string, but the actual
    redirection operator '>' as the first argument.
    
    http://lists.gnu.org/archive/html/bug-bash/2012-01/msg00045.html
    
    This is quite simply worked around for the moment by defining the
    _minimal completion for the empty string. This allows filename
    completion for people who like to:
    
        $ > cats.txt        # Truncate files quickly
        $ >> cats.txt       # Use redirection as a quick 'touch'
        $ < cats.txt cat    # Use redirection at the beginning of the
                            # command line
    
    Given the slow bash upgrade cycle for various operating systems, a
    workaround for this issue will be necessary for a long time.

diff --git a/bash_completion b/bash_completion
index 6886f44..b9585ac 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1911,6 +1911,10 @@ _minimal()
     $split && return
     _filedir
 }
+# Complete the empty string to allow completion of '>', '>>', and '<'
+# http://lists.gnu.org/archive/html/bug-bash/2012-01/msg00045.html
+complete -F _minimal ''
+
 
 # set up dynamic completion loading
 _completion_loader()

-- 
bash-completion



More information about the Bash-completion-commits mailing list