Re: [PATCH] test-lib.sh: use printf instead of echo

2014-03-20 Thread Junio C Hamano
Jonathan Nieder writes: > Junio C Hamano wrote: > ... >> I am a bit reluctant to name the helper "sane_echo" to declare "echo >> that interprets backslashes in the string is insane", though. For >> these "print a single line" uses, we are only interested in using a >> subset of the features offe

Re: [PATCH] test-lib.sh: use printf instead of echo

2014-03-19 Thread Jonathan Nieder
Junio C Hamano wrote: > Jonathan Nieder writes: >> We currently use "echo" all over the place (e.g., 'echo "$path"' in >> git-sh-setup), and every time we fix it there is a chance of making >> mistakes. I wonder if it would make sense to add a helper to make the >> echo calls easier to replace:

Re: [PATCH] test-lib.sh: use printf instead of echo

2014-03-19 Thread Junio C Hamano
David Kastrup writes: > Junio C Hamano writes: > >> Jonathan Nieder writes: >> >>> Junio C Hamano wrote: > Uwe Storbeck wrote: >>> >> +printf '%s\n' "$@" | sed -e 's/^/# /' This is wrong, isn't it? Why do we want one line per item here? >>> >>> Yes, Hannes caught

Re: [PATCH] test-lib.sh: use printf instead of echo

2014-03-19 Thread Junio C Hamano
Jonathan Nieder writes: > Junio C Hamano wrote: >>> Uwe Storbeck wrote: > + printf '%s\n' "$@" | sed -e 's/^/# /' >> >> This is wrong, isn't it? Why do we want one line per item here? > > Yes, Hannes caught the same, too. Sorry for the sloppiness. > > We currently use "echo" all over

Re: [PATCH] test-lib.sh: use printf instead of echo

2014-03-19 Thread David Kastrup
Junio C Hamano writes: > Jonathan Nieder writes: > >> Junio C Hamano wrote: Uwe Storbeck wrote: >> > + printf '%s\n' "$@" | sed -e 's/^/# /' >>> >>> This is wrong, isn't it? Why do we want one line per item here? >> >> Yes, Hannes caught the same, too. Sorry for the sloppiness. >

Re: [PATCH] test-lib.sh: use printf instead of echo

2014-03-18 Thread Jonathan Nieder
Junio C Hamano wrote: >> Uwe Storbeck wrote: >>> + printf '%s\n' "$@" | sed -e 's/^/# /' > > This is wrong, isn't it? Why do we want one line per item here? Yes, Hannes caught the same, too. Sorry for the sloppiness. We currently use "echo" all over the place (e.g., 'echo "$path"' in gi

Re: [PATCH] test-lib.sh: use printf instead of echo

2014-03-17 Thread Junio C Hamano
Jonathan Nieder writes: > Uwe Storbeck wrote: > >> Backslash sequences are interpreted as control characters >> by the echo command of some shells (e.g. dash). > > This has bothered me for a while but never enough to do anything about > it. Thanks for fixing it. > >> Signed-off-by: Uwe Storbeck

Re: [PATCH] test-lib.sh: use printf instead of echo

2014-03-17 Thread Uwe Storbeck
On Mar 15, Johannes Sixt wrote: > > - echo "$@" | sed -e 's/^/# /' > > + printf '%s\n' "$@" | sed -e 's/^/# /' > > This should be > > printf '%s\n' "$*" | sed -e 's/^/# /' Right, that should be $* to always be one argument for the format pattern. Thanks Uwe -- To unsu

Re: [PATCH] test-lib.sh: use printf instead of echo

2014-03-15 Thread Johannes Sixt
Am 15.03.2014 00:57, schrieb Uwe Storbeck: > when variables may contain backslash sequences. > > Backslash sequences are interpreted as control characters > by the echo command of some shells (e.g. dash). > > Signed-off-by: Uwe Storbeck > --- > t/test-lib.sh | 4 ++-- > 1 file changed, 2 insert

Re: [PATCH] test-lib.sh: use printf instead of echo

2014-03-14 Thread Jonathan Nieder
Uwe Storbeck wrote: > Backslash sequences are interpreted as control characters > by the echo command of some shells (e.g. dash). This has bothered me for a while but never enough to do anything about it. Thanks for fixing it. > Signed-off-by: Uwe Storbeck Reviewed-by: Jonathan Nieder (patc

[PATCH] test-lib.sh: use printf instead of echo

2014-03-14 Thread Uwe Storbeck
when variables may contain backslash sequences. Backslash sequences are interpreted as control characters by the echo command of some shells (e.g. dash). Signed-off-by: Uwe Storbeck --- t/test-lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/test-lib.sh b/t/test-