Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-04 Thread Eric Blake
On 01/04/2011 01:54 AM, Jim Meyering wrote: > Bruce Korb wrote: >> On 01/03/11 16:13, Eric Blake wrote: >>> $ /bin/sh -c 'v=`nonesuch` 2>/dev/null' >>> nonesuch: not found >>> $ /bin/sh -c 'v=`(nonesuch) 2>/dev/null`' >>> $ >> >> Just for grins, how about trying: >> >> /bin/sh -c 'v=`exec 2>/dev/nu

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-04 Thread Jim Meyering
Bruce Korb wrote: > On 01/03/11 16:13, Eric Blake wrote: >> $ /bin/sh -c 'v=`nonesuch` 2>/dev/null' >> nonesuch: not found >> $ /bin/sh -c 'v=`(nonesuch) 2>/dev/null`' >> $ > > Just for grins, how about trying: > > /bin/sh -c 'v=`exec 2>/dev/null;nonesuch`' > > I think it works for me on a Sun box:

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Bruce Korb
On 01/03/11 16:13, Eric Blake wrote: > > $ /bin/sh -c 'v=`nonesuch` 2>/dev/null' > nonesuch: not found > $ /bin/sh -c 'v=`(nonesuch) 2>/dev/null`' > $ $ cat bin/foo ; onallnodes /bin/sh bin/foo uname -s -r -n echo after exec v=`exec 2> /dev/null nonesuch` echo redirect v=`nonesuch` 2> /dev/nul

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Bruce Korb
On 01/03/11 16:13, Eric Blake wrote: > $ /bin/sh -c 'v=`nonesuch` 2>/dev/null' > nonesuch: not found > $ /bin/sh -c 'v=`(nonesuch) 2>/dev/null`' > $ Just for grins, how about trying: /bin/sh -c 'v=`exec 2>/dev/null;nonesuch`' I think it works for me on a Sun box: sunfall_bkorb $ /bin/sh -c '`n

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Eric Blake
On 01/03/2011 04:58 PM, Bruce Korb wrote: > On 01/03/11 11:29, Jim Meyering wrote: >>> Does that "git diff-index" really need to be run in a separate >>> shell invocation? dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= >> >> Yes. As I recall, that was required in order

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Bruce Korb
On 01/03/11 11:29, Jim Meyering wrote: >> Does that "git diff-index" really need to be run in a separate >> shell invocation? >>> dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= > > Yes. As I recall, that was required in order to ensure that even when > the shell fails to fi

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Ben Pfaff
Jim Meyering writes: > Good idea. > This has your name on it, so I'll wait for an "ok" before pushing: > > From a2e8447d6b8abe23504f4f2d4757a60a2e8bee54 Mon Sep 17 00:00:00 2001 > From: Ben Pfaff > Date: Mon, 3 Jan 2011 21:05:04 +0100 > Subject: [PATCH] git-version-gen: use (...) rather than sh

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Ralf Wildenhues
Hello Ben, Jim, * Ben Pfaff wrote on Mon, Jan 03, 2011 at 08:54:19PM CET: > Jim Meyering writes: > > > Bruce Korb wrote: > >> Does that "git diff-index" really need to be run in a separate > >> shell invocation? > >>> dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= > > > >

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Jim Meyering
Ben Pfaff wrote: > Jim Meyering writes: > >> Bruce Korb wrote: >>> Does that "git diff-index" really need to be run in a separate >>> shell invocation? dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= >> >> Yes. As I recall, that was required in order to ensure that eve

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Ben Pfaff
Jim Meyering writes: > Bruce Korb wrote: >> Does that "git diff-index" really need to be run in a separate >> shell invocation? >>> dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= > > Yes. As I recall, that was required in order to ensure that even when > the shell fails to

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Jim Meyering
Bruce Korb wrote: > On 01/03/11 09:56, Jim Meyering wrote: >> Did you determine which git command failed and why? > > There was only one git command that did not have stderr redirected: > numcommits=`git rev-list "$vtag"..HEAD | wc -l` > But in truth, *no* git command should have its erro

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Bruce Korb
On 01/03/11 09:56, Jim Meyering wrote: > Did you determine which git command failed and why? There was only one git command that did not have stderr redirected: numcommits=`git rev-list "$vtag"..HEAD | wc -l` But in truth, *no* git command should have its error output displayed without

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Jim Meyering
Bruce Korb wrote: > Hi Jim, > > On 01/03/11 07:17, Jim Meyering wrote: >> I now see that your patch ... combined stderr with the potentially >> mangled output from a failing "cat" command,... >> >> Also, while it's not likely that the file is missing at that point, >> it is possible, since there is

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Bruce Korb
Hi Jim, On 01/03/11 07:17, Jim Meyering wrote: > I now see that your patch ... combined stderr with the potentially > mangled output from a failing "cat" command,... > > Also, while it's not likely that the file is missing at that point, > it is possible, since there is a race condition. And if

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Jim Meyering
Bruce Korb wrote: > Hi Jim, > > On 01/03/11 02:56, Jim Meyering wrote: >> @@ -85,14 +85,14 @@ v= >> # then try "git describe", then default. >> if test -f $tarball_version_file >> then >> -v=`cat $tarball_version_file` || exit 1 >> +v=`cat $tarball_version_file` || v= >> case $v in

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Bruce Korb
On 01/03/11 06:09, Bruce Korb wrote: > Please notice that before "cat" runs, the file is tested for existence. > When "cat" does run, any error message goes to stderr and is thus > separated from the ``echo "$0: WARNING:..." stuff. I put them together > into a single well-ordered output. Also, "i

Re: [PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Bruce Korb
Hi Jim, On 01/03/11 02:56, Jim Meyering wrote: > @@ -85,14 +85,14 @@ v= > # then try "git describe", then default. > if test -f $tarball_version_file > then > -v=`cat $tarball_version_file` || exit 1 > +v=`cat $tarball_version_file` || v= > case $v in > *$nl*) v= ;; # reject

[PATCH] git-version-gen: include command name in one more diagnostic

2011-01-03 Thread Jim Meyering
ibposix branch. However, that change discards cat's stderr, which could contain useful information (e.g., EIO), so I solved the problem a different way on master: >From 55b6628590f922e9f47da60a3fc7a2030f80cddf Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 3 Jan 2011 11:50:43 +0100