The difference in known_hosts() function actually comes from a
side effect of an intentional change to bash. A quoting change that
first appeared in bash-3.1-beta1 has caused a new problem with quoting.
The description for the change was-
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.
The 'fix' in bash-3.1/bash/parse.y checks for double quoting and
suppresses requoting of $'' single quotes.
if ((rflags & P_DQUOTE) == 0)
{
nestret = sh_single_quote (ttrans);
free (ttrans);
nestlen = strlen (nestret);
}
else
{
nestret = ttrans;
nestlen = ttranslen;
}
But that test is fooled when double quoting is used around command
substitution. The single quotes are dropped even though the string
will be evaluated first by the command substitution inside of the double
quotes. That breaks the _known_hosts() function for command completion
code in debian's /etc/bash_completion. The loss of quoting breaks up
input to sed that was intended to be a single argument.
Here is an example showing first the intended change and
then the unintended change.
$ cat quote_bugs
function args
for a in "$@";do echo "'$a'";done
unset mytab
echo "${mytab:-$'\t'}" | od -c
echo "$( args $'A\tB' )"
$ bash_source/bash-3.0/build-bash/bash -v quote_bugs
function args
for a in "$@";do echo "'$a'";done
unset mytab
echo "${mytab:-$'\t'}" | od -c
0000000 ' \t ' \n
0000004
echo "$( args $'A\tB' )"
args 'A B'
'A B'
$ bash_source/bash-3.1/build-bash/bash -v quote_bugs
function args
for a in "$@";do echo "'$a'";done
unset mytab
echo "${mytab:-$'\t'}" | od -c
0000000 \t \n
0000002
echo "$( args $'A\tB' )"
args A B
'A'
'B'
$
The problem can be avoided by removing the P_DQUOTE bit from
rflags when calling parse_matched_pair for $() expansion.
Here is a patch.
--- bash/parse.y~ 2006-01-07 16:11:12.000000000 -0700
+++ bash/parse.y 2006-01-07 16:12:40.000000000 -0700
@@ -2906,8 +2906,8 @@
{
if (open == ch) /* undo previous increment */
count--;
- if (ch == '(') /* ) */
- nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags);
+ if (ch == '(') /* ) */ /* disable P_DQUOTE for $() */
+ nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags &
~P_DQUOTE);
else if (ch == '{') /* } */
nestret = parse_matched_pair (0, '{', '}', &nestlen,
P_FIRSTCLOSE|rflags);
else if (ch == '[') /* ] */
Unfortunately, the debian/rules file has a problem with patching
parse.y. The newer date on the patched parse.y causes the make in
each of the build-* directories to create a new y.tab.c and y.tab.h.
A later install operation tries to install *.h from multiple directories.
Install then finds a y.tab.h file in two different source directories.
That causes debuild to fail. Changing the debian/rules file to install
from one directory at a time avoids the error. Here is a patch for that.
With this patch the newer build-bash/y.tab.h is installed over the top
of the older bash/y.tab.h.
--- bash-3.1/debian/rules 2006-01-08 17:53:26.000000000 -0700
+++ bash-3.1-fix/debian/rules 2006-01-08 17:56:48.000000000 -0700
@@ -272,8 +272,9 @@
scripts/bcsh.sh scripts/krand.bash
: # files for the bash-builtins package
- $(ID) bash/include/*.h bash/*.h build-bash/*.h \
- $(d_bins)/usr/include/bash/
+ $(ID) bash/include/*.h $(d_bins)/usr/include/bash/
+ $(ID) bash/*.h $(d_bins)/usr/include/bash/
+ $(ID) build-bash/*.h $(d_bins)/usr/include/bash/
$(ID) bash/builtins/*.h $(d_bins)/usr/include/bash/builtins/
$(ID) bash/lib/glob/*.h $(d_bins)/usr/include/bash/lib/glob/
$(ID) bash/lib/tilde/*.h $(d_bins)/usr/include/bash/lib/tilde/
--
Mike Stroyan, [EMAIL PROTECTED]
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]