From 3a4760f6f5d8ab77e1e00be3ed0e5a7376cd5116 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 8 Jan 2022 22:54:14 -0600 Subject: system/musl: use original behaviour for realpath This reverts a change in musl 1.2.2 that causes realpath(3) to return "//" for "//" instead of "/". This does not conform to any other OS behaviour other than z/OS. Upstream is still considering which behaviour is correct. Fixes: #446 Upstream-URL: https://www.openwall.com/lists/musl/2021/01/13/1 Suggested-by: Samuel Holland Acked-by: Zach van Rijn --- system/musl/APKBUILD | 4 +++- system/musl/realpath.patch | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 system/musl/realpath.patch (limited to 'system') diff --git a/system/musl/APKBUILD b/system/musl/APKBUILD index 56fadc5e2..d333ecfe2 100644 --- a/system/musl/APKBUILD +++ b/system/musl/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: A. Wilcox pkgname=musl pkgver=1.2.3_pre1 -pkgrel=0 +pkgrel=1 pkgdate=20211129 pkgdesc="System library (libc) implementation" url="https://www.musl-libc.org/" @@ -27,6 +27,7 @@ source="https://distfiles.adelielinux.org/source/$pkgname-$pkgver-$pkgdate.tar.x 3001-make-real-lastlog-h.patch handle-aux-at_base.patch fgetspent_r.patch + realpath.patch ldconfig getent.c @@ -125,6 +126,7 @@ f7b05d8c5f804ba3ad6998b3de5fa4d9dfceac4aca63dd67298c2d5f27cdd28a91eba74f6e428c25 88ae443dbb8e0a4368235bdc3a1c5c7b718495afa75e06deb8e01becc76cb1f0d6964589e2204fc749c9c1b3190b8b9ac1ae2c0099cab8e2ce3ec877103d4332 3001-make-real-lastlog-h.patch 1f4e9aea5a546015c75f77aa0dec10d56fc14831ccc15cf71ff27fc15ac5230ffeadb382ebe1c87c1ea07a462620e16ed01cd36252d997d1a9c2af11cb5c9ff3 handle-aux-at_base.patch ded41235148930f8cf781538f7d63ecb0c65ea4e8ce792565f3649ee2523592a76b2a166785f0b145fc79f5852fd1fb1729a7a09110b3b8f85cba3912e790807 fgetspent_r.patch +d5ec3f1a86f2194e0af83c2391508811b939d0f8f2fd2ac5ac7f03774f8a250ce42399110d2ae04d32b864ee292863fed683a029b64598dbbcb21d9811a825d0 realpath.patch cb71d29a87f334c75ecbc911becde7be825ab30d8f39fa6d64cb53812a7c9abaf91d9804c72540e5be3ddd3c84cfe7fd9632274309005cb8bcdf9a9b09b4b923 ldconfig 378d70e65bcc65bb4e1415354cecfa54b0c1146dfb24474b69e418cdbf7ad730472cd09f6f103e1c99ba6c324c9560bccdf287f5889bbc3ef0bdf0e08da47413 getent.c 9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf iconv.c" diff --git a/system/musl/realpath.patch b/system/musl/realpath.patch new file mode 100644 index 000000000..25d685918 --- /dev/null +++ b/system/musl/realpath.patch @@ -0,0 +1,37 @@ +From 99b84a793669c69acc705a61d339441b50bd09a8 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Wed, 13 Jan 2021 14:28:35 +0100 +Subject: [PATCH] realpath: replace leading // with a single / + +On some systems a leading double slash may have special meaning, so +POSIX[1] says that "If a pathname begins with two successive +characters, the first component following the leading characters +may be interpreted in an implementation-defined manner" + +While current musl implementation is technically correct, most other +systems' (at least GNU libc, freebsd, openbsd, netbsd macOS) +implementations will replace a leading // with a single /. Make musl +do the same to avoid surprises. + +[1]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13 +--- + src/misc/realpath.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/src/misc/realpath.c b/src/misc/realpath.c +index db8b74dc..414b4741 100644 +--- a/src/misc/realpath.c ++++ b/src/misc/realpath.c +@@ -46,9 +46,6 @@ restart: + q=0; + output[q++] = '/'; + p++; +- /* Initial // is special. */ +- if (stack[p] == '/' && stack[p+1] != '/') +- output[q++] = '/'; + continue; + } + +-- +2.29.2 + -- cgit v1.2.3-70-g09d2