[Dctrl-tools-devel] [SCM] Debian control file query tools branch, master, updated. 2.19-9-gb0b6ee7

Antti-Juhani Kaijanaho ajk at debian.org
Sun Nov 27 18:23:00 UTC 2011


The following commit has been merged in the master branch:
commit b0b6ee762f68f36999abc600e517f47af86cc608
Author: Antti-Juhani Kaijanaho <ajk at debian.org>
Date:   Sun Nov 27 20:21:29 2011 +0200

    Fix #641255: Output even a zero count (and exit successfully)
    
    Signed-off-by: Antti-Juhani Kaijanaho <ajk at debian.org>

diff --git a/debian/changelog b/debian/changelog
index b26c4bf..92d427e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,8 +7,11 @@ dctrl-tools (2.20) UNRELEASED; urgency=low
     is in dctrl format.
     - Later on we may want to make --ensure-dctrl the default.  In anticipation,
       a --compat option has been added that countermands any --ensure-dctrl.
+  * grep-dctrl: With -c, output even a zero count and exit successfully.
+    Closes: #641255 (grep-dctrl -c does not print out 0 when it should)
+    [ Reported by Antti-Juhani Kaijanaho <ajk at debian.org> ]
 
- -- Antti-Juhani Kaijanaho <ajk at debian.org>  Sun, 13 Nov 2011 20:24:48 +0200
+ -- Antti-Juhani Kaijanaho <ajk at debian.org>  Sun, 27 Nov 2011 20:19:51 +0200
 
 dctrl-tools (2.19) unstable; urgency=low
 
diff --git a/grep-dctrl/grep-dctrl.c b/grep-dctrl/grep-dctrl.c
index a7bf6f0..d43df2a 100644
--- a/grep-dctrl/grep-dctrl.c
+++ b/grep-dctrl/grep-dctrl.c
@@ -940,7 +940,7 @@ int main (int argc, char * argv[])
 		fsaf_close(fp);
 		close_ifile(fname, fd);
 	}
-	if (count) printf("%zi\n", count);
-	return errors_reported() ? 2 : found ? 0 : 1;
+	if (args.count) printf("%zi\n", count);
+	return errors_reported() ? 2 : found || args.count ? 0 : 1;
 }
 
diff --git a/tests/bug641255.in b/tests/bug641255.in
new file mode 100644
index 0000000..100441f
--- /dev/null
+++ b/tests/bug641255.in
@@ -0,0 +1,4 @@
+Foo: bar
+
+Foo: baz
+
diff --git a/tests/bug641255.out b/tests/bug641255.out
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tests/bug641255.out
@@ -0,0 +1 @@
+0
diff --git a/tests/0010.sh b/tests/bug641255.sh
similarity index 61%
copy from tests/0010.sh
copy to tests/bug641255.sh
index 1fed9f1..d526a9f 100644
--- a/tests/0010.sh
+++ b/tests/bug641255.sh
@@ -5,4 +5,4 @@ set -e
 LC_ALL=C
 export LC_ALL
 
-$GREP_DCTRL ''
+$GREP_DCTRL -c -FFoo xyzzy

-- 
Debian control file query tools



More information about the Dctrl-tools-devel mailing list