Skip to content

Commit 041c0cc

Browse files
committed
pacman: use the private MSYS root on Windows
1 parent f0ca482 commit 041c0cc

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

patches/pacman/0001-allow-writable-non-root-installation-roots.patch

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ for alternate roots the caller cannot write. When extracting as a non-root
66
user, preserve the package permissions but let the filesystem assign the
77
caller's UID and GID instead of attempting a privileged chown.
88

9-
MSYS has no Unix privilege boundary and cannot reliably apply access(2) to a
10-
Win32 path supplied by the native frontend. There, accept only an explicit
11-
alternate root and let the transaction's filesystem operations reject a path
12-
the current Windows user cannot write.
9+
MSYS has no Unix privilege boundary, and the private runtime maps the SDK
10+
directory itself to POSIX `/`. There, omit the Unix root-user check just as the
11+
MSYS2 port does; the process has only the invoking Windows user's filesystem
12+
rights and extraction rejects paths that user cannot write.
1313

1414
Based on pacman 7.1.0 commit 5683f8477a0afcc6b331766175a83445b2dcfe89.
1515

@@ -45,12 +45,12 @@ Based on pacman 7.1.0 commit 5683f8477a0afcc6b331766175a83445b2dcfe89.
4545

4646
+static int has_writable_alternate_root(void)
4747
+{
48+
+#if defined(__MSYS__) || defined(__CYGWIN__)
49+
+ return 1;
50+
+#else
4851
+ if(config->rootdir == NULL || strcmp(config->rootdir, "/") == 0) {
4952
+ return 0;
5053
+ }
51-
+#ifdef __MSYS__
52-
+ return 1;
53-
+#else
5454
+ return access(config->rootdir, W_OK | X_OK) == 0;
5555
+#endif
5656
+}

0 commit comments

Comments
 (0)