This is the mail archive of the cygwin-developers 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]

Re: More: [1.7] packaging problem? Both /usr/bin/ and /usr/lib/ are non-empty


On May 13 13:26, Christopher Faylor wrote:
On Wed, May 13, 2009 at 07:20:00PM +0200, Corinna Vinschen wrote:
>> >Ok, sure.  Are you going to do that?
>> 
>> Yes.  Trivial change.

I just applied a small patch.  The root dir got the MOUNT_OVERRIDE flag
instead of the MOUNT_IMMUTABLE flag.  This looked like a typo.  Without
this patch, you can override / without the "override" flag.

I also added a no-op "auto" option to the oopts array so the output of
mount -m is just stoically used.  Maybe we should actually tweak mount
-m not to emit "auto" mount points instead, but itshould be fine one way
or the other.

However, I have a problem with enforcing the MOUNT_CYGWIN_EXEC flag for
/usr/bin.  Not all executables in /usr/bin are cygwin executables.  Even
our own strace or cygcheck are no Cygwin binaries, and there are a
couple more in the directory.  This MOUNT_CYGWIN_EXEC default overrides
the checks in spawn.cc for non-cygwin binaries.  IMO using the cygexec
flag should be a deliberate choice of the admin/user.  I would prefer we
would remove it from the auto /usr/bin again.

And something else occured to me.  Isn't it too simple to create the
/usr/bin entry like this?

  char *p = stpcpy (native, mount[root_idx].native_path);
  stpcpy (p, "\\bin");
  mount_table->add_item (native, "/usr/bin", MOUNT_SYSTEM...);

This works for a default installation, but what if Cygwin has *not* been
installed in a directory called "bin"?  Isn't the idea of /usr/bin to
point to the directory in which the Cygwin DLL itself is installed,
rather than blindly pointing to ${native_root}\bin?  So, shouldn't we
create the default /usr/bin entry more along the lines of the following
patch?

	* mount.cc (mount_info::init): Create /usr/bin mount entry
	from parent dir of the Cygwin DLL, rather then using the fixed
	string "\\bin".  Remove MOUNT_CYGWIN_EXEC option.

Index: mount.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/mount.cc,v
retrieving revision 1.37
diff -u -p -r1.37 mount.cc
--- mount.cc	14 May 2009 09:56:45 -0000	1.37
+++ mount.cc	14 May 2009 10:20:52 -0000
@@ -337,16 +337,27 @@ mount_info::init ()
     {
       char native[PATH_MAX];
       assert (root_idx != -1);
-      char *p = stpcpy (native, mount[root_idx].native_path);
       if (!got_usr_bin)
       {
-	stpcpy (p, "\\bin");
-	mount_table->add_item (native, "/usr/bin",
-			       MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_AUTOMATIC | MOUNT_CYGWIN_EXEC);
+	/* Make sure /usr/bin points to the directory in which the Cygwin DLL
+	   is installed, even if it's not called "bin". */
+	char *p = native;
+	GetModuleFileNameA (cygwin_hmodule, p, PATH_MAX);
+	/* Cut away trailing DLL filename. */
+	*strrchr (p, '\\') = '\0';
+	/* Convert long Win32 path to standard syntax. */
+	if (!strncmp (p, "\\\\?\\", 4))
+	  {
+	    p += 4;
+	    if (!strncmp (p, "UNC\\", 4))
+	      *(p += 2) = '\\';
+	  }
+	mount_table->add_item (p, "/usr/bin",
+			       MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_AUTOMATIC);
       }
       if (!got_usr_lib)
       {
-	stpcpy (p, "\\lib");
+	stpcpy (stpcpy (native, mount[root_idx].native_path), "\\lib");
 	mount_table->add_item (native, "/usr/lib",
 			       MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_AUTOMATIC);
       }


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


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