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

Bug#657389: Tasksel is to blame



Jurij Smakov wrote:
> I noticed that as well with today's dailies. This is displayed by 
> tasksel, installer just invokes it in /target. I can also reproduce it 
> on an installed system by running 'tasksel -t'.

Since I can't reproduce this, I can only guess.

tasksel contains a sub list_installed() that parses
/var/lib/dpkg/status. Perhaps something about the status file format has
changed?

Parsing the file is a bit gratuitous, so I've attached a patch that
switches it to dpkg-query. Does it fix the issue?

-- 
see shy jo
From af213911196f47c4cbe3fb0ba9f54999a32f9684 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Sun, 29 Jan 2012 02:26:33 -0400
Subject: [PATCH] Use dpkg-query to list packages, rather than parsing the
 status file. Closes: #657389

---
 debian/changelog |    4 ++++
 tasksel.pl       |   10 ++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ff17af3..1e81501 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,10 @@ tasksel (3.08) UNRELEASED; urgency=low
     - Add ibus-gtk3 to task-korean-gnome-desktop
     - Replace ttf-* with fonts-*
 
+  [ Joey Hess ]
+  * Use dpkg-query to list packages, rather than parsing the status file.
+    Closes: #657389
+
  -- Christian Perrier <bubulle@debian.org>  Mon, 05 Dec 2011 21:29:17 +0100
 
 tasksel (3.07) unstable; urgency=low
diff --git a/tasksel.pl b/tasksel.pl
index d32c456..0b05d74 100755
--- a/tasksel.pl
+++ b/tasksel.pl
@@ -115,15 +115,13 @@ sub list_avail {
 # Returns a list of all installed packages.
 sub list_installed {
 	my @list;
-	local $/="\n\n";
-	open (STATUS, $statusfile);
-	local $_;
-	while (<STATUS>) {
-		if (/^Status: .* installed$/m && /Package: (.*)$/m) {
+	open (LIST, q{dpkg-query -W -f='${Package} ${Status}\n' |});
+	while (<LIST>) {
+		if (/^([^ ]+) .* installed$/m) {
 			push @list, $1;
 		}
 	}
-	close STATUS;
+	close LIST;
 	return @list;
 }
 
-- 
1.7.8.3

Attachment: signature.asc
Description: Digital signature


Reply to: