msys2-runtime: fix creating native symlinks pointing to ..
This commit corresponds to https://github.com/msys2/msys2-runtime/pull/292. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
416fd2a7a1
commit
b4961ddeb9
62
msys2-runtime/0041-symlink_native-allow-linking-to.patch
Normal file
62
msys2-runtime/0041-symlink_native-allow-linking-to.patch
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
From bc3e285ac0a2c91080ac68279f0c9fd697a2d9b6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||||
|
Date: Thu, 19 Jun 2025 20:46:03 +0200
|
||||||
|
Subject: [PATCH 41/N] symlink_native: allow linking to `..`
|
||||||
|
|
||||||
|
When running
|
||||||
|
|
||||||
|
CYGWIN=winsymlinks:nativestrict ln -s .. abc
|
||||||
|
|
||||||
|
the counter-intuitive result is _not_ a symbolic link to `..`, but
|
||||||
|
instead to `../../$(basename "$PWD")`.
|
||||||
|
|
||||||
|
The reason for this is that the search for the longest common prefix
|
||||||
|
assumes that the link target is not a strict prefix of the parent
|
||||||
|
directory of the link itself.
|
||||||
|
|
||||||
|
Let's fix that.
|
||||||
|
|
||||||
|
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||||
|
---
|
||||||
|
winsup/cygwin/path.cc | 21 ++++++++++++++++-----
|
||||||
|
1 file changed, 16 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
|
||||||
|
index 6f04658..ead7d16 100644
|
||||||
|
--- a/winsup/cygwin/path.cc
|
||||||
|
+++ b/winsup/cygwin/path.cc
|
||||||
|
@@ -2030,9 +2030,18 @@ symlink_native (const char *oldpath, path_conv &win32_newpath)
|
||||||
|
while (towupper (*++c_old) == towupper (*++c_new))
|
||||||
|
;
|
||||||
|
/* The last component could share a common prefix, so make sure we end
|
||||||
|
- up on the first char after the last common backslash. */
|
||||||
|
- while (c_old[-1] != L'\\')
|
||||||
|
- --c_old, --c_new;
|
||||||
|
+ up on the first char after the last common backslash.
|
||||||
|
+
|
||||||
|
+ However, if c_old is a strict prefix of c_new (at a component
|
||||||
|
+ boundary), or vice versa, then do not try to find the last common
|
||||||
|
+ backslash. */
|
||||||
|
+ if ((!*c_old || *c_old == L'\\') && (!*c_new || *c_new == L'\\'))
|
||||||
|
+ c_old += !!*c_old, c_new += !!*c_new;
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ while (c_old[-1] != L'\\')
|
||||||
|
+ --c_old, --c_new;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/* 2. Check if prefix is long enough. The prefix must at least points to
|
||||||
|
a complete device: \\?\X:\ or \\?\UNC\server\share\ are the minimum
|
||||||
|
@@ -2057,8 +2066,10 @@ symlink_native (const char *oldpath, path_conv &win32_newpath)
|
||||||
|
final_oldpath = &final_oldpath_buf;
|
||||||
|
final_oldpath->Buffer = tp.w_get ();
|
||||||
|
PWCHAR e_old = final_oldpath->Buffer;
|
||||||
|
- while (num-- > 0)
|
||||||
|
- e_old = wcpcpy (e_old, L"..\\");
|
||||||
|
+ while (num > 1 || (num == 1 && *c_old))
|
||||||
|
+ e_old = wcpcpy (e_old, L"..\\"), num--;
|
||||||
|
+ if (num > 0)
|
||||||
|
+ e_old = wcpcpy (e_old, L"..");
|
||||||
|
wcpcpy (e_old, c_old);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,7 +4,7 @@
|
|||||||
pkgbase=msys2-runtime
|
pkgbase=msys2-runtime
|
||||||
pkgname=('msys2-runtime' 'msys2-runtime-devel')
|
pkgname=('msys2-runtime' 'msys2-runtime-devel')
|
||||||
pkgver=3.6.3
|
pkgver=3.6.3
|
||||||
pkgrel=3
|
pkgrel=4
|
||||||
pkgdesc="Cygwin POSIX emulation engine"
|
pkgdesc="Cygwin POSIX emulation engine"
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
url="https://www.cygwin.com/"
|
url="https://www.cygwin.com/"
|
||||||
@ -69,9 +69,10 @@ source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#tag=cygwin-$
|
|||||||
0037-Avoid-sharing-cygheaps-across-Cygwin-versions.patch
|
0037-Avoid-sharing-cygheaps-across-Cygwin-versions.patch
|
||||||
0038-uname-report-msys2-runtime-commit-hash-too.patch
|
0038-uname-report-msys2-runtime-commit-hash-too.patch
|
||||||
0039-Cygwin-Adjust-CWD-magic-to-accommodate-for-the-lates.patch
|
0039-Cygwin-Adjust-CWD-magic-to-accommodate-for-the-lates.patch
|
||||||
0040-Cygwin-Fix-compatibility-with-w32api-headers-v13.patch)
|
0040-Cygwin-Fix-compatibility-with-w32api-headers-v13.patch
|
||||||
|
0041-symlink_native-allow-linking-to.patch)
|
||||||
sha256sums=('dd3cb54af2f8828d6857a3a595b02b09b23209570e0cc44342f4c9826845fb63'
|
sha256sums=('dd3cb54af2f8828d6857a3a595b02b09b23209570e0cc44342f4c9826845fb63'
|
||||||
'ff4f032ec1fdee986071bc20bb1480189b7bb4efdd5693b327ca664ee0bef3a1'
|
'eea82d3aac8b57ab34acf1e7dbb6e916f1bdc5106199379517adf2cf5edfd2ab'
|
||||||
'5538db757661949423563bab5e4f383dfa4ef0cf3301cf43f23b482392554b3b'
|
'5538db757661949423563bab5e4f383dfa4ef0cf3301cf43f23b482392554b3b'
|
||||||
'2fb9b2b297797d20cd901eaee2de735e8cdda1c1e5836e9ff77856c0d1216860'
|
'2fb9b2b297797d20cd901eaee2de735e8cdda1c1e5836e9ff77856c0d1216860'
|
||||||
'780977d71e35bbe4c0dcda5272895267d68d635f311e224f7981858f7192a85e'
|
'780977d71e35bbe4c0dcda5272895267d68d635f311e224f7981858f7192a85e'
|
||||||
@ -111,7 +112,8 @@ sha256sums=('dd3cb54af2f8828d6857a3a595b02b09b23209570e0cc44342f4c9826845fb63'
|
|||||||
'e2f58cba187f16b21df69dc3b7372f41bf2edfc543d136c62f85c83e0f22f3ad'
|
'e2f58cba187f16b21df69dc3b7372f41bf2edfc543d136c62f85c83e0f22f3ad'
|
||||||
'd8baf6e0e9c44a60d133f506fc91fa79043543266c6142918fad2c234cf4d0b5'
|
'd8baf6e0e9c44a60d133f506fc91fa79043543266c6142918fad2c234cf4d0b5'
|
||||||
'c5a5dd5645ce86f83824a2fe50ab3cc9df1211d2983bc18bbd11c608249e31b1'
|
'c5a5dd5645ce86f83824a2fe50ab3cc9df1211d2983bc18bbd11c608249e31b1'
|
||||||
'519323947b0f80d9416fff31eb981ce2cd9c74a3b42c3cd2f74bca3c8a703aa5')
|
'519323947b0f80d9416fff31eb981ce2cd9c74a3b42c3cd2f74bca3c8a703aa5'
|
||||||
|
'2d477d5ebb89c5674686306454356a093765e69719102224c7ab59ac50a7a99e')
|
||||||
|
|
||||||
# Helper macros to help make tasks easier #
|
# Helper macros to help make tasks easier #
|
||||||
apply_patch_with_msg() {
|
apply_patch_with_msg() {
|
||||||
@ -189,7 +191,8 @@ prepare() {
|
|||||||
0037-Avoid-sharing-cygheaps-across-Cygwin-versions.patch \
|
0037-Avoid-sharing-cygheaps-across-Cygwin-versions.patch \
|
||||||
0038-uname-report-msys2-runtime-commit-hash-too.patch \
|
0038-uname-report-msys2-runtime-commit-hash-too.patch \
|
||||||
0039-Cygwin-Adjust-CWD-magic-to-accommodate-for-the-lates.patch \
|
0039-Cygwin-Adjust-CWD-magic-to-accommodate-for-the-lates.patch \
|
||||||
0040-Cygwin-Fix-compatibility-with-w32api-headers-v13.patch
|
0040-Cygwin-Fix-compatibility-with-w32api-headers-v13.patch \
|
||||||
|
0041-symlink_native-allow-linking-to.patch
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
1f8def9f776a7dd0d0381f4bf25e84f805393cc1
|
bc3e285ac0a2c91080ac68279f0c9fd697a2d9b6
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user