[Aptitude-devel] r3158 - in branches/aptitude-0.3/aptitude: . src/generic
Daniel Burrows
dburrows@costa.debian.org
Thu, 28 Apr 2005 00:38:49 +0000
Author: dburrows
Date: Thu Apr 28 00:38:45 2005
New Revision: 3158
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/generic/apt.cc
Log:
Don't discard the messages from a failed attempt to open the cache.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Thu Apr 28 00:38:45 2005
@@ -1,5 +1,10 @@
2005-04-27 Daniel Burrows <dburrows@debian.org>
+ * src/generic/apt.cc:
+
+ Hackily avoid discarding the error list by instead asking the UI
+ to clear it out for us (making sure that errors don't get lost).
+
* doc/en/aptitude.xml, src/generic/matchers.cc:
Make ~ahold find packages that are actually *held*. ~akeep now
Modified: branches/aptitude-0.3/aptitude/src/generic/apt.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/apt.cc (original)
+++ branches/aptitude-0.3/aptitude/src/generic/apt.cc Thu Apr 28 00:38:45 2005
@@ -1,6 +1,6 @@
// apt.cc
//
-// Copyright 1999,2000,2001 Daniel Burrows
+// Copyright 1999-2005 Daniel Burrows
//
// 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
@@ -17,7 +17,7 @@
// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
//
-// Handles basic apt bookeeping that apt-pkg doesn't :)
+// Handles basic apt bookkeeping.
#include "apt.h"
#include "../aptitude.h"
@@ -180,6 +180,10 @@
apt_reload_cache(progress_bar, do_initselections, status_fname);
}
+// HACK: this is declared in the UI layer, and should be abstracted
+// via, eg, a signal emission (ewww).
+void check_apt_errors();
+
void apt_reload_cache(OpProgress *progress_bar, bool do_initselections,
const char * status_fname)
{
@@ -216,11 +220,11 @@
if(open_failed && getuid()==0)
{
- _error->Discard();
+ // Don't discard errors, make sure they get displayed instead.
+ check_apt_errors();
open_failed=!new_file->Open(*progress_bar, do_initselections,
- false, status_fname) ||
- _error->PendingError();
+ false, status_fname);
if(!open_failed)
_error->Warning(_("Warning: could not lock the cache file. Opening in read-only mode"));