This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: x86/ -> ./ symlink
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin-apps at cygwin dot com
- Date: Mon, 1 Jul 2013 18:40:17 +0200
- Subject: Re: x86/ -> ./ symlink
- References: <20130629080152 dot GU2378 at calimero dot vinschen dot de> <20130629164600 dot GA1479 at ednor dot casa dot cgf dot cx> <20130629175908 dot GA5778 at ednor dot casa dot cgf dot cx> <20130630093846 dot GA2000 at calimero dot vinschen dot de> <20130630223132 dot GA5077 at ednor dot casa dot cgf dot cx> <20130701092301 dot GD2000 at calimero dot vinschen dot de> <20130701111532 dot GA20414 at calimero dot vinschen dot de> <20130701114624 dot GE2000 at calimero dot vinschen dot de> <20130701125056 dot GF2000 at calimero dot vinschen dot de> <20130701151815 dot GA4763 at calimero dot vinschen dot de>
- Reply-to: cygwin-apps at cygwin dot com
On Jul 1 17:18, Corinna Vinschen wrote:
> On Jul 1 14:50, Corinna Vinschen wrote:
> > 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.
>
> Scratch it. The general idea might be ok, but it just doesn't work if
> the local dir is not a mirror, but rather the installation directory as
> fetched via setup itself. In this case, the setup.ini files are not in
> top-level, but rather one level below top-level. This has to be taken
> into account.
>
> On the other hand, if the local dir is a mirror, there are now four
> setup.ini files, the 32 bit setup.ini in top-level and the x86 dir,
> and the 64 bit setup.ini in x86_64 and the 64bit subdirs, and setup
> will read all four of them.
>
> The long loading time was always a bit annoying, but other than that it
> was no problem, as long as there were only two ini files and the 64 bit
> file was called setup64.ini. Oh well.
(Hopefully last) followup to my monologue:
I think I have a solution now. I detached the "x86" and "x86_64" target
subdirs from SETUP_INI_FILENAME and introduced a SETUP_INI_DIR instead.
Changing the Find class to allow a maximum tracking depth, plus an
additional check to make sure the found file is the one from the target
subdir, this should work now in all circumstances.
See below. Again, not applied to not collide with what you have.
Corinna
* FindVisitor.cc (FindVisitor::visitDirectory): Check tracking level
argument to limit the search depth.
* FindVisitor.h (FindVisitor::visitDirectory): Add tracking level
argument to declaration.
* IniParseFindVisitor.cc (IniParseFindVisitor::visitFile): Check
found file's basePath to end in SETUP_INI_DIR.
* find.cc (Find::accept): Accept additional tracking level argument
and submit to FindVisitor::visitDirectory.
* find.h (Find::accept): Add tracking level argument to declaration.
* fromcwd.cc (do_fromcwd): Only search ini file two directory levels
deep.
* ini.cc (do_local_ini): Ditto.
(do_remote_ini): Add SETUP_INI_DIR to current_ini_name.
* ini.h (SETUP_INI_DIR): New macro.
(SETUP_INI_FILENAME): Just define filename.
(SETUP_BZ2_FILENAME): Ditto.
Index: FindVisitor.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/FindVisitor.cc,v
retrieving revision 2.2
diff -u -p -r2.2 FindVisitor.cc
--- FindVisitor.cc 16 Apr 2006 22:26:44 -0000 2.2
+++ FindVisitor.cc 1 Jul 2013 16:39:49 -0000
@@ -33,8 +33,11 @@ FindVisitor::visitFile(const std::string
// Default to recursing through directories.
void
FindVisitor::visitDirectory(const std::string& basePath,
- WIN32_FIND_DATA const *aDir)
+ WIN32_FIND_DATA const *aDir, int level)
{
- Find aFinder (basePath + aDir->cFileName);
- aFinder.accept (*this);
+ if (--level >= 0)
+ {
+ Find aFinder (basePath + aDir->cFileName);
+ aFinder.accept (*this, level);
+ }
}
Index: FindVisitor.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/FindVisitor.h,v
retrieving revision 2.3
diff -u -p -r2.3 FindVisitor.h
--- FindVisitor.h 16 Apr 2006 22:26:44 -0000 2.3
+++ FindVisitor.h 1 Jul 2013 16:39:49 -0000
@@ -26,7 +26,8 @@ public:
virtual void visitFile(const std::string& basePath,
WIN32_FIND_DATA const *);
virtual void visitDirectory(const std::string& basePath,
- WIN32_FIND_DATA const *);
+ WIN32_FIND_DATA const *,
+ int level);
virtual ~ FindVisitor ();
protected:
FindVisitor ();
Index: IniParseFindVisitor.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/IniParseFindVisitor.cc,v
retrieving revision 2.13
diff -u -p -r2.13 IniParseFindVisitor.cc
--- IniParseFindVisitor.cc 18 Dec 2009 11:59:53 -0000 2.13
+++ IniParseFindVisitor.cc 1 Jul 2013 16:39:49 -0000
@@ -51,6 +51,12 @@ IniParseFindVisitor::visitFile(const std
//TODO: Test for case sensitivity issues
if (casecompare(SETUP_INI_FILENAME, theFile->cFileName))
return;
+ /* Check if base dir ends in SETUP_INI_DIR. */
+ const char *dir = basePath.c_str() + basePath.size() - strlen (SETUP_INI_DIR);
+ if (dir <= basePath.c_str())
+ return;
+ if ((dir[-1] != '/' && dir[-1] != '\\') || casecompare (SETUP_INI_DIR, dir))
+ return;
current_ini_name = basePath + theFile->cFileName;
Index: find.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/find.cc,v
retrieving revision 2.11
diff -u -p -r2.11 find.cc
--- find.cc 30 May 2007 09:49:24 -0000 2.11
+++ find.cc 1 Jul 2013 16:39:49 -0000
@@ -47,7 +47,7 @@ Find::~Find()
}
void
-Find::accept (FindVisitor &aVisitor)
+Find::accept (FindVisitor &aVisitor, int level)
{
WIN32_FIND_DATA wfd;
if (_start_dir.size() > MAX_PATH)
@@ -68,7 +68,7 @@ Find::accept (FindVisitor &aVisitor)
* visited node
*/
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- aVisitor.visitDirectory (_start_dir, &wfd);
+ aVisitor.visitDirectory (_start_dir, &wfd, level);
else
aVisitor.visitFile (_start_dir, &wfd);
}
Index: find.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/find.h,v
retrieving revision 2.7
diff -u -p -r2.7 find.h
--- find.h 30 May 2007 09:49:24 -0000 2.7
+++ find.h 1 Jul 2013 16:39:49 -0000
@@ -30,7 +30,7 @@ class Find
public:
Find (const std::string& starting_dir);
~Find ();
- void accept (FindVisitor &);
+ void accept (FindVisitor &, int level = INT_MAX);
private:
std::string _start_dir;
HANDLE h;
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 16:39:49 -0000
@@ -75,7 +75,7 @@ do_fromcwd (HINSTANCE h, HWND owner)
{
// Assume we won't find the INI file.
SetupFindVisitor found_ini;
- Find(".").accept(found_ini);
+ Find(".").accept(found_ini, 2); // Only search one level deep.
if (found_ini)
{
// Found INI, load it.
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 16:39:49 -0000
@@ -126,7 +126,7 @@ do_local_ini (HWND owner)
GuiParseFeedback myFeedback;
IniDBBuilderPackage findBuilder(myFeedback);
IniParseFindVisitor myVisitor (findBuilder, local_dir, myFeedback);
- Find (local_dir).accept(myVisitor);
+ Find (local_dir).accept(myVisitor, 2);
setup_timestamp = myVisitor.timeStamp();
ini_setup_version = myVisitor.version();
return myVisitor.iniCount();
@@ -150,8 +150,8 @@ do_remote_ini (HWND owner)
{
bool sig_fail = false;
/* First try to fetch the .bz2 compressed ini file. */
- current_ini_name = n->url + SETUP_BZ2_FILENAME;
- current_ini_sig_name = n->url + SETUP_BZ2_FILENAME + ".sig";
+ current_ini_name = n->url + SETUP_INI_DIR + SETUP_BZ2_FILENAME;
+ current_ini_sig_name = n->url + SETUP_INI_DIR + SETUP_BZ2_FILENAME + ".sig";
ini_file = get_url_to_membuf (current_ini_name, owner);
if (!NoVerifyOption)
ini_sig_file = get_url_to_membuf (current_ini_sig_name, owner);
@@ -220,8 +220,8 @@ do_remote_ini (HWND owner)
- there was no .bz2 file found on the mirror.
- the .bz2 file didn't look like a valid bzip2 file.
- there was an error during bzip2 decompression. */
- current_ini_name = n->url + SETUP_INI_FILENAME;
- current_ini_sig_name = n->url + SETUP_INI_FILENAME + ".sig";
+ current_ini_name = n->url + SETUP_INI_DIR + SETUP_INI_FILENAME;
+ current_ini_sig_name = n->url + SETUP_INI_DIR + SETUP_INI_FILENAME + ".sig";
ini_file = get_url_to_membuf (current_ini_name, owner);
if (!NoVerifyOption)
ini_sig_file = get_url_to_membuf (current_ini_sig_name, owner);
@@ -264,7 +264,7 @@ do_remote_ini (HWND owner)
/* save known-good setup.ini locally */
const std::string fp = "file://" + local_dir + "/" +
rfc1738_escape_part (n->url) +
- "/" + SETUP_INI_FILENAME;
+ "/" + SETUP_INI_DIR + SETUP_INI_FILENAME;
io_stream::mkpath_p (PATH_TO_FILE, fp, 0);
if (io_stream *out = io_stream::open (fp, "wb", 0))
{
Index: ini.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/ini.h,v
retrieving revision 2.44
diff -u -p -r2.44 ini.h
--- ini.h 22 Jun 2013 20:02:01 -0000 2.44
+++ ini.h 1 Jul 2013 16:39:49 -0000
@@ -39,8 +39,9 @@ typedef enum
} excludes;
extern bool is_64bit;
-#define SETUP_INI_FILENAME (is_64bit ? "x86_64/setup.ini" : "x86/setup.ini")
-#define SETUP_BZ2_FILENAME (is_64bit ? "x86_64/setup.bz2" : "x86/setup.bz2")
+#define SETUP_INI_DIR (is_64bit ? "x86_64/" : "x86/")
+#define SETUP_INI_FILENAME "setup.ini"
+#define SETUP_BZ2_FILENAME "setup.bz2"
/* The following three vars are used to facilitate error handling between the
parser/lexer and its callers, namely ini.cc:do_remote_ini() and
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat