From 3a7b547759aac7f808b11ffa5a71e1076936c471 Mon Sep 17 00:00:00 2001 From: Thomas Hager Date: Wed, 18 Apr 2012 08:35:21 +0200 Subject: [PATCH] replaced /bin/echo with printf, Solaris echo doesn't recognize -n gitolite setup fails to check admin pubkey, because $text always contains 2 or more lines after tsh_try() (the key and -n). [committer adds: I wasn't sure if 'printf' would work on cygwin, so I chose what looked like a safer option, but apparently it wasn't safe enough and fell afoul of Solaris. Anyway I managed to check (using a small test program) with someone who runs gitolite on cygwin, and it works. If you're wondering why I didn't just use echo followed by chomp(), that would of course have been the easy way out but I wanted to see how you'd do it without a post-processing option. It became a frustrating challenge of sorts because it seems such a trivial thing! ] --- src/lib/Gitolite/Common.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Gitolite/Common.pm b/src/lib/Gitolite/Common.pm index 947819a..638b122 100644 --- a/src/lib/Gitolite/Common.pm +++ b/src/lib/Gitolite/Common.pm @@ -277,7 +277,7 @@ sub logger_plus_stderr { sub tsh_try { my $cmd = shift; die "try: expects only one argument" if @_; - $text = `( $cmd ) 2>&1; /bin/echo -n RC=\$?`; + $text = `( $cmd ) 2>&1; printf RC=\$?`; if ( $text =~ s/RC=(\d+)$// ) { $rc = $1; trace( 3, $text );