This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] setup dependency fix, was Re: setup.exe problem with selecting "curr" radio button


Max Bowsher wrote:

> > Just today I noticed a buglet in setup.exe where it will "lose" some
> > dependencies when pressing the "curr" radio button, even if that is the
> > current selected choice.  That kind of violates the principle that
> > selecting something that's already selected shouldn't have any effect.
> 
> Wow!
> 
> Very useful info!
> 
> It may take me a while to comprehend the dependency code, but bugzilla-ed
> for now.

Here is, I believe, a fix to the problem.  Each packagemeta object has a
'visited' flag that is used to detect loops in the dependency checking
and stop looping.  It is normally reset for the entire list of packages
upon any click, before starting to recurse to check for dependencies. 
This is done in PickPackageLine::click() through
packagemeta::PrepareForVisit(), which just calls
packagedb::markUnVisited().  However, it was not being done for
ChooserPage::changeTrust() which is called when the "trust" radio button
is clicked.

On a side note, I found this problem very quickly by instrumenting key
functions with calls to msg() (which just does a printf-like output with
OutputDebugString()) and then using sysinternals' DebugView to capture
that output live in realtime.  That was a wicked awesome way to debug,
as you get instant live feedback about what's going on, without having
to write to any files.  I highly recommend it...

Brian

2005-04-08  Brian Dessent  brian@dessent.net

	* choose.cc (ChooserPage::changeTrust): Mark all packages as
	unvisited prior to applying change of trust.
Index: choose.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/choose.cc,v
retrieving revision 2.137
diff -u -p -r2.137 choose.cc
--- choose.cc	23 Dec 2004 18:12:12 -0000	2.137
+++ choose.cc	8 Apr 2005 10:57:41 -0000
@@ -223,6 +223,9 @@ ChooserPage::changeTrust()
 {
   chooser->defaultTrust (aTrust);
   packagedb db;
+  
+  // set each node to un-visited so that dependencies will all be recalculated
+  db.markUnVisited();
   for_each(db.packages.begin(), db.packages.end(), SetRequirement(aTrust));
   chooser->refresh();
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]