[Aptitude-devel] "examine view" crashing in curse aptitude 0.5.3.1

Alban Browaeys prahal at yahoo.com
Thu Jul 30 00:04:00 UTC 2009


Daniel Burrows a écrit :
> On Tue, Jul 28, 2009 at 02:28:34PM +0200, Alban Browaeys <prahal at yahoo.com> was heard to say:
>   
>> To reproduce I do an "U" then "e" in aptitude --no-gui -t experimental
>>
>>
>> update_dep_display seems broken to me . It calls d.get_dep() on a d that
>> could be set to have cache int 0 and start int 4 (because of the
>> unhighlights that cause this d to be an invalid d as told in the empty
>> args constructor for aptitude_resolver_dep )
>>     
>
>   get_dep().end() is the proper way to test for whether a dependency is
> valid.  For dependencies constructed with the default constructor, it
> should return an end iterator.  Unfortunately, this got broken when the
> universe layer was rewritten to conserve memory.  Easy to fix, though:
> just have end() check or a NULL cache.
>
>   Daniel
>
> _______________________________________________
> Aptitude-devel mailing list
> Aptitude-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/aptitude-devel
>
>   
This way ? It fixes the issue though it looks to me as it breaks the
design (as it make cache part of
the api, though this may be minor : probably is_valid_cache could be
replaced by is_valid and the function could
include more checks).
Mind that I am new to c++ so the usage of const may be invalid or the
function ought
to be in the .cc .
Thank you for the hint on what would be best .
Regards
Alban

PS: I did not report the bug in the end as it was already done in
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=527739#25
The gdb trace is identical. (though less complete).

diff -r 4b8a7d0e706d src/generic/apt/aptitude_resolver_universe.h
--- a/src/generic/apt/aptitude_resolver_universe.h    Tue Jul 28
08:26:51 2009 -0700
+++ b/src/generic/apt/aptitude_resolver_universe.h    Thu Jul 30
01:51:34 2009 +0200
@@ -474,6 +474,10 @@
    */
   template<typename InstallationType>
   bool broken_under(const InstallationType &I) const;
+  bool is_valid_cache() const
+  {
+    return !!cache;
+  }
 
   /** \return The APT dependency associated with this abstract
dependency. */
   pkgCache::DepIterator get_dep() const
diff -r 4b8a7d0e706d src/solution_screen.cc
--- a/src/solution_screen.cc    Tue Jul 28 08:26:51 2009 -0700
+++ b/src/solution_screen.cc    Thu Jul 30 01:51:34 2009 +0200
@@ -583,7 +583,7 @@
 {
   cw::tree_ref t(tBare);
 
-  if(d.get_dep().end())
+  if(!d.is_valid_cache() || d.get_dep().end())
     t->set_root(NULL);
   else
     t->set_root(make_dep_solvers_tree(d));

-------------- next part --------------
A non-text attachment was scrubbed...
Name: aptitude_hackfix_examineview.diff
Type: text/x-patch
Size: 900 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/aptitude-devel/attachments/20090730/f404756c/attachment.bin>


More information about the Aptitude-devel mailing list