This is the mail archive of the 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] fix for cygcheck -s if run from /usr/bin

Currently, if you run cygcheck -s with the current directory as /usr/bin
you get every cyg*.dll found twice, once with ".\" prefix and the second
time with "\cygwin\bin\" prefix.  The user gets a spurious "Multiple
Cygwin DLLs found" warning even if there is only one present.

The following patch tries to correct this.  In init_paths(), the
paths[1] value is populated by GetCurrentDirectory() instead of just
".".  This causes the existing duplicate checking code in add_path() to
reject a later attempt to add a directory from $PATH that is the same as

However, this also means that if "." is in $PATH it will no longer be
rejected by that same duplicate checking code, so init_paths() is also
modified to not add "." since we already have the CWD added explicitly.

Finally, in dump_sysinfo() the loop is changed to check starting with
paths[1] instead of paths[0], since paths[0] is a special "placeholder"
value that is initialized to ".".  paths[1] contains the CWD anyway so
there's no need to examine paths[0].



2005-03-24  Brian Dessent  <>

	* (init_paths): Use full path instead of "." for the
	current directory.  Do not add "." if present in $PATH.
	(dump_sysinfo): Skip placeholder first value of paths[].
RCS file: /cvs/src/src/winsup/utils/,v
retrieving revision 1.64
diff -u -p -r1.64
---	18 Nov 2004 05:20:23 -0000	1.64
+++	24 Mar 2005 09:41:40 -0000
@@ -158,7 +158,12 @@ init_paths ()
   char tmp[4000], *sl;
   add_path ((char *) ".", 1);	/* to be replaced later */
-  add_path ((char *) ".", 1);	/* the current directory */
+  if (GetCurrentDirectory (4000, tmp))
+    add_path (tmp, strlen (tmp));
+  else
+    display_error ("init_paths: GetCurrentDirectory()");  
   if (GetSystemDirectory (tmp, 4000))
     add_path (tmp, strlen (tmp));
@@ -180,7 +185,8 @@ init_paths ()
       while (1)
 	  for (e = b; *e && *e != ';'; e++);
-	  add_path (b, e - b);
+	  if (strncmp(b, ".", 1) && strncmp(b, ".\\", 2))
+	    add_path (b, e - b);
 	  if (!*e)
 	  b = e + 1;
@@ -1237,7 +1243,7 @@ dump_sysinfo ()
   if (givehelp)
     printf ("Looking for various Cygnus DLLs...  (-v gives version info)\n");
   int cygwin_dll_count = 0;
-  for (i = 0; i < num_paths; i++)
+  for (i = 1; i < num_paths; i++)
       WIN32_FIND_DATA ffinfo;
       sprintf (tmp, "%s/*.*", paths[i]);

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