On Jul 1 13:46, Corinna Vinschen wrote: > On Jul 1 13:15, Corinna Vinschen wrote: > > On Jul 1 11:23, Corinna Vinschen wrote: > > > I'll have a look, too. The 64 bit version now also misbehaves like the > > > 32 bit version in terms of showing a broken package list. A first > > > debugging attempt shows that it now neglects to parse the .ini file at > > > all for some reason. > > > > I found the reason for not finding the local setup.ini file anymore. > > The much too complex algorithm scans the *entire* tree below the local > > package dir for a file called SETUP_INI_FILENAME. The problem now is > > that it compares SETUP_INI_FILENAME against the filename returned by > > FindFileNext. Since SETUP_INI_FILENAME now includes a path component > > (x86/x86_64), the search doesn't work anymore. And after that, when it > > didn't find the file, it scans the entire tree another time to collect > > file information for all files in the tree to be able to go ahead > > without setup.ini file. > > > > I'm just struggling with the idiotically complex C++ class system. > > I thought I just simplify the do_fromcwd function to just check for the > > file, but now I have another weird effect. After setup spends some time > > in the progress dialog, it suddenly is back to dialog #2, "Choose A > > Download Source". Incredible how that's possible at all. How I wish > > setup would have been written in plain C. > > There's also IniParseFindVisitor::visitFile called from do_local_ini, > which *again* scans the entire directory tree. Why on earth does > setup scan for the ini file instead of just using the given path? > > Still digging...
Here's a patch which should do the trick. I'm deliberately not applying it so that I don't colide with anything you already have in the loop. Corinna * fromcwd.cc (class SetupFindVisitor): Remove. (do_fromcwd): Simply check if setup.ini exists and is > 0, rather than searching directory tree recursively. * ini.cc (do_local_ini): Just call IniParseFindVisitor::myVisitor with direct path to setup.ini file, rather than searching directory tree recursively. Index: fromcwd.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/fromcwd.cc,v retrieving revision 2.33 diff -u -p -r2.33 fromcwd.cc --- fromcwd.cc 28 Feb 2007 00:55:04 -0000 2.33 +++ fromcwd.cc 1 Jul 2013 12:46:19 -0000 @@ -31,60 +31,18 @@ static const char *cvsid = #endif #include "win32.h" - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include "resource.h" -#include "state.h" -#include "dialog.h" -#include "msg.h" -#include "find.h" -#include "ScanFindVisitor.h" -#include "filemanip.h" #include "ini.h" -#include "IniDBBuilderPackage.h" -#include "IniParseFeedback.h" - -/* Trivial class for detecting the existence of setup.ini */ - -class SetupFindVisitor : public FindVisitor -{ -public: - SetupFindVisitor (): found(false){} - virtual void visitFile(const std::string& basePath, - const WIN32_FIND_DATA *theFile) - { - if (!casecompare(SETUP_INI_FILENAME, theFile->cFileName) && - (theFile->nFileSizeLow || theFile->nFileSizeHigh)) - found = true; - } - virtual ~ SetupFindVisitor (){} - operator bool () const {return found;} -protected: - SetupFindVisitor (SetupFindVisitor const &); - SetupFindVisitor & operator= (SetupFindVisitor const &); -private: - bool found; -}; - bool do_fromcwd (HINSTANCE h, HWND owner) { - // Assume we won't find the INI file. - SetupFindVisitor found_ini; - Find(".").accept(found_ini); - if (found_ini) + WIN32_FIND_DATA f; + HANDLE fh = FindFirstFileA (SETUP_INI_FILENAME, &f); + if (fh != INVALID_HANDLE_VALUE) { - // Found INI, load it. - return true; + FindClose (fh); + if (f.nFileSizeLow > 0) + return true; } - - IniParseFeedback myFeedback; - IniDBBuilderPackage myBuilder(myFeedback); - ScanFindVisitor myVisitor (myBuilder); - Find(".").accept(myVisitor); return false; } Index: ini.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/ini.cc,v retrieving revision 2.56 diff -u -p -r2.56 ini.cc --- ini.cc 22 Jun 2013 20:02:01 -0000 2.56 +++ ini.cc 1 Jul 2013 12:46:19 -0000 @@ -123,10 +123,12 @@ private: static int do_local_ini (HWND owner) { + WIN32_FIND_DATA f; GuiParseFeedback myFeedback; IniDBBuilderPackage findBuilder(myFeedback); IniParseFindVisitor myVisitor (findBuilder, local_dir, myFeedback); - Find (local_dir).accept(myVisitor); + strcpy (f.cFileName, SETUP_INI_FILENAME); + myVisitor.visitFile (local_dir + "\\", &f); setup_timestamp = myVisitor.timeStamp(); ini_setup_version = myVisitor.version(); return myVisitor.iniCount(); -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat