summaryrefslogtreecommitdiff
path: root/system/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'system/coreutils')
-rw-r--r--system/coreutils/APKBUILD6
-rw-r--r--system/coreutils/revert-gnulib-getcwd-speedup-linux.patch92
2 files changed, 96 insertions, 2 deletions
diff --git a/system/coreutils/APKBUILD b/system/coreutils/APKBUILD
index 6a4c7957e..6201d14ed 100644
--- a/system/coreutils/APKBUILD
+++ b/system/coreutils/APKBUILD
@@ -3,7 +3,7 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=coreutils
pkgver=9.2
-pkgrel=0
+pkgrel=1
pkgdesc="Basic file, shell, and text manipulation utilities"
url="https://www.gnu.org/software/coreutils/"
arch="all"
@@ -23,6 +23,7 @@ source="https://ftp.gnu.org/gnu/coreutils/$pkgname-$pkgver.tar.xz
localename-test-fix.patch
test-df-symlink-bindmount.patch
test-tee-avoid-eintr.patch
+ revert-gnulib-getcwd-speedup-linux.patch
"
[ "${CBUILD}" != "${CHOST}" ] && source="$source
051_all_coreutils-mangen.patch
@@ -78,7 +79,8 @@ fd97fccd661befc558b3afb3e32c82dd2cef511a05e6129d49540599297c1b59ab1f109e63a12f58
eaba7ad1c5b43d25dc96baaf6f01be5976f9f64c26ea55e1c78d6a3f12825f2f0e998aae7f2ad6d9b2637a3d11586ffe21b87fbbd3c1bb6c9898c5963cb2a32c gnulib-test-fixes.patch
b1509e5678a05f24d6e764c047546e5e34a7fbd5edb59c7debedb144a0096d8ac247c7e2722a5f68c90751e5280bec743c9a6ed3e1433c1916294d68d7bca109 localename-test-fix.patch
15a91b343b6c4d6ef31b322cd2787893eacccb81a7e0202aeac17c3aa18130e6feb5ddb32f39187b4cf2a5d6a9a536a0a6f992e4da90d954a72f158d0df6e4ba test-df-symlink-bindmount.patch
-43bf6a1934a22478c93f4680180f1d7f157c9a5f7320bd8efac3f6e850db08bb57d32f4658eca34ee711e61538ef1932bd6abf730b4d2371e1a128c6d148939f test-tee-avoid-eintr.patch"
+43bf6a1934a22478c93f4680180f1d7f157c9a5f7320bd8efac3f6e850db08bb57d32f4658eca34ee711e61538ef1932bd6abf730b4d2371e1a128c6d148939f test-tee-avoid-eintr.patch
+84b8c141052a5db99f4d470a0f6f74ca01041f04e573ca0774f69a931bbe061c1b95cf5b09ab5f08f4322e04c6fc124449f368b51ccd6e837dec686b8521d86a revert-gnulib-getcwd-speedup-linux.patch"
[ "${CBUILD}" != "${CHOST}" ] && sha512sums="
bae804f057252c25452ac178c545dc2c4b4775cbfbdcfd4775edd1a4ed6507882bfac39e2b11ad01b74230ca48d761bf62f11bde5bcbc35a6e5a61cbe4a46e36 051_all_coreutils-mangen.patch
"
diff --git a/system/coreutils/revert-gnulib-getcwd-speedup-linux.patch b/system/coreutils/revert-gnulib-getcwd-speedup-linux.patch
new file mode 100644
index 000000000..fa8f66395
--- /dev/null
+++ b/system/coreutils/revert-gnulib-getcwd-speedup-linux.patch
@@ -0,0 +1,92 @@
+From d598f8169bbc9178c59d35f0df95637a70d3377f Mon Sep 17 00:00:00 2001
+From: Zach van Rijn <me@zv.io>
+Date: Mon, 10 Apr 2023 04:09:56 -0500
+Subject: [PATCH] Revert "getcwd: Speed up on Linux. Add support for Android."
+
+This reverts commit 356a414e8c15ef3f8cc7b7157427c8ce9a9f7c1b.
+
+diff --git a/lib/getcwd.c b/lib/getcwd.c
+index 0530630c43..04b8d2df39 100644
+--- a/lib/getcwd.c
++++ b/lib/getcwd.c
+@@ -173,9 +173,6 @@ __getcwd_generic (char *buf, size_t size)
+ #if HAVE_OPENAT_SUPPORT
+ int fd = AT_FDCWD;
+ bool fd_needs_closing = false;
+-# if defined __linux__
+- bool proc_fs_not_mounted = false;
+-# endif
+ #else
+ char dots[DEEP_NESTING * sizeof ".." + BIG_FILE_NAME_COMPONENT_LENGTH + 1];
+ char *dotlist = dots;
+@@ -441,67 +438,6 @@ __getcwd_generic (char *buf, size_t size)
+
+ thisdev = dotdev;
+ thisino = dotino;
+-
+-#if HAVE_OPENAT_SUPPORT
+- /* On some platforms, a system call returns the directory that FD points
+- to. This is useful if some of the ancestor directories of the
+- directory are unreadable, because in this situation the loop that
+- climbs up the ancestor hierarchy runs into an EACCES error.
+- For example, in some Android app, /data/data/com.termux is readable,
+- but /data/data and /data are not. */
+-# if defined __linux__
+- /* On Linux, in particular, if /proc is mounted,
+- readlink ("/proc/self/fd/<fd>")
+- returns the directory, if its length is < 4096. (If the length is
+- >= 4096, it fails with error ENAMETOOLONG, even if the buffer that we
+- pass to the readlink function would be large enough.) */
+- if (!proc_fs_not_mounted)
+- {
+- char namebuf[14 + 10 + 1];
+- sprintf (namebuf, "/proc/self/fd/%u", (unsigned int) fd);
+- char linkbuf[4096];
+- ssize_t linklen = readlink (namebuf, linkbuf, sizeof linkbuf);
+- if (linklen < 0)
+- {
+- if (errno != ENAMETOOLONG)
+- /* If this call was not successful, the next one will likely be
+- not successful either. */
+- proc_fs_not_mounted = true;
+- }
+- else
+- {
+- dirroom = dirp - dir;
+- if (dirroom < linklen)
+- {
+- if (size != 0)
+- {
+- __set_errno (ERANGE);
+- goto lose;
+- }
+- else
+- {
+- char *tmp;
+- size_t oldsize = allocated;
+-
+- allocated += linklen - dirroom;
+- if (allocated < oldsize
+- || ! (tmp = realloc (dir, allocated)))
+- goto memory_exhausted;
+-
+- /* Move current contents up to the end of the buffer. */
+- dirp = memmove (tmp + dirroom + (allocated - oldsize),
+- tmp + dirroom,
+- oldsize - dirroom);
+- dir = tmp;
+- }
+- }
+- dirp -= linklen;
+- memcpy (dirp, linkbuf, linklen);
+- break;
+- }
+- }
+-# endif
+-#endif
+ }
+
+ if (dirstream && __closedir (dirstream) != 0)
+--
+2.25.1
+