Control: tags -1 patch

Holger Levsen wrote on Fri, Feb 21, 2020 at 15:38:38 +0000:
> Hi Daniel,
> 
> On Fri, Feb 21, 2020 at 03:25:34PM +0000, Daniel Shahaf wrote:
> > Please prefix "check-support-status: " to the error message.
> 
> Can I have a patch, please?

This?

diff --git a/check-support-status.in b/check-support-status.in
index 7296360..958c2f5 100755
--- a/check-support-status.in
+++ b/check-support-status.in
@@ -92,6 +92,7 @@ while true ; do
             EXCEPT="$2"
             case "$EXCEPT" in
                 *:*)
+                    printf "%s: " "$NAME" &&
                     gettext 'E: --except=<package name> does not allow :<arch> 
suffixes'; echo
                     exit 1
                     ;;
@@ -107,6 +108,7 @@ while true ; do
             break
             ;;
         *)
+            printf "%s: " "$NAME" &&
             gettext 'E: Internal error'; echo
             exit 1
             ;;
@@ -129,6 +131,7 @@ case "$TYPE" in
         $0 --type earlyend --list [% ENDED %] --status-db "$STATUSDB_FILE" 
--except "$EXCEPT" $NOHEADING
         exit 0
     fi
+    printf "%s: " "$NAME" &&
     gettext 'E: Need a --type if --list is given'; echo
     exit 1
     ;;
@@ -142,6 +145,7 @@ limited)
     [ "$LIST" ] || LIST=[% LIMITED %]
     ;;
 *)
+    printf "%s: " "$NAME" &&
     eval_gettext "E: Unknown --type '\$TYPE'"; echo
     exit 1
     ;;
@@ -164,6 +168,7 @@ if [ "$DPKG_VERSION" ] && dpkg --compare-versions 
"$DPKG_VERSION" '<<' 1.16 ; th
     SHOWFORMAT='${Status}\t${Package}\t${Version}\t${Source}\n'
 else
     if [ -z "$DPKG_VERSION" ] ; then
+        printf "%s: " "$NAME" &&
         gettext "E: Cannot detect dpkg version, assuming wheezy or newer"; echo
     fi
     SHOWFORMAT='${Status}\t${binary:Package}\t${Version}\t${Source}\n'

The trailing "&&" are meant to discourage code from being added between
the printf and the gettext.  I've considered several alernatives but
didn't come up with one that's significantly better.

Looks like these error messages should go to stderr, too — unless that'd
be an API change?

Cheers,

Daniel

Reply via email to