From: balejk <balejk@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] musl: backport patch to fix fgetws
Date: Sat, 13 Jan 2024 18:37:17 +0100 [thread overview]
Message-ID: <20240113173717.1D24B235C7@inbox.vuxu.org> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-45617@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 1236 bytes --]
There is an updated pull request by balejk against master on the void-packages repository
https://github.com/balejk/void-packages musl-fgetws
https://github.com/void-linux/void-packages/pull/45617
musl: backport patch to fix fgetws
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **briefly**
<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)
<!--
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-musl
- armv7l
- armv6l-musl
-->
A patch file from https://github.com/void-linux/void-packages/pull/45617.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-musl-fgetws-45617.patch --]
[-- Type: text/x-diff, Size: 3055 bytes --]
From f3069957b521044f40e99e62a4a147eb4e68afed Mon Sep 17 00:00:00 2001
From: Karel Balej <balejk@matfyz.cz>
Date: Tue, 15 Aug 2023 22:21:18 +0200
Subject: [PATCH] musl: backport patch to fix fgetws
---
srcpkgs/musl/patches/fgetws.patch | 61 +++++++++++++++++++++++++++++++
srcpkgs/musl/template | 2 +-
2 files changed, 62 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/musl/patches/fgetws.patch
diff --git a/srcpkgs/musl/patches/fgetws.patch b/srcpkgs/musl/patches/fgetws.patch
new file mode 100644
index 0000000000000..c85c874279eab
--- /dev/null
+++ b/srcpkgs/musl/patches/fgetws.patch
@@ -0,0 +1,61 @@
+From f8bdc3048216f41eaaf655524fa286cfb1184a70 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Sun, 20 Feb 2022 20:11:14 -0500
+Subject: [PATCH] fix spurious failures by fgetws when buffer ends with partial
+ character
+
+commit a90d9da1d1b14d81c4f93e1a6d1a686c3312e4ba made fgetws look for
+changes to errno by fgetwc to detect encoding errors, since ISO C did
+not allow the implementation to set the stream's error flag in this
+case, and the fgetwc interface did not admit any other way to detect
+the error. however, the possibility of fgetwc setting errno to EILSEQ
+in the success path was overlooked, and in fact this can happen if the
+buffer ends with a partial character, causing mbtowc to be called with
+only part of the character available.
+
+since that change was made, the C standard was amended to specify that
+fgetwc set the stream error flag on encoding errors, and commit
+511d70738bce11a67219d0132ce725c323d00e4e made it do so. thus, there is
+no longer any need for fgetws to poke at errno to handle encoding
+errors.
+
+this commit reverts commit a90d9da1d1b14d81c4f93e1a6d1a686c3312e4ba
+and thereby fixes the problem.
+---
+ src/stdio/fgetws.c | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+diff --git a/src/stdio/fgetws.c b/src/stdio/fgetws.c
+index b08b3049..195cb435 100644
+--- a/src/stdio/fgetws.c
++++ b/src/stdio/fgetws.c
+@@ -1,6 +1,5 @@
+ #include "stdio_impl.h"
+ #include <wchar.h>
+-#include <errno.h>
+
+ wint_t __fgetwc_unlocked(FILE *);
+
+@@ -12,10 +11,6 @@ wchar_t *fgetws(wchar_t *restrict s, int n, FILE *restrict f)
+
+ FLOCK(f);
+
+- /* Setup a dummy errno so we can detect EILSEQ. This is
+- * the only way to catch encoding errors in the form of a
+- * partial character just before EOF. */
+- errno = EAGAIN;
+ for (; n; n--) {
+ wint_t c = __fgetwc_unlocked(f);
+ if (c == WEOF) break;
+@@ -23,7 +18,7 @@ wchar_t *fgetws(wchar_t *restrict s, int n, FILE *restrict f)
+ if (c == '\n') break;
+ }
+ *p = 0;
+- if (ferror(f) || errno==EILSEQ) p = s;
++ if (ferror(f)) p = s;
+
+ FUNLOCK(f);
+
+--
+2.41.0
+
diff --git a/srcpkgs/musl/template b/srcpkgs/musl/template
index 9838f9ad9e613..8c3be7d76e8a1 100644
--- a/srcpkgs/musl/template
+++ b/srcpkgs/musl/template
@@ -2,7 +2,7 @@
pkgname=musl
reverts="1.2.0_1"
version=1.1.24
-revision=19
+revision=20
archs="*-musl"
bootstrap=yes
build_style=gnu-configure
next prev parent reply other threads:[~2024-01-13 17:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-15 20:35 [PR PATCH] " balejk
2023-08-17 14:22 ` [PR PATCH] [Updated] " balejk
2023-08-30 17:36 ` balejk
2023-09-10 10:52 ` balejk
2023-12-10 1:48 ` github-actions
2023-12-15 20:31 ` balejk
2024-01-13 17:37 ` balejk [this message]
2024-04-13 1:39 ` github-actions
2024-04-27 1:45 ` [PR PATCH] [Closed]: " github-actions
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240113173717.1D24B235C7@inbox.vuxu.org \
--to=balejk@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).