pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
i3: fix uselocale() problem
Module Name: pkgsrc-wip
Committed By: Thomas Klausner <wiz%NetBSD.org@localhost>
Pushed By: wiz
Date: Sat Dec 27 16:35:20 2025 +0100
Changeset: 7d523ab4334ee09f08fb7adf3e46467db02aa243
Modified Files:
i3/distinfo
i3/patches/patch-meson.build
Added Files:
i3/patches/patch-i3-config-wizard_main.c
i3/patches/patch-i3bar_src_child.c
i3/patches/patch-src_ipc.c
i3/patches/patch-src_load__layout.c
i3/patches/patch-src_util.c
Log Message:
i3: fix uselocale() problem
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=7d523ab4334ee09f08fb7adf3e46467db02aa243
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
i3/distinfo | 7 +-
i3/patches/patch-i3-config-wizard_main.c | 16 ++++
i3/patches/patch-i3bar_src_child.c | 16 ++++
i3/patches/patch-meson.build | 13 +++-
i3/patches/patch-src_ipc.c | 123 +++++++++++++++++++++++++++++++
i3/patches/patch-src_load__layout.c | 78 ++++++++++++++++++++
i3/patches/patch-src_util.c | 38 ++++++++++
7 files changed, 289 insertions(+), 2 deletions(-)
diffs:
diff --git a/i3/distinfo b/i3/distinfo
index fb485a8f1e..9ad969e582 100644
--- a/i3/distinfo
+++ b/i3/distinfo
@@ -5,6 +5,11 @@ SHA512 (i3-4.25.tar.xz) = 237f62ccb25b13bd676cca562abe6ba4c65451a02976cd0547ee44
Size (i3-4.25.tar.xz) = 1357280 bytes
SHA1 (patch-etc_config) = d3f649e8d4dc7cae7eb3c1548fa8d81224e4dacb
SHA1 (patch-etc_config.keycodes) = 6adde0b3a56576805facd951fa9d32bfd6c88011
-SHA1 (patch-meson.build) = 013ac42f10aeb1ad05b5496f6283878e53506c46
+SHA1 (patch-i3-config-wizard_main.c) = 39d740b5b8ed89f03e9d90a98ff0aaf43dd17848
+SHA1 (patch-i3bar_src_child.c) = 7fb302dbe263c59dd33e9b198c7f479df189ee1f
+SHA1 (patch-meson.build) = 89ec2c7f594f8f13c13b522c7635cb59626554af
SHA1 (patch-src_config.c) = 7985366b892f240379daa19d9b7baeddb22f66ee
+SHA1 (patch-src_ipc.c) = 0e8961d8da4b55fca4f207829f6e26deffa3c47c
+SHA1 (patch-src_load__layout.c) = 35ab682dd326c3a8ad00337321305eda52924feb
SHA1 (patch-src_log.c) = 19b33b43d1716ead4bad36e2afd52ff30af017c1
+SHA1 (patch-src_util.c) = 6285072f4d0d385bb1d3868a2a5574bd6f375fdc
diff --git a/i3/patches/patch-i3-config-wizard_main.c b/i3/patches/patch-i3-config-wizard_main.c
new file mode 100644
index 0000000000..03fbd9e8a7
--- /dev/null
+++ b/i3/patches/patch-i3-config-wizard_main.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Fix ctype(3) usage.
+https://github.com/i3/i3/issues/6566
+
+--- i3-config-wizard/main.c.orig 2025-12-19 07:19:53.000000000 +0000
++++ i3-config-wizard/main.c
+@@ -732,7 +732,7 @@ static void finish(void) {
+
+ /* Skip leading whitespace */
+ char *walk = line;
+- while (isspace(*walk) && walk < (line + len)) {
++ while (isspace((unsigned char)*walk) && walk < (line + len)) {
+ /* Pre-output the skipped whitespaces to keep proper indentation */
+ fputc(*walk, ks_config);
+ walk++;
diff --git a/i3/patches/patch-i3bar_src_child.c b/i3/patches/patch-i3bar_src_child.c
new file mode 100644
index 0000000000..ebab3bf507
--- /dev/null
+++ b/i3/patches/patch-i3bar_src_child.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Fix ctype(3) usage.
+https://github.com/i3/i3/issues/6566
+
+--- i3bar/src/child.c.orig 2025-12-19 07:19:53.000000000 +0000
++++ i3bar/src/child.c
+@@ -525,7 +525,7 @@ static void stdin_io_first_line_cb(int f
+
+ static bool isempty(char *s) {
+ while (*s != '\0') {
+- if (!isspace(*s)) {
++ if (!isspace((unsigned char)*s)) {
+ return false;
+ }
+ s++;
diff --git a/i3/patches/patch-meson.build b/i3/patches/patch-meson.build
index 6f9f04bbe3..784b353c07 100644
--- a/i3/patches/patch-meson.build
+++ b/i3/patches/patch-meson.build
@@ -2,6 +2,9 @@ $NetBSD: patch-meson.build,v 1.1 2021/09/12 07:22:47 nia Exp $
Install config files to examples, per pkgsrc policy.
+Check for uselocale() before using it.
+https://github.com/i3/i3/issues/6566
+
--- meson.build.orig 2021-02-27 09:37:58.753311900 +0000
+++ meson.build
@@ -44,7 +44,7 @@ else
@@ -13,7 +16,15 @@ Install config files to examples, per pkgsrc policy.
if get_option('b_sanitize').split(',').contains('address')
cdata.set('I3_ASAN_ENABLED', 1)
-@@ -580,7 +580,7 @@ install_data(
+@@ -52,6 +52,7 @@ endif
+
+ cdata.set('HAVE_STRNDUP', cc.has_function('strndup'))
+ cdata.set('HAVE_MKDIRP', cc.has_function('mkdirp'))
++cdata.set('HAVE_USELOCALE', cc.has_function('uselocale'))
+
+ # Instead of generating config.h directly, make vcs_tag generate it so that
+ # @VCS_TAG@ is replaced.
+@@ -580,7 +581,7 @@ install_data(
install_subdir(
'etc',
strip_directory: true,
diff --git a/i3/patches/patch-src_ipc.c b/i3/patches/patch-src_ipc.c
new file mode 100644
index 0000000000..68248393a0
--- /dev/null
+++ b/i3/patches/patch-src_ipc.c
@@ -0,0 +1,123 @@
+$NetBSD$
+
+Check for uselocale() before using it.
+https://github.com/i3/i3/issues/6566
+
+--- src/ipc.c.orig 2025-12-19 07:19:53.000000000 +0000
++++ src/ipc.c
+@@ -909,11 +909,18 @@ static void dump_bar_config(yajl_gen gen
+ }
+
+ IPC_HANDLER(tree) {
++#if HAVE_USELOCALE
+ locale_t prev_locale = uselocale(numericC);
++#else
++ setlocale(LC_NUMERIC, "C");
++#endif
+ yajl_gen gen = ygenalloc();
+ dump_node(gen, croot, false);
++#if HAVE_USELOCALE
+ uselocale(prev_locale);
+-
++#else
++ setlocale(LC_NUMERIC, "");
++#endif
+ const unsigned char *payload;
+ ylength length;
+ y(get_buf, &payload, &length);
+@@ -1585,7 +1592,11 @@ ipc_client *ipc_new_client_on_fd(EV_P_ i
+ * generator. Free with yajl_gen_free().
+ */
+ yajl_gen ipc_marshal_workspace_event(const char *change, Con *current, Con *old) {
++#if HAVE_USELOCALE
+ locale_t prev_locale = uselocale(numericC);
++#else
++ setlocale(LC_NUMERIC, "C");
++#endif
+ yajl_gen gen = ygenalloc();
+
+ y(map_open);
+@@ -1609,7 +1620,11 @@ yajl_gen ipc_marshal_workspace_event(con
+
+ y(map_close);
+
++#if HAVE_USELOCALE
+ uselocale(prev_locale);
++#else
++ setlocale(LC_NUMERIC, "");
++#endif
+
+ return gen;
+ }
+@@ -1639,7 +1654,11 @@ void ipc_send_window_event(const char *p
+ DLOG("Issue IPC window %s event (con = %p, window = 0x%08x)\n",
+ property, con, (con->window ? con->window->id : XCB_WINDOW_NONE));
+
++#if HAVE_USELOCALE
+ locale_t prev_locale = uselocale(numericC);
++#else
++ setlocale(LC_NUMERIC, "C");
++#endif
+ yajl_gen gen = ygenalloc();
+
+ y(map_open);
+@@ -1658,7 +1677,11 @@ void ipc_send_window_event(const char *p
+
+ ipc_send_event("window", I3_IPC_EVENT_WINDOW, (const char *)payload);
+ y(free);
++#if HAVE_USELOCALE
+ uselocale(prev_locale);
++#else
++ setlocale(LC_NUMERIC, "");
++#endif
+ }
+
+ /*
+@@ -1666,7 +1689,11 @@ void ipc_send_window_event(const char *p
+ */
+ void ipc_send_barconfig_update_event(Barconfig *barconfig) {
+ DLOG("Issue barconfig_update event for id = %s\n", barconfig->id);
++#if HAVE_USELOCALE
+ locale_t prev_locale = uselocale(numericC);
++#else
++ setlocale(LC_NUMERIC, "C");
++#endif
+ yajl_gen gen = ygenalloc();
+
+ dump_bar_config(gen, barconfig);
+@@ -1677,7 +1704,11 @@ void ipc_send_barconfig_update_event(Bar
+
+ ipc_send_event("barconfig_update", I3_IPC_EVENT_BARCONFIG_UPDATE, (const char *)payload);
+ y(free);
++#if HAVE_USELOCALE
+ uselocale(prev_locale);
++#else
++ setlocale(LC_NUMERIC, "");
++#endif
+ }
+
+ /*
+@@ -1686,7 +1717,11 @@ void ipc_send_barconfig_update_event(Bar
+ void ipc_send_binding_event(const char *event_type, Binding *bind, const char *modename) {
+ DLOG("Issue IPC binding %s event (sym = %s, code = %d)\n", event_type, bind->symbol, bind->keycode);
+
++#if HAVE_USELOCALE
+ locale_t prev_locale = uselocale(numericC);
++#else
++ setlocale(LC_NUMERIC, "C");
++#endif
+
+ yajl_gen gen = ygenalloc();
+
+@@ -1714,7 +1749,11 @@ void ipc_send_binding_event(const char *
+ ipc_send_event("binding", I3_IPC_EVENT_BINDING, (const char *)payload);
+
+ y(free);
++#if HAVE_USELOCALE
+ uselocale(prev_locale);
++#else
++ setlocale(LC_NUMERIC, "");
++#endif
+ }
+
+ /*
diff --git a/i3/patches/patch-src_load__layout.c b/i3/patches/patch-src_load__layout.c
new file mode 100644
index 0000000000..51d1eb96b3
--- /dev/null
+++ b/i3/patches/patch-src_load__layout.c
@@ -0,0 +1,78 @@
+$NetBSD$
+
+Check for uselocale() before using it.
+https://github.com/i3/i3/issues/6566
+
+--- src/load_layout.c.orig 2025-12-19 07:19:53.000000000 +0000
++++ src/load_layout.c
+@@ -634,14 +634,22 @@ bool json_validate(const char *buf, cons
+ /* Allow multiple values, i.e. multiple nodes to attach */
+ yajl_config(hand, yajl_allow_multiple_values, true);
+
++#if HAVE_USELOCALE
+ locale_t prev_locale = uselocale(numericC);
++#else
++ setlocale(LC_NUMERIC, "C");
++#endif
+ if (yajl_parse(hand, (const unsigned char *)buf, len) != yajl_status_ok) {
+ unsigned char *str = yajl_get_error(hand, 1, (const unsigned char *)buf, len);
+ ELOG("JSON parsing error: %s\n", str);
+ yajl_free_error(hand, str);
+ valid = false;
+ }
++#if HAVE_USELOCALE
+ uselocale(prev_locale);
++#else
++ setlocale(LC_NUMERIC, "");
++#endif
+
+ yajl_complete_parse(hand);
+ yajl_free(hand);
+@@ -671,7 +679,11 @@ json_content_t json_determine_content(co
+ yajl_config(hand, yajl_allow_comments, true);
+ /* Allow multiple values, i.e. multiple nodes to attach */
+ yajl_config(hand, yajl_allow_multiple_values, true);
++#if HAVE_USELOCALE
+ locale_t prev_locale = uselocale(numericC);
++#else
++ setlocale(LC_NUMERIC, "C");
++#endif
+ const yajl_status stat = yajl_parse(hand, (const unsigned char *)buf, len);
+ if (stat != yajl_status_ok && stat != yajl_status_client_canceled) {
+ unsigned char *str = yajl_get_error(hand, 1, (const unsigned char *)buf, len);
+@@ -679,7 +691,11 @@ json_content_t json_determine_content(co
+ yajl_free_error(hand, str);
+ }
+
++#if HAVE_USELOCALE
+ uselocale(prev_locale);
++#else
++ setlocale(LC_NUMERIC, "");
++#endif
+ yajl_complete_parse(hand);
+ yajl_free(hand);
+
+@@ -725,7 +741,11 @@ void tree_append_json(Con *con, const ch
+ parsing_geometry = false;
+ parsing_focus = false;
+ parsing_marks = false;
++#if HAVE_USELOCALE
+ locale_t prev_locale = uselocale(numericC);
++#else
++ setlocale(LC_NUMERIC, "C");
++#endif
+ const yajl_status stat = yajl_parse(hand, (const unsigned char *)buf, len);
+ if (stat != yajl_status_ok) {
+ unsigned char *str = yajl_get_error(hand, 1, (const unsigned char *)buf, len);
+@@ -750,7 +770,11 @@ void tree_append_json(Con *con, const ch
+ * next time. */
+ con_fix_percent(con);
+
++#if HAVE_USELOCALE
+ uselocale(prev_locale);
++#else
++ setlocale(LC_NUMERIC, "");
++#endif
+ yajl_complete_parse(hand);
+ yajl_free(hand);
+
diff --git a/i3/patches/patch-src_util.c b/i3/patches/patch-src_util.c
new file mode 100644
index 0000000000..1f6ab54236
--- /dev/null
+++ b/i3/patches/patch-src_util.c
@@ -0,0 +1,38 @@
+$NetBSD$
+
+Check for uselocale() before using it.
+Fix ctype(3) abuse.
+https://github.com/i3/i3/issues/6566
+
+--- src/util.c.orig 2025-12-19 07:19:53.000000000 +0000
++++ src/util.c
+@@ -67,7 +67,7 @@ __attribute__((__const__)) bool rect_equ
+ __attribute__((pure)) bool name_is_digits(const char *name) {
+ /* positive integers and zero are interpreted as numbers */
+ for (size_t i = 0; i < strlen(name); i++) {
+- if (!isdigit(name[i])) {
++ if (!isdigit((unsigned char)name[i])) {
+ return false;
+ }
+ }
+@@ -221,12 +221,20 @@ static char **add_argument(char **origin
+ #define ystr(str) yajl_gen_string(gen, (unsigned char *)str, strlen(str))
+
+ static char *store_restart_layout(void) {
++#if HAVE_USELOCALE
+ locale_t prev_locale = uselocale(numericC);
++#else
++ setlocale(LC_NUMERIC, "C");
++#endif
+ yajl_gen gen = yajl_gen_alloc(NULL);
+
+ dump_node(gen, croot, true);
+
++#if HAVE_USELOCALE
+ uselocale(prev_locale);
++#else
++ setlocale(LC_NUMERIC, "");
++#endif
+
+ const unsigned char *payload;
+ size_t length;
Home |
Main Index |
Thread Index |
Old Index