[Dctrl-tools-devel] [SCM] Debian control file query tools branch, master, updated. 2.11-48-g761e32c

Antti-Juhani Kaijanaho ajk at debian.org
Sat Dec 5 10:35:05 UTC 2009


The following commit has been merged in the master branch:
commit 761e32c1684dba651874b5e638fc65c9a56d56c2
Author: Antti-Juhani Kaijanaho <ajk at debian.org>
Date:   Sat Dec 5 12:35:01 2009 +0200

    Fix Debian bug #559543.
    
    Signed-off-by: Antti-Juhani Kaijanaho <ajk at debian.org>

diff --git a/debian/changelog b/debian/changelog
index 19ca57b..b8bee61 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,13 +25,17 @@ dctrl-tools (2.14) UNRELEASED; urgency=low
   * GNUmakefile, debian/rules: clean backup files and .d files in subdirs too
     Closes: #511081 (.d files do not belong in the source package)
     Reported by: Adeodato Simó
+  * sort-dctrl/sort-dctrl: Fix -k parsing bug (don't just repeat the first
+    key...)
+    Closes: #559543 (doesn't take into account secondary sorting criteria)
+    Reported by: Ryan Niebur <ryan at debian.org>
   
   [ Stefano Zacchiroli ]
   * grep-dctrl: add new matching mode --whole-pkg/-w: it is an improved -e
     matching exact package names, i.e., no sub-string matching on package
     names. Closes: #383921
 
- --
+ -- Antti-Juhani Kaijanaho <ajk at debian.org>  Sat, 05 Dec 2009 12:32:47 +0200
 
 dctrl-tools (2.13.0) unstable; urgency=low
 
diff --git a/sort-dctrl/sort-dctrl.c b/sort-dctrl/sort-dctrl.c
index 10a3a62..1bf4d98 100644
--- a/sort-dctrl/sort-dctrl.c
+++ b/sort-dctrl/sort-dctrl.c
@@ -1,5 +1,5 @@
 /*  dctrl-tools - Debian control file inspection tools
-    Copyright © 2004, 2005, 2006, 2007, 2008 Antti-Juhani Kaijanaho
+    Copyright © 2004, 2005, 2006, 2007, 2008, 2009 Antti-Juhani Kaijanaho
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -72,7 +72,7 @@ static error_t parse_opt (int key, char * arg, struct argp_state * state)
 				*(flags++) = '\0';
 			}
 			struct key key;
-			key.field_inx = fieldtrie_insert(carg)->inx;
+			key.field_inx = fieldtrie_insert(s)->inx;
 			key.type = FT_STRING;
 			key.reverse = false;
 			for (char *p = flags; *p != '\0'; p++) {
@@ -89,9 +89,12 @@ static error_t parse_opt (int key, char * arg, struct argp_state * state)
 					fail();
 				}
 			}
+                        debug("parse_opt: append key %d %d %d",
+                              key.field_inx, key.type, key.reverse);
 			keys_append(&args->keys, key);
 		}
-		break;
+                debug_message("parse_opt: k", 0);
+                break;
 	}
 	case 'l': 
 	{
@@ -150,6 +153,8 @@ int main(int argc, char * argv[])
 	keys_init(&args.keys);
 	msg_set_progname(argv[0]);
 	argp_parse (&argp, argc, argv, ARGP_IN_ORDER, 0, &args);
+        
+        debug("number of keys: %zu", args.keys.nks);
 
 	if (args.keys.nks == 0) {
 		size_t inx = fieldtrie_insert("Package")->inx;
diff --git a/tests/bug559543.in b/tests/bug559543.in
new file mode 100644
index 0000000..0570554
--- /dev/null
+++ b/tests/bug559543.in
@@ -0,0 +1,14 @@
+id: 1
+priority: 1
+
+id: 2
+priority: 2
+
+id: 5
+priority: 1
+
+id: 4
+priority: 2
+
+id: 3
+priority: 1
diff --git a/tests/bug559543.out b/tests/bug559543.out
new file mode 100644
index 0000000..464cfed
--- /dev/null
+++ b/tests/bug559543.out
@@ -0,0 +1,15 @@
+id: 4
+priority: 2
+
+id: 2
+priority: 2
+
+id: 5
+priority: 1
+
+id: 3
+priority: 1
+
+id: 1
+priority: 1
+
diff --git a/tests/bug559543.sh b/tests/bug559543.sh
new file mode 100644
index 0000000..4aa29fe
--- /dev/null
+++ b/tests/bug559543.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# Test case due to Ryan Niebur <ryan at debian.org>.
+
+set -e
+
+$SORT_DCTRL -kpriority:nr,id:nr
\ No newline at end of file

-- 
Debian control file query tools



More information about the Dctrl-tools-devel mailing list