@@ -6,6 +6,11 @@ for alternate roots the caller cannot write. When extracting as a non-root
66user, preserve the package permissions but let the filesystem assign the
77caller'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.
13+
914Based on pacman 7.1.0 commit 5683f8477a0afcc6b331766175a83445b2dcfe89.
1015
1116--- a/lib/libalpm/add.c
@@ -34,15 +39,20 @@ Based on pacman 7.1.0 commit 5683f8477a0afcc6b331766175a83445b2dcfe89.
3439
3540--- a/src/pacman/pacman.c
3641+++ b/src/pacman/pacman.c
37- @@ -1168,6 +1168,13 @@ static void cl_to_log(int argc, char *argv[])
42+ @@ -1168,6 +1168,18 @@ static void cl_to_log(int argc, char *argv[])
3843 }
3944 }
4045
4146+ static int has_writable_alternate_root(void)
4247+ {
43- + return config->rootdir != NULL
44- + && strcmp(config->rootdir, "/") != 0
45- + && access(config->rootdir, W_OK | X_OK) == 0;
48+ + if(config->rootdir == NULL || strcmp(config->rootdir, "/") == 0) {
49+ + return 0;
50+ + }
51+ + #ifdef __MSYS__
52+ + return 1;
53+ + #else
54+ + return access(config->rootdir, W_OK | X_OK) == 0;
55+ + #endif
4656+ }
4757+
4858 /** Main function.
0 commit comments