aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorJosselin Poiret <dev@jpoiret.xyz>2024-03-09 09:29:30 +0100
committerLudovic Courtès <ludo@gnu.org>2024-08-31 10:44:56 +0200
commitf8066e37042e475fe63b935c2b6155538b20a6de (patch)
tree02285f116419f8b13fba8f015088827a67f23ca2 /gnu
parent2008a30d4c2ee021481f5074a643833257c73473 (diff)
downloadguix-f8066e37042e475fe63b935c2b6155538b20a6de.tar.gz
guix-f8066e37042e475fe63b935c2b6155538b20a6de.zip
gnu: glibc: Fix locpath patches.
* gnu/packages/patches/glibc-2.37-versioned-locpath.patch: * gnu/packages/patches/glibc-versioned-locpath.patch: Unconditionally add the system default locale directory. Also clean up argz list use. Change-Id: I8de5544b2382ee9b17d41ad2cfe940de804c47dd
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/patches/glibc-2.37-versioned-locpath.patch37
-rw-r--r--gnu/packages/patches/glibc-versioned-locpath.patch35
2 files changed, 27 insertions, 45 deletions
diff --git a/gnu/packages/patches/glibc-2.37-versioned-locpath.patch b/gnu/packages/patches/glibc-2.37-versioned-locpath.patch
index 1f34292ad0..1796a8a720 100644
--- a/gnu/packages/patches/glibc-2.37-versioned-locpath.patch
+++ b/gnu/packages/patches/glibc-2.37-versioned-locpath.patch
@@ -70,12 +70,12 @@ diff --git a/locale/setlocale.c b/locale/setlocale.c
index 6a902faa..2d07a644 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
-@@ -213,12 +213,71 @@ setdata (int category, struct __locale_data *data)
+@@ -213,12 +213,60 @@ setdata (int category, struct __locale_data *data)
}
}
+/* Return in *LOCALE_PATH and *LOCALE_PATH_LEN the locale data search path as
-+ a colon-separated list. Return ENOMEN on error, zero otherwise. */
++ an argz list. Return ENOMEN on error, zero otherwise. */
+error_t
+compute_locale_search_path (char **locale_path, size_t *locale_path_len)
+{
@@ -87,8 +87,8 @@ index 6a902faa..2d07a644 100644
+ /* Entries in 'GUIX_LOCPATH' take precedence over 'LOCPATH'. These
+ entries are systematically prefixed with "/X.Y" where "X.Y" is the
+ libc version. */
-+ if (__argz_create_sep (guix_locpath_var, ':',
-+ locale_path, locale_path_len) != 0
++ if (__argz_add_sep (locale_path, locale_path_len,
++ guix_locpath_var, ':') != 0
+ || __argz_suffix_entries (locale_path, locale_path_len,
+ "/" VERSION) != 0)
+ goto bail_out;
@@ -96,32 +96,21 @@ index 6a902faa..2d07a644 100644
+
+ if (locpath_var != NULL && locpath_var[0] != '\0')
+ {
-+ char *reg_locale_path = NULL;
-+ size_t reg_locale_path_len = 0;
-+
-+ if (__argz_create_sep (locpath_var, ':',
-+ &reg_locale_path, &reg_locale_path_len) != 0)
-+ goto bail_out;
-+
-+ if (__argz_append (locale_path, locale_path_len,
-+ reg_locale_path, reg_locale_path_len) != 0)
++ if (__argz_add_sep (locale_path, locale_path_len,
++ locpath_var, ':') != 0)
+ goto bail_out;
+
-+ free (reg_locale_path);
+ }
+
-+ if (*locale_path != NULL)
-+ {
-+ /* Append the system default locale directory. */
-+ if (__argz_add_sep (locale_path, locale_path_len,
-+ _nl_default_locale_path, ':') != 0)
-+ goto bail_out;
-+ }
++ /* Append the system default locale directory. */
++ if (__argz_add_sep (locale_path, locale_path_len,
++ _nl_default_locale_path, ':') != 0)
++ goto bail_out;
+
+ /* Last, unconditionally append our own locale directory, which should
+ contain data for C.UTF-8. */
+ if (__argz_add_sep (locale_path, locale_path_len,
-+ LOCALEDIR "/" VERSION, ':') != 0)
++ LOCALEDIR "/" VERSION, ':') != 0)
+ goto bail_out;
+
+ return 0;
@@ -181,7 +170,7 @@ new file mode 100644
index 00000000..505b0f24
--- /dev/null
+++ b/string/argz-suffix.c
-@@ -0,0 +1,56 @@
+@@ -0,0 +1,58 @@
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ludovic Courtès <ludo@gnu.org>.
@@ -213,6 +202,8 @@ index 00000000..505b0f24
+ size_t suffix_len = strlen (suffix);
+ size_t count = __argz_count (*argz, *argz_len);
+ size_t new_argz_len = *argz_len + count * suffix_len;
++ if (new_argz_len == 0)
++ return 0;
+ char *new_argz = malloc (new_argz_len);
+
+ if (new_argz)
diff --git a/gnu/packages/patches/glibc-versioned-locpath.patch b/gnu/packages/patches/glibc-versioned-locpath.patch
index bc7652127f..8702531934 100644
--- a/gnu/packages/patches/glibc-versioned-locpath.patch
+++ b/gnu/packages/patches/glibc-versioned-locpath.patch
@@ -54,12 +54,12 @@ diff --git a/locale/setlocale.c b/locale/setlocale.c
index ead030d..0c0e314 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
-@@ -215,12 +215,65 @@ setdata (int category, struct __locale_data *data)
+@@ -215,12 +215,54 @@ setdata (int category, struct __locale_data *data)
}
}
+/* Return in *LOCALE_PATH and *LOCALE_PATH_LEN the locale data search path as
-+ a colon-separated list. Return ENOMEN on error, zero otherwise. */
++ an argz list. Return ENOMEN on error, zero otherwise. */
+error_t
+compute_locale_search_path (char **locale_path, size_t *locale_path_len)
+{
@@ -71,8 +71,8 @@ index ead030d..0c0e314 100644
+ /* Entries in 'GUIX_LOCPATH' take precedence over 'LOCPATH'. These
+ entries are systematically prefixed with "/X.Y" where "X.Y" is the
+ libc version. */
-+ if (__argz_create_sep (guix_locpath_var, ':',
-+ locale_path, locale_path_len) != 0
++ if (__argz_add_sep (locale_path, locale_path_len,
++ guix_locpath_var, ':') != 0
+ || __argz_suffix_entries (locale_path, locale_path_len,
+ "/" VERSION) != 0)
+ goto bail_out;
@@ -80,27 +80,16 @@ index ead030d..0c0e314 100644
+
+ if (locpath_var != NULL && locpath_var[0] != '\0')
+ {
-+ char *reg_locale_path = NULL;
-+ size_t reg_locale_path_len = 0;
-+
-+ if (__argz_create_sep (locpath_var, ':',
-+ &reg_locale_path, &reg_locale_path_len) != 0)
-+ goto bail_out;
-+
-+ if (__argz_append (locale_path, locale_path_len,
-+ reg_locale_path, reg_locale_path_len) != 0)
++ if (__argz_add_sep (locale_path, locale_path_len,
++ locpath_var, ':') != 0)
+ goto bail_out;
+
-+ free (reg_locale_path);
+ }
+
-+ if (*locale_path != NULL)
-+ {
-+ /* Append the system default locale directory. */
-+ if (__argz_add_sep (locale_path, locale_path_len,
-+ _nl_default_locale_path, ':') != 0)
-+ goto bail_out;
-+ }
++ /* Append the system default locale directory. */
++ if (__argz_add_sep (locale_path, locale_path_len,
++ _nl_default_locale_path, ':') != 0)
++ goto bail_out;
+
+ return 0;
+
@@ -160,7 +149,7 @@ new file mode 100644
index 0000000..505b0f2
--- /dev/null
+++ b/string/argz-suffix.c
-@@ -0,0 +1,56 @@
+@@ -0,0 +1,58 @@
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ludovic Courtès <ludo@gnu.org>.
@@ -192,6 +181,8 @@ index 0000000..505b0f2
+ size_t suffix_len = strlen (suffix);
+ size_t count = __argz_count (*argz, *argz_len);
+ size_t new_argz_len = *argz_len + count * suffix_len;
++ if (new_argz_len == 0)
++ return 0;
+ char *new_argz = malloc (new_argz_len);
+
+ if (new_argz)