provide locale-gen and /etc/locale.gen mechanism to generate /usr/lib/locale-archive

provide C.utf8 as always preinstalled locale
add glibc-common and integrate glibc-i18n, obsolete locales
provide preprocessed locales in glibc-locales [release 2.40-3mamba;Fri Oct 11 2024]
This commit is contained in:
Silvan Calarco 2024-10-12 21:41:43 +02:00
parent fd5b4a5a5a
commit a6c28131e0
20 changed files with 163 additions and 1041 deletions

View File

@ -1,37 +0,0 @@
diff -Nru glibc-2.10.1.orig/configure glibc-2.10.1/configure
--- glibc-2.10.1.orig/configure 2009-05-17 14:19:31.000000000 +0200
+++ glibc-2.10.1/configure 2009-11-03 19:44:54.000000000 +0100
@@ -4839,7 +4839,7 @@
ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[3-9]*)
+ 2.2[0-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
@@ -4902,7 +4902,7 @@
ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[3-9]*)
+ 2.2[0-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
diff -Nru glibc-2.10.1.orig/configure.in glibc-2.10.1/configure.in
--- glibc-2.10.1.orig/configure.in 2009-04-04 01:51:47.000000000 +0200
+++ glibc-2.10.1/configure.in 2009-11-03 19:44:33.000000000 +0100
@@ -897,10 +897,10 @@
# Accept binutils 2.13 or newer.
AC_CHECK_PROG_VER(AS, $AS, --version,
[GNU assembler.* \([0-9]*\.[0-9.]*\)],
- [2.1[3-9]*], AS=: critic_missing="$critic_missing as")
+ [2.2[0-9]*], AS=: critic_missing="$critic_missing as")
AC_CHECK_PROG_VER(LD, $LD, --version,
[GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
- [2.1[3-9]*], LD=: critic_missing="$critic_missing ld")
+ [2.2[0-9]*], LD=: critic_missing="$critic_missing ld")
# We need the physical current working directory. We cannot use the
# "pwd -P" shell builtin since that's not portable. Instead we try to

View File

@ -1,31 +0,0 @@
diff -Naur glibc-2.11.1-orig/nptl/sysdeps/pthread/pt-initfini.c
glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c
--- glibc-2.11.1-orig/nptl/sysdeps/pthread/pt-initfini.c 2009-12-08 20:10:20.000000000 +0000
+++ glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c 2010-04-17 02:24:02.000000000 +0100
@@ -45,6 +45,11 @@
/* Embed an #include to pull in the alignment and .end directives. */
asm ("\n#include \"defs.h\"");
+asm ("\n#if defined __i686 && defined __ASSEMBLER__");
+asm ("\n#undef __i686");
+asm ("\n#define __i686 __i686");
+asm ("\n#endif");
+
/* The initial common code ends here. */
asm ("\n/*...@header_ends*/");
diff -Naur glibc-2.11.1-orig/sysdeps/unix/sysv/linux/i386/sysdep.h
glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h
--- glibc-2.11.1-orig/sysdeps/unix/sysv/linux/i386/sysdep.h 2009-12-08 20:10:20.000000000 +0000
+++ glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h 2010-04-17 02:24:02.000000000 +0100
@@ -29,6 +29,10 @@
#include <dl-sysdep.h>
#include <tls.h>
+#if defined __i686 && defined __ASSEMBLER__
+#undef __i686
+#define __i686 __i686
+#endif
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h

View File

@ -1,39 +0,0 @@
From 25b3aadaf646bff18d6527e03717c87bf50b3a50 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Tue, 28 Sep 2010 15:11:48 +0200
Subject: [PATCH] Don't try to write to _rtld_global_ro after performing relro protection
---
ChangeLog | 5 +++++
elf/rtld.c | 8 ++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/elf/rtld.c b/elf/rtld.c
index 9a560b3..201c9cf 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2168,6 +2168,10 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
we need it in the memory handling later. */
GLRO(dl_initial_searchlist) = *GL(dl_ns)[LM_ID_BASE]._ns_main_searchlist;
+ /* Remember the last search directory added at startup, now that
+ malloc will no longer be the one from dl-minimal.c. */
+ GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
+
if (prelinked)
{
if (main_map->l_info [ADDRIDX (DT_GNU_CONFLICT)] != NULL)
@@ -2288,10 +2292,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
lossage);
}
- /* Remember the last search directory added at startup, now that
- malloc will no longer be the one from dl-minimal.c. */
- GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
-
if (! prelinked && rtld_multiple_ref)
{
/* There was an explicit ref to the dynamic linker as a shared lib.
--
1.7.3.4

View File

@ -1,22 +0,0 @@
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 97142b7..a001c1e 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -549,7 +549,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
ns, ansp, ansp2, nansp2, resplen2);
if (n < 0)
return (-1);
- if (n == 0 && (buf2 == NULL || resplen2 == 0))
+ if (n == 0 && (buf2 == NULL || *resplen2 == 0))
goto next_ns;
} else {
/* Use datagrams. */
@@ -559,7 +559,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
ansp2, nansp2, resplen2);
if (n < 0)
return (-1);
- if (n == 0 && (buf2 == NULL || resplen2 == 0))
+ if (n == 0 && (buf2 == NULL || *resplen2 == 0))
goto next_ns;
if (v_circuit)
// XXX Check whether both requests failed or

View File

@ -1,56 +0,0 @@
--- glibc-2.14/nis/Makefile
+++ glibc-2.14-2/nis/Makefile
@@ -23,9 +23,9 @@ subdir := nis
aux := nis_hash
+headers := $(wildcard rpcsvc/*.[hx])
distribute := nss-nis.h nss-nisplus.h nis_intern.h Banner \
- nisplus-parser.h nis_xdr.h nss \
- $(wildcard rpcsvc/*.[hx])
+ nisplus-parser.h nis_xdr.h nss
# These are the databases available for the nis (and perhaps later nisplus)
# service. This must be a superset of the services in nss.
@@ -69,6 +69,8 @@ libnss_nisplus-inhibit-o = $(filter-out .os,$(object-suffixes))
include ../Rules
+CFLAGS-nis_findserv.c += -fno-strict-aliasing
+CFLAGS-ypclnt.c += -fno-strict-aliasing
$(objpfx)libnss_compat.so: $(objpfx)libnsl.so$(libnsl.so-version)
$(objpfx)libnss_nis.so: $(objpfx)libnsl.so$(libnsl.so-version) \
--- glibc-2.14/sunrpc/Makefile
+++ glibc-2.14-2/sunrpc/Makefile
@@ -53,7 +53,7 @@ headers-in-tirpc = $(addprefix rpc/,auth.h auth_unix.h clnt.h pmap_clnt.h \
des_crypt.h)
headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \
$(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
-headers = rpc/netdb.h
+headers = rpc/netdb.h $(headers-in-tirpc) $(headers-not-in-tirpc)
install-others = $(inst_sysconfdir)/rpc
generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
$(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
@@ -152,6 +152,10 @@ CFLAGS-openchild.c = -fexceptions
CPPFLAGS += -D_RPC_THREAD_SAFE_
+CFLAGS-clnt_tcp.c += -fno-strict-aliasing
+CFLAGS-clnt_udp.c += -fno-strict-aliasing
+CFLAGS-clnt_unix.c += -fno-strict-aliasing
+
$(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
$(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
$(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -635,7 +635,7 @@ for linking")
# define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libc_hidden_def(name) hidden_def (name)
# define libc_hidden_weak(name) hidden_weak (name)
-# define libc_hidden_nolink(name, version) hidden_nolink (name, libc, version)
+# define libc_hidden_nolink(name, version) hidden_def (name)
# define libc_hidden_ver(local, name) hidden_ver (local, name)
# define libc_hidden_data_def(name) hidden_data_def (name)
# define libc_hidden_data_weak(name) hidden_data_weak (name)

View File

@ -1,118 +0,0 @@
On Monday, June 06, 2011 13:00:50 Mike Frysinger wrote:
> On Monday, June 06, 2011 04:51:29 Andreas Schwab wrote:
> > Paweł Sikora <pluto@agmk.net> writes:
> > > git bisect shows first bad commit:
> > >
> > > 4bff6e0175ed195871f4e01cc4c4c33274b8f6e3 is the first bad commit
> > > commit 4bff6e0175ed195871f4e01cc4c4c33274b8f6e3
> > > Author: Andreas Schwab <schwab@redhat.com>
> > > Date: Fri Feb 25 20:49:48 2011 -0500
> > >
> > > Fix memory leak in dlopen with RTLD_NOLOAD.
> >
> > See <http://sourceware.org/ml/libc-hacker/2010-09/msg00009.html> and
> > <http://sourceware.org/ml/libc-hacker/2011-02/msg00004.html> for the
> > original, working patches.
>
> thanks, i'm seeing basically the same crash with the mpd server (music
> daemon)
in case it's helpful to someone else, this is the patch i'm using
-mike
partially revert 4bff6e0175ed195871f4e01cc4c4c33274b8f6e3
http://sourceware.org/ml/libc-alpha/2011-06/msg00006.html
--- a/elf/dl-libc.c
+++ b/elf/dl-libc.c
@@ -279,6 +279,10 @@ libc_freeres_fn (free_mem)
if (! old->dont_free)
free (old);
}
+
+ /* Free the initfini dependency list. */
+ if (l->l_free_initfini)
+ free (l->l_initfini);
}
if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2240,6 +2240,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
lnp->dont_free = 1;
lnp = lnp->next;
}
+ l->l_free_initfini = 0;
if (l != &GL(dl_rtld_map))
_dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -119,17 +119,8 @@ _dl_close_worker (struct link_map *map)
if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
|| dl_close_state != not_pending)
{
- if (map->l_direct_opencount == 0)
- {
- if (map->l_type == lt_loaded)
- dl_close_state = rerun;
- else if (map->l_type == lt_library)
- {
- struct link_map **oldp = map->l_initfini;
- map->l_initfini = map->l_orig_initfini;
- _dl_scope_free (oldp);
- }
- }
+ if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
+ dl_close_state = rerun;
/* There are still references to this object. Do nothing more. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -478,6 +478,7 @@ _dl_map_object_deps (struct link_map *map,
nneeded * sizeof needed[0]);
atomic_write_barrier ();
l->l_initfini = l_initfini;
+ l->l_free_initfini = 1;
}
/* If we have no auxiliary objects just go on to the next map. */
@@ -662,6 +663,7 @@ Filters not supported with LD_TRACE_PRELINKING"));
l_initfini[nlist] = NULL;
atomic_write_barrier ();
map->l_initfini = l_initfini;
+ map->l_free_initfini = 1;
if (l_reldeps != NULL)
{
atomic_write_barrier ();diff --git a/include/link.h b/include/link.h
@@ -686,5 +686,5 @@ Filters not supported with LD_TRACE_PRELINKING"));
_dl_scope_free (old_l_reldeps);
}
if (old_l_initfini != NULL)
- map->l_orig_initfini = old_l_initfini;
+ _dl_scope_free (old_l_initfini);
--- a/include/link.h
+++ b/include/link.h
@@ -192,6 +192,9 @@ struct link_map
during LD_TRACE_PRELINKING=1
contains any DT_SYMBOLIC
libraries. */
+ unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be
+ freed, ie. not allocated with
+ the dummy malloc in ld.so. */
/* Collected information about own RPATH directories. */
struct r_search_path_struct l_rpath_dirs;
@@ -240,9 +240,6 @@ struct link_map
/* List of object in order of the init and fini calls. */
struct link_map **l_initfini;
- /* The init and fini list generated at startup, saved when the
- object is also loaded dynamically. */
- struct link_map **l_orig_initfini;
/* List of the dependencies introduced through symbol binding. */
struct link_map_reldeps

View File

@ -1,11 +0,0 @@
--- glibc-2.16.0.orig/manual/texinfo.tex 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/manual/texinfo.tex 2012-07-02 01:11:41.500955548 +0200
@@ -1107,7 +1107,7 @@
% #1 is a control sequence in which to do the replacements,
% which we \xdef.
\def\txiescapepdf#1{%
- \ifx\pdfescapestring\relax
+ \ifx\pdfescapestring\thisisundefined
% No primitive available; should we give a warning or log?
% Many times it won't matter.
\else

View File

@ -1,66 +0,0 @@
--- glibc-2.25/resolv/compat-gethnamaddr.c.orig 2017-07-23 16:16:44.843366630 +0200
+++ glibc-2.25/resolv/compat-gethnamaddr.c 2017-07-23 16:17:41.948589454 +0200
@@ -441,7 +441,6 @@
}
return (res_gethostbyname2(name, AF_INET));
}
-compat_symbol (libresolv, res_gethostbyname, res_gethostbyname, GLIBC_2_0);
struct hostent *
res_gethostbyname2 (const char *name, int af)
@@ -573,7 +572,6 @@
return ret;
}
libresolv_hidden_def (res_gethostbyname2)
-compat_symbol (libresolv, res_gethostbyname2, res_gethostbyname2, GLIBC_2_0);
struct hostent *
res_gethostbyaddr (const void *addr, socklen_t len, int af)
@@ -673,7 +671,6 @@
__set_h_errno (NETDB_SUCCESS);
return (hp);
}
-compat_symbol (libresolv, res_gethostbyaddr, res_gethostbyaddr, GLIBC_2_0);
void
_sethtent (int f)
@@ -685,7 +682,6 @@
stayopen = f;
}
libresolv_hidden_def (_sethtent)
-compat_symbol (libresolv, _sethtent, _sethtent, GLIBC_2_0);
static void
_endhtent (void)
@@ -761,7 +757,6 @@
return (&host);
}
libresolv_hidden_def (_gethtent)
-compat_symbol (libresolv, _gethtent, _gethtent, GLIBC_2_0);
struct hostent *
_gethtbyname (const char *name)
@@ -775,7 +770,6 @@
}
return (_gethtbyname2(name, AF_INET));
}
-compat_symbol (libresolv, _gethtbyname, _gethtbyname, GLIBC_2_0);
struct hostent *
_gethtbyname2 (const char *name, int af)
@@ -798,7 +792,6 @@
return (p);
}
libresolv_hidden_def (_gethtbyname2)
-compat_symbol (libresolv, _gethtbyname2, _gethtbyname2, GLIBC_2_0);
struct hostent *
_gethtbyaddr (const char *addr, size_t len, int af)
@@ -813,7 +806,6 @@
return (p);
}
libresolv_hidden_def (_gethtbyaddr)
-compat_symbol (libresolv, _gethtbyaddr, _gethtbyaddr, GLIBC_2_0);
static void
map_v4v6_address (const char *src, char *dst)

View File

@ -1,38 +0,0 @@
diff -Nru glibc-2.4.orig/manual/arith.texi glibc-2.4/manual/arith.texi
--- glibc-2.4.orig/manual/arith.texi 2004-10-06 05:02:14.000000000 +0200
+++ glibc-2.4/manual/arith.texi 2006-06-09 13:14:46.000000000 +0200
@@ -778,8 +778,7 @@
@comment fenv.h
@comment ISO
-@deftypefun int fesetexceptflag (const fexcept_t *@var{flagp}, int
-@var{excepts})
+@deftypefun int fesetexceptflag (const fexcept_t *@var{flagp}, int@var{excepts})
This function restores the flags for the exceptions indicated by
@var{excepts} to the values stored in the variable pointed to by
@var{flagp}.
diff -Nru glibc-2.4.orig/manual/errno.texi glibc-2.4/manual/errno.texi
--- glibc-2.4.orig/manual/errno.texi 2005-12-24 21:21:03.000000000 +0100
+++ glibc-2.4/manual/errno.texi 2006-06-09 13:14:46.000000000 +0200
@@ -1494,7 +1494,7 @@
@comment error.h
@comment GNU
-@deftypevar {void (*} error_print_progname ) (void)
+@deftypevar {void *} error_print_progname (void)
If the @code{error_print_progname} variable is defined to a non-zero
value the function pointed to is called by @code{error} or
@code{error_at_line}. It is expected to print the program name or do
diff -Nru glibc-2.4.orig/manual/sysinfo.texi glibc-2.4/manual/sysinfo.texi
--- glibc-2.4.orig/manual/sysinfo.texi 2003-11-29 07:38:43.000000000 +0100
+++ glibc-2.4/manual/sysinfo.texi 2006-06-09 13:14:46.000000000 +0200
@@ -1066,8 +1066,7 @@
@comment sysctl.h
@comment BSD
-@deftypefun int sysctl (int *@var{names}, int @var{nlen}, void *@var{oldval},
- size_t *@var{oldlenp}, void *@var{newval}, size_t @var{newlen})
+@deftypefun int sysctl (int *@var{names}, int @var{nlen}, void *@var{oldval},size_t *@var{oldlenp}, void *@var{newval}, size_t @var{newlen})
@code{sysctl} gets or sets a specified system parameter. There are so
many of these parameters that it is not practical to list them all here,

View File

@ -1,361 +0,0 @@
Submitted By: Robert Connolly <robert at linuxfromscratch dot org> (ashes)
Date: 2007-10-07
Initial Package Version: 2.6.1
Upstream Status: Rejected Upstream
http://sources.redhat.com/ml/libc-alpha/2000-08/msg00052.html
Origin: OpenBSD, then see the url above, the ported to Owl/Openwall.
http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/glibc/\
glibc-2.3.5-openbsd-strlcpy-strlcat.diff
Then I retrieved the latest copies of strlcat.c and strlcpy.c from OpenBSD-cvs,
which had trivial changes.
Description: http://www.courtesan.com/todd/papers/strlcpy.html
diff -Naur glibc-2.6.1.orig/manual/strlcpy.3 glibc-2.6.1/manual/strlcpy.3
--- glibc-2.6.1.orig/manual/strlcpy.3 1970-01-01 00:00:00.000000000 +0000
+++ glibc-2.6.1/manual/strlcpy.3 2007-08-04 06:48:03.000000000 +0000
@@ -0,0 +1,186 @@
+.\" $OpenBSD: strlcpy.3,v 1.18 2005/08/06 03:24:19 jaredy Exp $
+.\"
+.\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd June 22, 1998
+.Dt STRLCPY 3
+.Os
+.Sh NAME
+.Nm strlcpy ,
+.Nm strlcat
+.Nd size-bounded string copying and concatenation
+.Sh SYNOPSIS
+.Fd #include <string.h>
+.Ft size_t
+.Fn strlcpy "char *dst" "const char *src" "size_t size"
+.Ft size_t
+.Fn strlcat "char *dst" "const char *src" "size_t size"
+.Sh DESCRIPTION
+The
+.Fn strlcpy
+and
+.Fn strlcat
+functions copy and concatenate strings respectively.
+They are designed
+to be safer, more consistent, and less error prone replacements for
+.Xr strncpy 3
+and
+.Xr strncat 3 .
+Unlike those functions,
+.Fn strlcpy
+and
+.Fn strlcat
+take the full size of the buffer (not just the length) and guarantee to
+NUL-terminate the result (as long as
+.Fa size
+is larger than 0 or, in the case of
+.Fn strlcat ,
+as long as there is at least one byte free in
+.Fa dst ) .
+Note that a byte for the NUL should be included in
+.Fa size .
+Also note that
+.Fn strlcpy
+and
+.Fn strlcat
+only operate on true
+.Dq C
+strings.
+This means that for
+.Fn strlcpy
+.Fa src
+must be NUL-terminated and for
+.Fn strlcat
+both
+.Fa src
+and
+.Fa dst
+must be NUL-terminated.
+.Pp
+The
+.Fn strlcpy
+function copies up to
+.Fa size
+- 1 characters from the NUL-terminated string
+.Fa src
+to
+.Fa dst ,
+NUL-terminating the result.
+.Pp
+The
+.Fn strlcat
+function appends the NUL-terminated string
+.Fa src
+to the end of
+.Fa dst .
+It will append at most
+.Fa size
+- strlen(dst) - 1 bytes, NUL-terminating the result.
+.Sh RETURN VALUES
+The
+.Fn strlcpy
+and
+.Fn strlcat
+functions return the total length of the string they tried to create.
+For
+.Fn strlcpy
+that means the length of
+.Fa src .
+For
+.Fn strlcat
+that means the initial length of
+.Fa dst
+plus
+the length of
+.Fa src .
+While this may seem somewhat confusing, it was done to make
+truncation detection simple.
+.Pp
+Note, however, that if
+.Fn strlcat
+traverses
+.Fa size
+characters without finding a NUL, the length of the string is considered
+to be
+.Fa size
+and the destination string will not be NUL-terminated (since there was
+no space for the NUL).
+This keeps
+.Fn strlcat
+from running off the end of a string.
+In practice this should not happen (as it means that either
+.Fa size
+is incorrect or that
+.Fa dst
+is not a proper
+.Dq C
+string).
+The check exists to prevent potential security problems in incorrect code.
+.Sh EXAMPLES
+The following code fragment illustrates the simple case:
+.Bd -literal -offset indent
+char *s, *p, buf[BUFSIZ];
+
+\&...
+
+(void)strlcpy(buf, s, sizeof(buf));
+(void)strlcat(buf, p, sizeof(buf));
+.Ed
+.Pp
+To detect truncation, perhaps while building a pathname, something
+like the following might be used:
+.Bd -literal -offset indent
+char *dir, *file, pname[MAXPATHLEN];
+
+\&...
+
+if (strlcpy(pname, dir, sizeof(pname)) >= sizeof(pname))
+ goto toolong;
+if (strlcat(pname, file, sizeof(pname)) >= sizeof(pname))
+ goto toolong;
+.Ed
+.Pp
+Since it is known how many characters were copied the first time, things
+can be sped up a bit by using a copy instead of an append:
+.Bd -literal -offset indent
+char *dir, *file, pname[MAXPATHLEN];
+size_t n;
+
+\&...
+
+n = strlcpy(pname, dir, sizeof(pname));
+if (n >= sizeof(pname))
+ goto toolong;
+if (strlcpy(pname + n, file, sizeof(pname) - n) >= sizeof(pname) - n)
+ goto toolong;
+.Ed
+.Pp
+However, one may question the validity of such optimizations, as they
+defeat the whole purpose of
+.Fn strlcpy
+and
+.Fn strlcat .
+As a matter of fact, the first version of this manual page got it wrong.
+.Sh SEE ALSO
+.Xr snprintf 3 ,
+.Xr strncat 3 ,
+.Xr strncpy 3
+.Sh HISTORY
+The
+.Fn strlcpy
+and
+.Fn strlcat
+functions first appeared in
+.Ox 2.4 .
diff -Naur glibc-2.6.1.orig/string/Makefile glibc-2.6.1/string/Makefile
--- glibc-2.6.1.orig/string/Makefile 2007-02-01 16:10:11.000000000 +0000
+++ glibc-2.6.1/string/Makefile 2007-08-04 06:48:35.000000000 +0000
@@ -40,7 +40,12 @@
addsep replace) \
envz basename \
strcoll_l strxfrm_l string-inlines memrchr \
- xpg-strerror strerror_l
+ xpg-strerror strerror_l strlcat strlcpy
+
+# These routines will be omitted from the libc shared object.
+# Instead the static object files will be included in a special archive
+# linked against when the shared library will be used.
+static-only-routines = strlcat strlcpy
# Gcc internally generates calls to unbounded memcpy and memset
# for -fbounded-pointer compiles. Glibc uses memchr for explicit checks.
diff -Naur glibc-2.6.1.orig/string/string.h glibc-2.6.1/string/string.h
--- glibc-2.6.1.orig/string/string.h 2007-02-01 16:08:52.000000000 +0000
+++ glibc-2.6.1/string/string.h 2007-08-04 06:48:03.000000000 +0000
@@ -354,6 +354,24 @@
extern char *strsep (char **__restrict __stringp,
__const char *__restrict __delim)
__THROW __nonnull ((1, 2));
+
+/*
+ * Appends __src to string __dst of size __n (unlike strncat, __n is the
+ * full size of __dst, not space left). At most __n-1 characters
+ * will be copied. Always NUL terminates (unless __n <= strlen(__dst)).
+ * Returns strlen(__src) + MIN(__n, strlen(initial __dst)).
+ * If retval >= __n, truncation occurred.
+ */
+extern size_t strlcat (char *__dst, __const char *__src, size_t __n)
+ __THROW __nonnull ((1, 2));
+
+/*
+ * Copy __src to string __dst of size __n. At most __n-1 characters
+ * will be copied. Always NUL terminates (unless __n == 0).
+ * Returns strlen(__src); if retval >= __n, truncation occurred.
+ */
+extern size_t strlcpy (char *__dst, __const char *__src, size_t __n)
+ __THROW __nonnull ((1, 2));
#endif
#ifdef __USE_GNU
diff -Naur glibc-2.6.1.orig/string/strlcat.c glibc-2.6.1/string/strlcat.c
--- glibc-2.6.1.orig/string/strlcat.c 1970-01-01 00:00:00.000000000 +0000
+++ glibc-2.6.1/string/strlcat.c 2007-08-04 06:48:03.000000000 +0000
@@ -0,0 +1,55 @@
+/* $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */
+
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <string.h>
+
+/*
+ * Appends src to string dst of size siz (unlike strncat, siz is the
+ * full size of dst, not space left). At most siz-1 characters
+ * will be copied. Always NUL terminates (unless siz <= strlen(dst)).
+ * Returns strlen(src) + MIN(siz, strlen(initial dst)).
+ * If retval >= siz, truncation occurred.
+ */
+size_t
+strlcat(char *dst, const char *src, size_t siz)
+{
+ char *d = dst;
+ const char *s = src;
+ size_t n = siz;
+ size_t dlen;
+
+ /* Find the end of dst and adjust bytes left but don't go past end */
+ while (n-- != 0 && *d != '\0')
+ d++;
+ dlen = d - dst;
+ n = siz - dlen;
+
+ if (n == 0)
+ return(dlen + strlen(s));
+ while (*s != '\0') {
+ if (n != 1) {
+ *d++ = *s;
+ n--;
+ }
+ s++;
+ }
+ *d = '\0';
+
+ return(dlen + (s - src)); /* count does not include NUL */
+}
diff -Naur glibc-2.6.1.orig/string/strlcpy.c glibc-2.6.1/string/strlcpy.c
--- glibc-2.6.1.orig/string/strlcpy.c 1970-01-01 00:00:00.000000000 +0000
+++ glibc-2.6.1/string/strlcpy.c 2007-08-04 06:48:03.000000000 +0000
@@ -0,0 +1,51 @@
+/* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */
+
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <string.h>
+
+/*
+ * Copy src to string dst of size siz. At most siz-1 characters
+ * will be copied. Always NUL terminates (unless siz == 0).
+ * Returns strlen(src); if retval >= siz, truncation occurred.
+ */
+size_t
+strlcpy(char *dst, const char *src, size_t siz)
+{
+ char *d = dst;
+ const char *s = src;
+ size_t n = siz;
+
+ /* Copy as many bytes as will fit */
+ if (n != 0) {
+ while (--n != 0) {
+ if ((*d++ = *s++) == '\0')
+ break;
+ }
+ }
+
+ /* Not enough room in dst, add NUL and traverse rest of src */
+ if (n == 0) {
+ if (siz != 0)
+ *d = '\0'; /* NUL-terminate dst */
+ while (*s++)
+ ;
+ }
+
+ return(s - src - 1); /* count does not include NUL */
+}

View File

@ -1,29 +0,0 @@
Submitted By: Tushar Teredesai <tushar@linuxfromscratch.org>
Date: 2008-04-18
Initial Package Version: 2.7
Upstream Status: Fixed
Origin: glibc cvs
Description: Fix compilation with gcc-4.3
===================================================================
RCS file: /cvs/glibc/libc/configure,v
retrieving revision 1.462
retrieving revision 1.463
diff -u -r1.462 -r1.463
--- libc/configure 2008/01/24 20:21:23 1.462
+++ libc/configure 2008/02/01 00:20:07 1.463
@@ -5065,8 +5065,12 @@
# header directory and add that to the list. NOTE: Only does the right
# thing on a system that doesn't need fixincludes. (Not presently a problem.)
if test -n "$sysheaders"; then
- ccheaders=`$CC -print-file-name=include`
- SYSINCLUDES="-nostdinc -isystem $ccheaders \
+ SYSINCLUDES=-nostdinc
+ for d in include include-fixed; do
+ i=`$CC -print-file-name="$d"` && test "x$i" != "x$d" &&
+ SYSINCLUDES="$SYSINCLUDES -isystem $i"
+ done
+ SYSINCLUDES="$SYSINCLUDES \
-isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
if test -n "$CXX"; then
cxxversion=`$CXX -dumpversion 2>&5` &&

View File

@ -1,26 +0,0 @@
2007-11-01 Ryan S. Arnold <rsa@us.ibm.com>
* nptl/sysdeps/unix/sysv/linux/lowlevellock.c
(__lll_timedlock_wait) Wake before returning timeout.
--- glibc-2.7/nptl/sysdeps/unix/sysv/linux/lowlevellock.c 2007-08-14 14:59:34.000000000 -0500
+++ glibc-2.7.new/nptl/sysdeps/unix/sysv/linux/lowlevellock.c 2007-11-01 12:25:49.000000000 -0500
@@ -76,12 +76,16 @@
--rt.tv_sec;
}
+ int oldval = atomic_compare_and_exchange_val_acq (futex, 2, 1);
/* Already timed out? */
if (rt.tv_sec < 0)
- return ETIMEDOUT;
+ {
+ if (oldval == 0)
+ lll_futex_wake (futex, 1, private);
+ return ETIMEDOUT;
+ }
/* Wait. */
- int oldval = atomic_compare_and_exchange_val_acq (futex, 2, 1);
if (oldval != 0)
lll_futex_timed_wait (futex, 2, &rt, private);
}

View File

@ -1,12 +0,0 @@
--- sysdeps/i386/i586/memcpy_chk.S.i586 2007-10-02 07:00:06.000000000 -0700
+++ sysdeps/i386/i586/memcpy_chk.S 2007-10-02 06:58:51.000000000 -0700
@@ -0,0 +1 @@
+#include <sysdeps/i386/i686/memcpy_chk.S>
--- sysdeps/i386/i586/mempcpy_chk.S.i586 2007-10-02 07:00:06.000000000 -0700
+++ sysdeps/i386/i586/mempcpy_chk.S 2007-10-02 06:58:51.000000000 -0700
@@ -0,0 +1 @@
+#include <sysdeps/i386/i686/mempcpy_chk.S>
--- sysdeps/i386/i586/memset_chk.S.i586 2007-10-02 07:00:06.000000000 -0700
+++ sysdeps/i386/i586/memset_chk.S 2007-10-02 06:58:51.000000000 -0700
@@ -0,0 +1 @@
+#include <sysdeps/i386/i686/memset_chk.S>

View File

@ -1,45 +0,0 @@
diff -Nru glibc-2.7.orig/sysdeps/posix/getaddrinfo.c glibc-2.7/sysdeps/posix/getaddrinfo.c
--- glibc-2.7.orig/sysdeps/posix/getaddrinfo.c 2007-10-17 18:05:12.000000000 +0200
+++ glibc-2.7/sysdeps/posix/getaddrinfo.c 2008-02-05 19:53:08.000000000 +0100
@@ -263,7 +263,7 @@
static int
gaih_inet (const char *name, const struct gaih_service *service,
const struct addrinfo *req, struct addrinfo **pai,
- unsigned int *naddrs)
+ unsigned int *naddrs, bool usable_ipv6)
{
const struct gaih_typeproto *tp = gaih_inet_typeproto;
struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv;
@@ -706,7 +706,7 @@
if (fct != NULL)
{
if (req->ai_family == AF_INET6
- || req->ai_family == AF_UNSPEC)
+ || (req->ai_family == AF_UNSPEC && usable_ipv6))
{
gethosts (AF_INET6, struct in6_addr);
no_inet6_data = no_data;
@@ -1914,7 +1914,7 @@
if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET
|| hints->ai_family == AF_INET6)
{
- last_i = gaih_inet (name, pservice, hints, end, &naddrs);
+ last_i = gaih_inet (name, pservice, hints, end, &naddrs, seen_ipv6);
if (last_i != 0)
{
freeaddrinfo (p);
diff -Nru glibc-2.7.orig/sysdeps/unix/sysv/linux/check_pf.c glibc-2.7/sysdeps/unix/sysv/linux/check_pf.c
--- glibc-2.7.orig/sysdeps/unix/sysv/linux/check_pf.c 2007-08-29 18:49:45.000000000 +0200
+++ glibc-2.7/sysdeps/unix/sysv/linux/check_pf.c 2008-02-05 19:50:30.000000000 +0100
@@ -201,7 +201,10 @@
{
out_v6:
if (!IN6_IS_ADDR_LOOPBACK (address ?: local))
- *seen_ipv6 = true;
+ if (ifam->ifa_scope < RT_SCOPE_LINK)
+ {
+ *seen_ipv6 = true;
+ }
}
if (ifam->ifa_flags & (IFA_F_DEPRECATED

View File

@ -1,11 +0,0 @@
--- glibc-2.7/sysdeps/i386/fpu/ftestexcept.c.vaniglia 2009-01-28 22:38:10.000000000 +0100
+++ glibc-2.7/sysdeps/i386/fpu/ftestexcept.c 2009-01-28 22:39:05.000000000 +0100
@@ -26,7 +26,7 @@
int
fetestexcept (int excepts)
{
- int temp;
+ short temp;
int xtemp = 0;
/* Get current exceptions. */

View File

@ -1,12 +0,0 @@
--- ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h.orig
+++ ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
@@ -73,6 +73,9 @@
# define DOCARGS_5 DOCARGS_4
# define UNDOCARGS_5 UNDOCARGS_4
+# define DOCARGS_6 DOCARGS_5
+# define UNDOCARGS_6 UNDOCARGS_5
+
# ifdef IS_IN_libpthread
# define CENABLE bl PLTJMP(__pthread_enable_asynccancel)
# define CDISABLE bl PLTJMP(__pthread_disable_asynccancel)

42
glibc-locale-gen Normal file
View File

@ -0,0 +1,42 @@
#!/bin/sh
set -e
LOCALEGEN=/etc/locale.gen
LOCALES=/usr/share/i18n/locales
if [ -n "$POSIXLY_CORRECT" ]; then
unset POSIXLY_CORRECT
fi
[ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0;
# Remove all old locale dir and locale-archive before generating new
# locale data.
rm -rf /usr/lib/locale/locale-archive || true
umask 022
is_entry_ok() {
if [ -n "$locale" -a -n "$charset" ] ; then
true
else
echo "error: Bad entry '$locale $charset'"
false
fi
}
echo "Generating locales..."
while read locale charset; do \
case $locale in \#*) continue;; "") continue;; esac; \
is_entry_ok || continue
echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
echo -n ".$charset"; \
echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
echo -n '...'; \
if [ -f $LOCALES/$locale ]; then input=$locale; else \
input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \
localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \
echo ' done'; \
done < $LOCALEGEN
echo "Generation complete."

17
glibc-locale.gen.txt Normal file
View File

@ -0,0 +1,17 @@
# Configuration file for locale-gen
#
# lists of locales that are to be generated by the locale-gen command.
#
# Each line is of the form:
#
# <locale> <charset>
#
# where <locale> is one of the locales given in /usr/share/i18n/locales
# and <charset> is one of the character sets listed in /usr/share/i18n/charmaps
#
# The locale-gen command will generate all the locales,
# placing them in /usr/lib/locale.
#
# A list of supported locales is given in /usr/share/i18n/SUPPORTED
# and is included in this file. Uncomment the needed locales below.
#

View File

@ -1,19 +0,0 @@
commit 2d80bda39073a35af4b904d27fa1511cd309b26f
Author: Nathan Sidwell <nathan@codesourcery.com>
Date: Fri Jan 6 20:14:44 2012 +0000
Add ARM dependency of libmemusage.so on libc_nonshared.a.
diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile
index 5651161..1a88430 100644
--- a/ports/sysdeps/arm/Makefile
+++ b/ports/sysdeps/arm/Makefile
@@ -7,3 +7,8 @@ endif
ifeq ($(subdir),csu)
gen-as-const-headers += tlsdesc.sym
endif
+
+# to pull in __aeabi_read_tp, needed for tls
+ifeq ($(subdir),malloc)
+$(objpfx)libmemusage.so: $(common-objpfx)libc_nonshared.a
+endif

View File

@ -9,7 +9,18 @@
#rpmbuild -ba --define='cross_target_cpu arm' --define='softfloat 1' glibc.spec
%define majver %(echo %version | cut -d. -f1-2)
#%define minver %(echo %version | cut -d. -f3)
#% if "%{?KERNEL_VER}" == ""
# % define KERNEL_VER %(uname -r | sed "s|\\([0-9.]*\\).*|\\1|" )
#% endif
%if "%{?KERNEL_TARGET}" == ""
%ifarch %{ix86}
%define KERNEL_TARGET mamba
%else
%define KERNEL_TARGET mamba-%{_target_cpu}
%endif
%endif
%if "%{?build_doc}" == ""
%define build_doc 1
@ -74,48 +85,31 @@
%define build_selinux 0
%endif
#% if "%{?KERNEL_VER}" == ""
# % define KERNEL_VER %(uname -r | sed "s|\\([0-9.]*\\).*|\\1|" )
#% endif
%if "%{?KERNEL_TARGET}" == ""
%define KERNEL_TARGET %(uname -r | sed "s|[0-9.]*\\(.*\\)|\\1|" )
%endif
Name: glibc
Version: 2.40
Release: 2mamba
Release: 3mamba
Summary: The GNU libc libraries
Group: System/Libraries
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://www.gnu.org/software/libc/
Source0: http://ftp.gnu.org/gnu/glibc/glibc-%{version}.tar.xz
Source0: https://ftp.gnu.org/gnu/glibc/glibc-%{version}.tar.xz
Source4: nscd-logrotate
Source5: nscd-conf
Source6: nscd-initscript
Patch0: %{name}-2.4-manual-syntax-fix.patch
Patch1: %{name}-2.6.1-strlcpy_strlcat-1.patch
Patch2: %{name}-2.7-memcpy_chk_S.patch
Patch3: %{name}-2.9-arm_local_args6.patch
Patch4: %{name}-2.7-lowlevellock.patch
Patch5: %{name}-2.16.0-localedata_openmamba.patch
Patch6: %{name}-2.7-only-lookup-ipv6-if-it-makes-sense.patch
Patch7: %{name}-2.7-gcc-4.3.patch
Patch8: %{name}-2.7-x86-fnstsw.patch
Patch9: %{name}-2.10.1-binutils-2.20.patch
Patch10: %{name}-2.11.2-gcc-4.5.0.patch
Patch11: %{name}-2.13-fix_prelink_ld_so.patch
Patch12: %{name}-2.14.1-fix-segfault-at-dl-lookup.patch
Patch13: %{name}-2.14-fix-resolver-crash-typo.patch
Patch14: %{name}-2.14-rpc_nis_headers_restore.patch
Patch15: glibc-ports-2.15-arm-libmemusage-libc_nonshared.patch
Patch16: glibc-2.16.0-tetex-3.0.patch
Source7: glibc-locale-gen
Source8: glibc-locale.gen.txt
Patch5: glibc-2.16.0-localedata_openmamba.patch
Patch17: glibc-2.21-prevent-ehaustion-of-tls-slots.patch
Patch18: glibc-2.25-resolv-no-compat.patch
License: LGPL
## AUTOBUILDREQ-BEGIN
BuildRequires: libaudit-devel
BuildRequires: libcap-devel
BuildRequires: libgd-devel
BuildRequires: libpng-devel
BuildRequires: libselinux-devel
BuildRequires: libz-devel
## AUTOBUILDREQ-END
BuildRequires: libidn-devel
BuildRequires: binutils >= 2.13
@ -141,17 +135,12 @@ BuildRequires: kernelsanitisedheaders
BuildRequires: libpython3-devel
BuildRequires: elfutils
%endif
Requires: ldconfig = %{?epoch:%epoch:}%{version}-%{release}
Requires: locales = %{?epoch:%epoch:}%{version}-%{release}
Requires: glibc-utils = %{?epoch:%epoch:}%{version}-%{release}
Requires(post): ldconfig = %{?epoch:%epoch:}%{version}-%{release}
Requires(post): glibc-utils = %{?epoch:%epoch:}%{version}-%{release}
Requires(post): glibc-common = %{?epoch:%epoch:}%{version}-%{release}
Requires(pre): libxcrypt
%systemd_requires
# FIXME :
# $> localedef -v -c -i da_DK -f UTF-8 /tmp/da_DK.UTF-8
# character map file `UTF-8' not found: No such file or directory
# cannot read character map directory `/usr/share/i18n/charmaps': No such file or directory
%description
The glibc package contains standard libraries which are used by multiple programs on the system.
In order to save disk space and memory, as well as to make upgrading easier, common system code is kept in one place and shared between programs.
@ -212,13 +201,23 @@ Requires: glibc-devel = %{?epoch:%epoch:}%{version}-%{release}
GNU libc libraries API documentation.
%endif
%package i18ndata
Summary: Database sources for 'locale'
%package common
Summary: Common files shared by multiple binary glibc installations
Group: System/Libraries
Requires(pre): %{name} = %{?epoch:%epoch:}%{version}-%{release}
Provides: glibc-i18ndata
Obsoletes: glibc-i18ndata <= 2.40-2mamba
Provides: locales
Obsoletes: locales <= 2.40-2mamba
%description i18ndata
This package contains the data needed to build the locale data files to use the internationalization features of the GNU libc.
%description common
Common files shared by multiple binary glibc installations.
%package locales
Summary: Pregenerated locales for the GNU C Library
Group: System/Internationalization
%description locales
Pregenerated locales for the GNU C Library.
%package utils
Summary: Development utilities from GNU C library
@ -250,16 +249,6 @@ Requires(post):tzdata
%description -n timezone
These are configuration files that describe possible time zones.
%package -n locales
Summary: Base files for localization
Group: System/Internationalization
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description -n locales
These are the base files for language localization.
You also need to install the specific locales-?? for the language(s) you want.
Then the user need to set the LANG variable to their preferred language in their ~/.profile configuration file.
%package -n nscd
Summary: Name service cache daemon
Group: System/Servers
@ -291,6 +280,9 @@ Cross Platform glibc for %{_target_platform}.
%debug_package
%endif
# Don't clean build at the end
%global __spec_rmbuild_cmd /bin/true
# Filter out all GLIBC_PRIVATE symbols since they are internal to
# the package and should not be examined by any other tool.
%global __filter_GLIBC_PRIVATE 1
@ -299,9 +291,7 @@ Cross Platform glibc for %{_target_platform}.
%setup -q
#-D -T
#:<< ___EOF
%patch 5 -p1
%patch 17 -p1
#%patch18 -p1
%if "%{?stage2}"
# link glibc without libgcc_eh, not available in stage1 cross compiler
@ -523,26 +513,39 @@ ln -s ../lib/locale %{buildroot}/usr/lib32/locale
%makeinstall -C ../glibc-build
# install openmamba default supported locales
mv localedata/SUPPORTED localedata/SUPPORTED.orig
mv localedata/SUPPORTED.openmamba localedata/SUPPORTED
echo "%{_target_platform} == %{_host}"
%if "%{_target_platform}" == "%{_build}"
%ifarch aarch64
install -d -m0755 %{buildroot}%{_prefix}/lib
ln -s ../lib64/ld-linux-aarch64.so.1 %{buildroot}%{_prefix}/lib/ld-linux-aarch64.so.1
%endif
make localedata/install-locales -C ../glibc-build install_root=%{buildroot}
# install locale-gen
install -D -m0755 %{SOURCE7} %{buildroot}%{_bindir}/locale-gen
# Create /etc/locale.gen
install -m644 %{SOURCE8} %{buildroot}%{_sysconfdir}/locale.gen
sed -e '1,3d' -e 's|/| |g' -e 's| \\||g' -e 's|^|#|g' \
localedata/SUPPORTED >> %{buildroot}%{_sysconfdir}/locale.gen
sed -i '/#C\.UTF-8 /d' %{buildroot}%{_sysconfdir}/locale.gen
make localedata/install-locale-files -C ../glibc-build install_root=%{buildroot}
%else
# WORKAROUND: worked up to 2.21
mkdir -p %{buildroot}%{_prefix}/lib/locale
make LOCALEDEF="I18NPATH=. LC_ALL=C localedef" localedata/install-locales -C ../glibc-build install_root=%{buildroot}
make LOCALEDEF="I18NPATH=. LC_ALL=C localedef" localedata/install-locale-files -C ../glibc-build install_root=%{buildroot}
install -d -m0755 %{buildroot}%{glibc_prefix}/lib/locale/
mv %{buildroot}%{_prefix}/lib/locale/* %{buildroot}%{glibc_prefix}/lib/locale/
%endif
mv localedata/SUPPORTED localedata/SUPPORTED.openmamba
mv localedata/SUPPORTED.orig localedata/SUPPORTED
install -m0644 localedata/SUPPORTED %{buildroot}%{glibc_datadir}/i18n/locales/
# Locale creation via install-locale-files does not group identical files
# via hardlinks, so we must group them ourselves.
hardlink -c %{buildroot}/%{glibc_prefix}/lib/locale
# Replace LC_CTYPE same files with symlinks to consistently reduce size of glibc-locales package
pushd %{buildroot}%{glibc_prefix}/lib/locale
for f in $(find eo syr tok *_* -samefile C.utf8/LC_CTYPE); do
rm $f && ln -s '../C.utf8/LC_CTYPE' $f
done
popd
# Add SUPPORTED file to package
install -m0644 localedata/SUPPORTED %{buildroot}%{glibc_datadir}/i18n/
[-e %{buildroot}%{glibc_libdir}/libbsd-compat.a ] && ln -sf libbsd-compat.a %{buildroot}%{glibc_libdir}/libbsd.a
%else
# stage 1
@ -623,18 +626,6 @@ install -d %{buildroot}%{_docdir}/libc/html
cp -a ../glibc-build/manual/libc/* %{buildroot}%{_docdir}/libc/html/
cp -a ../glibc-build/manual/libc.pdf %{buildroot}%{_docdir}/libc/
%endif
## provide legacy /lib[64] after glibc migration to /usr/lib[64]
#install -d -m0755 %{buildroot}%{_sysconfdir}/ld.so.conf.d
#%ifarch x86_64 aarch64
#cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/glibc64.conf << __EOF
#/%{_lib}
#__EOF
#%else
#cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/glibc.conf << __EOF
#/%{_lib}
#__EOF
#%endif
%endif
%endif
@ -647,14 +638,6 @@ rm -rf %{buildroot}%{glibc_datadir}/zoneinfo
%clean
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
# this script does not permit the clean installation of glibc packages
# during the setup: i.e. do NOT use pre script here!
#%pre
#if [ -d %{_bindir}/getconf ]; then
# rm -fr %{_bindir}/getconf
#fi
#exit 0
%post
if [ $1 -ge 1 ]; then
cat > /tmp/migrate-libdirs.sh << _EOF
@ -734,9 +717,15 @@ done
_EOF
chmod +x /tmp/migrate-libdirs.sh
fi
:
%postun -p /usr/sbin/ldconfig
# update locale.gen to make sure current LANG locale is enabled
LOCALES=(`grep ${LANG/utf*/UTF-8} %{glibc_datadir}/i18n/SUPPORTED | awk '{ print $1 }'`);
for l in ${LOCALES[*]/\/*/}; do
sed -i "s|#${l}|${l}|" %{_sysconfdir}/locale.gen
done
# update locale-archive according to locale.gen
locale-gen
:
# Restore ld-linux loader after removing from /lib[64] to fix /usr/lib[64] migration
%triggerpostun -p <lua> -- glibc < 2.34-4mamba
@ -767,12 +756,20 @@ for i, l in ipairs(libdirs) do
end
end
%transfiletriggerin -n ldconfig -P 2000000 -- /%{_lib} %{_libdir}
/usr/sbin/ldconfig
%ifarch x86_64
%transfiletriggerin -n ldconfig -P 2000000 -- %{_libdir} %{_prefix}/lib
%else
%transfiletriggerin -n ldconfig -P 2000000 -- %{_libdir}
%endif
%{_bindir}/ldconfig
:
%transfiletriggerpostun -n ldconfig -P 2000000 -- /%{_lib} %{_libdir}
/usr/sbin/ldconfig
%ifarch x86_64
%transfiletriggerpostun -n ldconfig -P 2000000 -- %{_libdir} %{_prefix}/lib
%else
%transfiletriggerpostun -n ldconfig -P 2000000 -- %{_libdir}
%endif
%{_bindir}/ldconfig
:
%pre devel
@ -808,17 +805,6 @@ fi
%uninstall_info libc.info
:
%posttrans i18ndata
# update locale-archive for current language settings
LOCALES=(`grep ${LANG:0:5} %{glibc_datadir}/i18n/locales/SUPPORTED | awk '{ print $1 }'`);
for l in ${LOCALES[*]}; do
charset=`echo $l | sed -e 's,.*/,,'`
locale=`echo $l | sed -e 's,/[^/]*,,'`
input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`
localedef -i $input -c -f $charset $locale
done
:
%pre -n nscd
if [ $1 -ge 1 ]; then
/usr/sbin/groupadd -g 65001 nscd &>/dev/null || true
@ -901,10 +887,20 @@ fi
%{_docdir}/libc/*
%endif
%files i18ndata
%files common -f libc.lang
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/locale.gen
%dir %{_prefix}/lib/locale
%dir %{_prefix}/lib/locale/C.utf8
%{_prefix}/lib/locale/C.utf8/*
%dir %{glibc_datadir}/i18n
%{glibc_datadir}/i18n/*
%{glibc_datadir}/locale/locale.alias
%files locales
%defattr(-,root,root)
%{_prefix}/lib/locale/*
%exclude %{_prefix}/lib/locale/C.utf8/*
%files utils
%defattr(-,root,root)
@ -918,8 +914,8 @@ fi
%{_bindir}/ldd
%{_bindir}/locale
%{_bindir}/localedef
%{_bindir}/locale-gen
%{_bindir}/pldd
#%{_bindir}/rpcgen
%{_bindir}/sprof
%{_bindir}/tzselect
%{_bindir}/mtrace
@ -941,12 +937,6 @@ fi
%dir %{_sysconfdir}/ld.so.conf.d
%{_sbindir}/ldconfig
%files -n locales -f libc.lang
%defattr(-,root,root)
%{glibc_datadir}/locale/locale.alias
%dir %{_prefix}/lib/locale
%{_prefix}/lib/locale/locale-archive
%files -n nscd
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/logrotate.d/nscd
@ -977,6 +967,12 @@ fi
%endif
%changelog
* Fri Oct 11 2024 Silvan Calarco <silvan.calarco@mambasoft.it> 2.40-3mamba
- provide locale-gen and /etc/locale.gen mechanism to generate /usr/lib/locale-archive
- provide C.utf8 as always preinstalled locale
- add glibc-common and integrate glibc-i18n, obsolete locales
- provide preprocessed locales in glibc-locales
* Fri Jul 26 2024 Silvan Calarco <silvan.calarco@mambasoft.it> 2.40-2mamba
- nscd: provide user and group nscd