From 0391bf96bd7f0821cbbb2d5ce102e4bc2d00207c Mon Sep 17 00:00:00 2001 From: Christopher Wellons Date: Mon, 1 Dec 2025 13:15:59 -0500 Subject: [PATCH] WIP busybox: update UTF-8 manifest (#315) --- src/busybox-manifest.patch | 47 ++++++++++++++++++++++++++++++++++++++ src/variant-x86.patch | 9 ++++---- 2 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 src/busybox-manifest.patch diff --git a/src/busybox-manifest.patch b/src/busybox-manifest.patch new file mode 100644 index 0000000..95422bc --- /dev/null +++ b/src/busybox-manifest.patch @@ -0,0 +1,47 @@ +diff --git a/win32/resources/utf8.manifest b/win32/resources/utf8.manifest +index efe6a3d2f..70cd1c070 100644 +--- a/win32/resources/utf8.manifest ++++ b/win32/resources/utf8.manifest +@@ -1,11 +1,11 @@ + +- ++ + +- +- ++ ++ + UTF-8 +- +- ++ ++ + + + +--- a/win32/winansi.c ++++ b/win32/winansi.c +@@ -1456,6 +1456,7 @@ static int writeCon_utf8(int fd, const char *u8buf, size_t u8siz) + + HANDLE h = (HANDLE)_get_osfhandle(fd); + int wlen = 0; ++ DWORD nwritten = 0; + + if (!wbuf) + wbuf = xmalloc(wbufwsiz * sizeof(wchar_t)); +@@ -1519,13 +1520,13 @@ static int writeCon_utf8(int fd, const char *u8buf, size_t u8siz) + + // flush if we have less than two empty spaces + if (wlen > wbufwsiz - 2) { +- if (!WriteConsoleW(h, wbuf, wlen, 0, 0)) ++ if (!WriteConsoleW(h, wbuf, wlen, &nwritten, 0) || nwritten != wlen) + return -1; + wlen = 0; + } + } + +- if (wlen && !WriteConsoleW(h, wbuf, wlen, 0, 0)) ++ if (wlen && (!WriteConsoleW(h, wbuf, wlen, &nwritten, 0) || nwritten != wlen)) + return -1; + return 0; + } diff --git a/src/variant-x86.patch b/src/variant-x86.patch index 6cf1afa..a1573ee 100644 --- a/src/variant-x86.patch +++ b/src/variant-x86.patch @@ -39,8 +39,7 @@ --disable-win32-registry \ + --disable-win32-utf8-manifest \ --enable-mingw-wildcard \ -@@ -384,3 +389,3 @@ - RUN cat $PREFIX/src/busybox-*.patch | patch -p1 \ -- && make mingw64u_defconfig \ -+ && make mingw64_defconfig \ - && sed -ri 's/^(CONFIG_AR)=y/\1=n/' .config \ +@@ -425,2 +425,3 @@ RUN cat $PREFIX/src/busybox-*.patch | patch -p1 \ + && sed -ri 's/^(CONFIG_XXD)=y/\1=n/' .config \ ++ && sed -ri 's/^(CONFIG_FEATURE_USE_CNG_API)=y/\1=n/' .config \ + && make -j$(nproc) CROSS_COMPILE=$ARCH- \