Drop support for bash < 3.2.

This commit is contained in:
Ville Skyttä 2010-01-24 21:06:42 +02:00
parent bc6f14445f
commit 314cc0f13a
4 changed files with 13 additions and 41 deletions

36
README
View File

@ -12,7 +12,7 @@ if [ -f /etc/bash_completion ]; then
. /etc/bash_completion . /etc/bash_completion
fi fi
(if you happen to have *only* bash >= 3, see further if not) (if you happen to have *only* bash >= 3.2 installed, see further if not)
If you don't have the package readily available for your distribution, or If you don't have the package readily available for your distribution, or
you simply don't want to do this, put the bash_completion file somewhere you simply don't want to do this, put the bash_completion file somewhere
@ -98,36 +98,6 @@ function used by mutt completion, where the function calls itself
recursively. This seems to confuse bash and it issues spurious recursively. This seems to confuse bash and it issues spurious
warnings if 'nounset' is set. warnings if 'nounset' is set.
V.
After upgrading to bash 3.1, you may notice that completing on certain
commands now fails with a message something like this:
sed: -e expression #1, char 20: unterminated `s' command
The reason for this is that bash 3.1 contains the following,
innocent-looking bug fix (from bash's CHANGES file):
t. Fixed a bug that caused the expanded value of a $'...' string
to be incorrectly re-quoted if it occurred within a
double-quoted ${...} parameter expansion.
Unfortunately, this also had the side effect of causing single quotes
to be stripped from $'...' strings inside double-quoted command
substitutions. Confused?
Efforts have been made to work around this issue in the bash
completion code as of the 20060301 release. All previous versions are
vulnerable to the problem. However, it's possible that, even in the
20060301 release and later, affected code remains.
The issue has now been officially recognised as a regression in the
bash 3.1 release and is fixed by official patch 11. If you encounter
problems of this nature, please apply the patch below to your copy of
bash:
ftp://ftp.gnu.org/gnu/bash/bash-3.1-patches/bash31-011
FAQ FAQ
--- ---
@ -318,10 +288,10 @@ guidelines in mind:
start interpreters. Use lightweight programs such as grep(1), awk(1) start interpreters. Use lightweight programs such as grep(1), awk(1)
and sed(1). and sed(1).
- Use the full power of bash >= 3. We no longer support earlier bash - Use the full power of bash >= 3.2. We no longer support earlier bash
versions, so you may as well use all the features of that version of versions, so you may as well use all the features of that version of
bash to optimise your code. However, be careful when using features bash to optimise your code. However, be careful when using features
added since bash 3.0, since not everyone will be able to use them. Be added since bash 3.2, since not everyone will be able to use them. Be
ESPECIALLY careful of using features exclusive to 4.x, as many people ESPECIALLY careful of using features exclusive to 4.x, as many people
are still using 3.x. are still using 3.x.

4
TODO
View File

@ -2,8 +2,8 @@ bash completion needs to be rewritten from the ground up.
--------------------------------------------------------- ---------------------------------------------------------
bash completion really needs to be rewritten from the ground up, using all of bash completion really needs to be rewritten from the ground up, using all of
the features available in bash 3.1 and without regard for compatibility with the features available in bash 3.2+ and without regard for compatibility with
the 2.x line. earlier versions.
At that time, it should be split into multiple files for easier source At that time, it should be split into multiple files for easier source
management. Whether or not it is actually installed on the destination management. Whether or not it is actually installed on the destination

View File

@ -1,5 +1,5 @@
# #
# bash_completion - programmable completion functions for bash 3.x # bash_completion - programmable completion functions for bash 3.2+
# #
# Copyright © 2006-2008, Ian Macdonald <ian@caliban.org> # Copyright © 2006-2008, Ian Macdonald <ian@caliban.org>
# © 2009-2010, Bash Completion Maintainers # © 2009-2010, Bash Completion Maintainers

View File

@ -2,9 +2,11 @@
[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION" ] && return [ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION" ] && return
# Check for recent enough version of bash. # Check for recent enough version of bash.
bash=${BASH_VERSION%.*}; bmajor=${bash%.*} bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
if [ $bmajor -ge 3 -a -r @sysconfdir@/bash_completion ]; then if [ $bmajor -gt 3 ] || [ $bmajor -eq 3 -a $bminor -ge 2 ]; then
# Source completion code. if [ -r @sysconfdir@/bash_completion ]; then
. @sysconfdir@/bash_completion # Source completion code.
. @sysconfdir@/bash_completion
fi
fi fi
unset bash bmajor unset bash bmajor bminor