122 lines
3.7 KiB
Diff
122 lines
3.7 KiB
Diff
From 92177a96e1deb38b4c53fe1ddbede880557d4ecc Mon Sep 17 00:00:00 2001
|
|
From: Alexpux <alexey.pawlow@gmail.com>
|
|
Date: Fri, 28 Feb 2014 21:02:07 +0400
|
|
Subject: [PATCH] Revert mounting /usr to /
|
|
|
|
---
|
|
winsup/cygwin/mount.cc | 54 +++++++++++++++++++++++++++-----------------------
|
|
winsup/cygwin/mount.h | 6 +++---
|
|
2 files changed, 32 insertions(+), 28 deletions(-)
|
|
|
|
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
|
|
index cc291c1..df76bf2 100644
|
|
--- a/winsup/cygwin/mount.cc
|
|
+++ b/winsup/cygwin/mount.cc
|
|
@@ -41,8 +41,9 @@ details. */
|
|
#define isproc(path) \
|
|
(path_prefix_p (proc, (path), proc_len, false))
|
|
|
|
+bool NO_COPY mount_info::got_usr_bin;
|
|
+bool NO_COPY mount_info::got_usr_lib;
|
|
int NO_COPY mount_info::root_idx = -1;
|
|
-bool NO_COPY mount_info::root_mnt;
|
|
|
|
/* is_unc_share: Return non-zero if PATH begins with //server/share
|
|
or with one of the native prefixes //./ or //?/
|
|
@@ -478,18 +479,24 @@ mount_info::init ()
|
|
from_fstab (false, path, pathend);
|
|
from_fstab (true, path, pathend);
|
|
|
|
- /* map root to /usr on msys */
|
|
- if (!root_mnt)
|
|
+ if (!got_usr_bin || !got_usr_lib)
|
|
{
|
|
char native[PATH_MAX];
|
|
if (root_idx < 0)
|
|
- api_fatal ("root_idx %d, user_shared magic %y, nmounts %d", root_idx, user_shared->version, nmounts);
|
|
+ api_fatal ("root_idx %d, user_shared magic %p, nmounts %d", root_idx, user_shared->version, nmounts);
|
|
char *p = stpcpy (native, mount[root_idx].native_path);
|
|
- if (!root_mnt)
|
|
- {
|
|
- stpcpy (p, "\\");
|
|
- add_item (native, "/usr", MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_AUTOMATIC | MOUNT_NOACL);
|
|
- }
|
|
+ if (!got_usr_bin)
|
|
+ {
|
|
+ stpcpy (p, "\\bin");
|
|
+ add_item (native, "/usr/bin",
|
|
+ MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_AUTOMATIC | MOUNT_NOACL);
|
|
+ }
|
|
+ if (!got_usr_lib)
|
|
+ {
|
|
+ stpcpy (p, "\\lib");
|
|
+ add_item (native, "/usr/lib",
|
|
+ MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_AUTOMATIC | MOUNT_NOACL);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -1323,19 +1330,14 @@ sort_by_native_name (const void *a, const void *b)
|
|
res = strcmp (ap->native_path, bp->native_path);
|
|
|
|
if (res == 0)
|
|
- {
|
|
- if ((ap->flags & MOUNT_SYSTEM) != (bp->flags & MOUNT_SYSTEM))
|
|
- {
|
|
- /* need to select between user and system mount to same native path */
|
|
- if (!(bp->flags & MOUNT_SYSTEM)) /* user mount */
|
|
- return 1;
|
|
- else
|
|
- return -1;
|
|
- }
|
|
- else
|
|
- /* All things being equal, sort by POSIX path */
|
|
- return sort_by_posix_name (a, b);
|
|
- }
|
|
+ {
|
|
+ /* need to select between user and system mount to same POSIX path */
|
|
+ if (!(bp->flags & MOUNT_SYSTEM)) /* user mount */
|
|
+ return 1;
|
|
+ else
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
return res;
|
|
}
|
|
|
|
@@ -1439,9 +1441,11 @@ mount_info::add_item (const char *native, const char *posix,
|
|
if (i == nmounts)
|
|
nmounts++;
|
|
|
|
- /* only /usr thanks */
|
|
- if (strcmp (posixtmp, "/usr") == 0)
|
|
- root_mnt = true;
|
|
+ if (strcmp (posixtmp, "/usr/bin") == 0)
|
|
+ got_usr_bin = true;
|
|
+
|
|
+ if (strcmp (posixtmp, "/usr/lib") == 0)
|
|
+ got_usr_lib = true;
|
|
|
|
if (posixtmp[0] == '/' && posixtmp[1] == '\0' && !(mountflags & MOUNT_CYGDRIVE))
|
|
root_idx = i;
|
|
diff --git a/winsup/cygwin/mount.h b/winsup/cygwin/mount.h
|
|
index 67319a2..55b8fd4 100644
|
|
--- a/winsup/cygwin/mount.h
|
|
+++ b/winsup/cygwin/mount.h
|
|
@@ -169,9 +169,9 @@ class mount_info
|
|
int nmounts;
|
|
mount_item mount[MAX_MOUNTS];
|
|
|
|
- /* changed a bit for msys */
|
|
- static bool root_mnt;
|
|
- static int root_idx;
|
|
+ static bool got_usr_bin;
|
|
+ static bool got_usr_lib;
|
|
+ static int root_idx;
|
|
|
|
/* cygdrive_prefix is used as the root of the path automatically
|
|
prepended to a path when the path has no associated mount.
|
|
--
|
|
1.8.5.5
|
|
|