bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Jim Meyering
Subject: [PATCH] git-version-gen: include command name in one more diagnostic
Date: Mon, 03 Jan 2011 11:56:33 +0100

Bruce Korb wrote:
> - Log -----------------------------------------------------------------
> commit fbdc78279ad97fc393e78fbf8ba2e3481e706255
> Author: Bruce Korb <address@hidden>
> Date:   Sun Jan 2 11:58:30 2011 -0800
>
>     ensure that unreadable file error messages include program name
>
> -----------------------------------------------------------------------
>
> Summary of changes:
>  build-aux/git-version-gen |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
...
> @@ -85,7 +85,10 @@ 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 2>&1` || {
> +        echo "$0 error: unreadable tarball version file $1:  $v" >&2
> +        exit 1
> +    }
>      case $v in
>       *$nl*) v= ;; # reject multi-line output
>       [0-9]*) ;;

Hi Bruce,

Thanks for noticing that git-version-gen doesn't always
generate proper diagnostics.  I noticed your commit above,
on the topic/libposix 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 <address@hidden>
Date: Mon, 3 Jan 2011 11:50:43 +0100
Subject: [PATCH] git-version-gen: include command name in one more diagnostic

* build-aux/git-version-gen: When the required .tarball-version file
was missing or unreadable, you might see the diagnostic from "cat",
but no trace of the name of the invoking script.  Now, you still see
the diagnostic from cat, but also get one from "git-version-gen: ".
Inspired by a patch from Bruce Korb.
---
 ChangeLog                 |    7 +++++++
 build-aux/git-version-gen |    6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6577d3e..749ad91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-01-03  Jim Meyering  <address@hidden>

+       git-version-gen: include command name in one more diagnostic
+       * build-aux/git-version-gen: When the required .tarball-version file
+       was missing or unreadable, you might see the diagnostic from "cat",
+       but no trace of the name of the invoking script.  Now, you still see
+       the diagnostic from cat, but also get one from "git-version-gen: ".
+       Inspired by a patch from Bruce Korb.
+
        update-copyright: adjust test to match changed code
        * tests/test-update-copyright.sh: Change test's expected output
        to match new actual output.
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index c278f6a..c337673 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Print a version string.
-scriptversion=2010-10-13.20; # UTC
+scriptversion=2011-01-03.10; # UTC

 # Copyright (C) 2007-2011 Free Software Foundation, Inc.
 #
@@ -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 multi-line output
        [0-9]*) ;;
        *) v= ;;
     esac
     test -z "$v" \
-       && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2
+       && echo "$0: WARNING: $tarball_version_file is missing or damaged" 1>&2
 fi

 if test -n "$v"
--
1.7.3.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]