[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnulib-tool: possible bug in detection of a working `echo' command
From: |
Bruno Haible |
Subject: |
Re: gnulib-tool: possible bug in detection of a working `echo' command |
Date: |
Mon, 31 Aug 2009 23:06:22 +0200 |
User-agent: |
KMail/1.9.9 |
Hi Stefano,
> The bug is in this command:
> $CONFIG_SHELL -c 'echo '\t' | grep t > /dev/null'
> which should check if $CONFIG_SHELL (when set) has a usable `echo'
> command. But the way it's written, that test *always* succeds,
> even if $CONFIG_SHELL has a broken `echo' builtin. This is caused
> by the fact that the `\t' in there is *not* quoted (even if at a first
> glace it might seem to be), and thus the backslash is removed by the
> shell *before* running $CONFIG_SHELL, which then run a test like:
> echo t | grep t > /dev/null
> which of course succeds.
>
> To properly check the `echo' builtin of $CONFIG_SHELL, the command
> should be rewritten as e.g.:
> $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"
You're entirely right. I've applied your fix as follows. (The "tiny change"
phrase in the ChangeLog entry should not upset you: it merely means that we
don't need a formal copyright assignment for this change.) Thanks!
2009-08-31 Stefano Lattarini <address@hidden> (tiny change)
* gnulib-tool: Fix test whether $CONFIG_SHELL has a working 'echo'
command.
--- gnulib-tool.orig 2009-08-31 23:01:16.000000000 +0200
+++ gnulib-tool 2009-08-31 22:57:06.000000000 +0200
@@ -703,7 +703,7 @@
&& test "X$1" != "X--no-reexec" \
&& test -n "$CONFIG_SHELL" \
&& test -f "$CONFIG_SHELL" \
- && $CONFIG_SHELL -c 'echo '\t' | grep t > /dev/null'; then
+ && $CONFIG_SHELL -c "echo '\\t' | grep t > /dev/null"; then
exec $CONFIG_SHELL "$0" --no-reexec "$@"
exit 127
fi