!39 upgrade glibc from 2.28-45 to 2.31-1 version
Merge pull request !39 from 吴旭/master
This commit is contained in:
commit
ed4da6c78e
@ -1,4 +1,4 @@
|
|||||||
From 9333498794cde1d5cca518badf79533a24114b6f Mon Sep 17 00:00:00 2001
|
From 9f997ceca28f0634ad78a1ca95b84265f7801ff4 Mon Sep 17 00:00:00 2001
|
||||||
From: Joseph Myers <joseph@codesourcery.com>
|
From: Joseph Myers <joseph@codesourcery.com>
|
||||||
Date: Wed, 12 Feb 2020 23:31:56 +0000
|
Date: Wed, 12 Feb 2020 23:31:56 +0000
|
||||||
Subject: [PATCH] Avoid ldbl-96 stack corruption from range reduction of
|
Subject: [PATCH] Avoid ldbl-96 stack corruption from range reduction of
|
||||||
@ -31,37 +31,20 @@ since that is not a form of input expected by __kernel_rem_pio2.
|
|||||||
|
|
||||||
Tested for x86_64.
|
Tested for x86_64.
|
||||||
|
|
||||||
backport to openeuler.
|
(cherry picked from commit 9333498794cde1d5cca518badf79533a24114b6f)
|
||||||
|
|
||||||
---
|
---
|
||||||
NEWS | 4 +++
|
sysdeps/ieee754/ldbl-96/Makefile | 3 ++-
|
||||||
sysdeps/ieee754/ldbl-96/Makefile | 3 +-
|
sysdeps/ieee754/ldbl-96/e_rem_pio2l.c | 12 +++++++++
|
||||||
sysdeps/ieee754/ldbl-96/e_rem_pio2l.c | 12 +++++++
|
sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c | 41 ++++++++++++++++++++++++++++++
|
||||||
sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c | 41 ++++++++++++++++++++++
|
4 files changed, 60 insertions(+), 1 deletion(-)
|
||||||
4 files changed, 59 insertions(+), 1 deletion(-)
|
|
||||||
create mode 100644 sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c
|
create mode 100644 sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c
|
||||||
|
|
||||||
diff --git a/NEWS b/NEWS
|
|
||||||
index 2b681ed7..eb31aca6 100644
|
|
||||||
--- a/NEWS
|
|
||||||
+++ b/NEWS
|
|
||||||
@@ -246,6 +246,10 @@ Security related changes:
|
|
||||||
addresses for loaded libraries and thus bypass ASLR for a setuid
|
|
||||||
program. Reported by Marcin Kościelnicki.
|
|
||||||
|
|
||||||
+ CVE-2020-10029: Trigonometric functions on x86 targets suffered from stack
|
|
||||||
+ corruption when they were passed a pseudo-zero argument. Reported by Guido
|
|
||||||
+ Vranken / ForAllSecure Mayhem.
|
|
||||||
+
|
|
||||||
The following bugs are resolved with this release:
|
|
||||||
|
|
||||||
[1190] stdio: fgetc()/fread() behaviour is not POSIX compliant
|
|
||||||
diff --git a/sysdeps/ieee754/ldbl-96/Makefile b/sysdeps/ieee754/ldbl-96/Makefile
|
diff --git a/sysdeps/ieee754/ldbl-96/Makefile b/sysdeps/ieee754/ldbl-96/Makefile
|
||||||
index 790f670e..99c596e3 100644
|
index 995e90d..318628a 100644
|
||||||
--- a/sysdeps/ieee754/ldbl-96/Makefile
|
--- a/sysdeps/ieee754/ldbl-96/Makefile
|
||||||
+++ b/sysdeps/ieee754/ldbl-96/Makefile
|
+++ b/sysdeps/ieee754/ldbl-96/Makefile
|
||||||
@@ -17,5 +17,6 @@
|
@@ -17,5 +17,6 @@
|
||||||
# <http://www.gnu.org/licenses/>.
|
# <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
ifeq ($(subdir),math)
|
ifeq ($(subdir),math)
|
||||||
-tests += test-canonical-ldbl-96 test-totalorderl-ldbl-96
|
-tests += test-canonical-ldbl-96 test-totalorderl-ldbl-96
|
||||||
@ -69,7 +52,7 @@ index 790f670e..99c596e3 100644
|
|||||||
+CFLAGS-test-sinl-pseudo.c += -fstack-protector-all
|
+CFLAGS-test-sinl-pseudo.c += -fstack-protector-all
|
||||||
endif
|
endif
|
||||||
diff --git a/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c b/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c
|
diff --git a/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c b/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c
|
||||||
index f67805f2..b0b899bc 100644
|
index 5f74232..bcdf201 100644
|
||||||
--- a/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c
|
--- a/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c
|
||||||
+++ b/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c
|
+++ b/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c
|
||||||
@@ -210,6 +210,18 @@ __ieee754_rem_pio2l (long double x, long double *y)
|
@@ -210,6 +210,18 @@ __ieee754_rem_pio2l (long double x, long double *y)
|
||||||
@ -79,11 +62,11 @@ index f67805f2..b0b899bc 100644
|
|||||||
+ if ((i0 & 0x80000000) == 0)
|
+ if ((i0 & 0x80000000) == 0)
|
||||||
+ {
|
+ {
|
||||||
+ /* Pseudo-zero and unnormal representations are not valid
|
+ /* Pseudo-zero and unnormal representations are not valid
|
||||||
+ representations of long double. We need to avoid stack
|
+ representations of long double. We need to avoid stack
|
||||||
+ corruption in __kernel_rem_pio2, which expects input in a
|
+ corruption in __kernel_rem_pio2, which expects input in a
|
||||||
+ particular normal form, but those representations do not need
|
+ particular normal form, but those representations do not need
|
||||||
+ to be consistently handled like any particular floating-point
|
+ to be consistently handled like any particular floating-point
|
||||||
+ value. */
|
+ value. */
|
||||||
+ y[1] = y[0] = __builtin_nanl ("");
|
+ y[1] = y[0] = __builtin_nanl ("");
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+ }
|
+ }
|
||||||
@ -93,7 +76,7 @@ index f67805f2..b0b899bc 100644
|
|||||||
exp = j0 - 23;
|
exp = j0 - 23;
|
||||||
diff --git a/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c b/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c
|
diff --git a/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c b/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 00000000..abbce861
|
index 0000000..f59b977
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c
|
+++ b/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c
|
||||||
@@ -0,0 +1,41 @@
|
@@ -0,0 +1,41 @@
|
||||||
@ -127,9 +110,9 @@ index 00000000..abbce861
|
|||||||
+ uint64_t sig = i == 63 ? 0 : 1ULL << i;
|
+ uint64_t sig = i == 63 ? 0 : 1ULL << i;
|
||||||
+ long double ld;
|
+ long double ld;
|
||||||
+ SET_LDOUBLE_WORDS (ld, 0x4141,
|
+ SET_LDOUBLE_WORDS (ld, 0x4141,
|
||||||
+ sig >> 32, sig & 0xffffffffULL);
|
+ sig >> 32, sig & 0xffffffffULL);
|
||||||
+ /* The requirement is that no stack overflow occurs when the
|
+ /* The requirement is that no stack overflow occurs when the
|
||||||
+ pseudo-zero or unnormal goes through range reduction. */
|
+ pseudo-zero or unnormal goes through range reduction. */
|
||||||
+ volatile long double ldr;
|
+ volatile long double ldr;
|
||||||
+ ldr = sinl (ld);
|
+ ldr = sinl (ld);
|
||||||
+ (void) ldr;
|
+ (void) ldr;
|
||||||
@ -139,5 +122,5 @@ index 00000000..abbce861
|
|||||||
+
|
+
|
||||||
+#include <support/test-driver.c>
|
+#include <support/test-driver.c>
|
||||||
--
|
--
|
||||||
2.19.1
|
2.7.4
|
||||||
|
|
||||||
|
|||||||
@ -1,62 +0,0 @@
|
|||||||
From 359653aaacad463d916323f03c0ac3c47405aafa Mon Sep 17 00:00:00 2001
|
|
||||||
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
||||||
Date: Wed, 16 Jan 2019 18:10:56 +0000
|
|
||||||
Subject: [PATCH] Do not use HP_TIMING_NOW for random bits
|
|
||||||
|
|
||||||
This patch removes the HP_TIMING_BITS usage for fast random bits and replace
|
|
||||||
with clock_gettime (CLOCK_MONOTONIC). It has unspecified starting time and
|
|
||||||
nano-second accuracy, so its randomness is significantly better than
|
|
||||||
gettimeofday.
|
|
||||||
|
|
||||||
Althoug it should incur in more overhead (specially for architecture that
|
|
||||||
support hp-timing), the symbol is also common implemented as a vDSO.
|
|
||||||
|
|
||||||
Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. I also
|
|
||||||
checked on a i686-gnu build.
|
|
||||||
|
|
||||||
* include/random-bits.h: New file.
|
|
||||||
* resolv/res_mkquery.c [HP_TIMING_AVAIL] (RANDOM_BITS,
|
|
||||||
(__res_context_mkquery): Remove usage hp-timing usage and replace with
|
|
||||||
random_bits.
|
|
||||||
* resolv/res_send.c [HP_TIMING_AVAIL] (nameserver_offset): Likewise.
|
|
||||||
* sysdeps/posix/tempname.c [HP_TIMING_AVAIL] (__gen_tempname):
|
|
||||||
Likewise.
|
|
||||||
|
|
||||||
note that this patch is just parts of the origin one to adapt glibc-2.28
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
resolv/res_mkquery.c | 10 +++++++---
|
|
||||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
|
|
||||||
index 213abeef..7ba40640 100644
|
|
||||||
--- a/resolv/res_mkquery.c
|
|
||||||
+++ b/resolv/res_mkquery.c
|
|
||||||
@@ -95,6 +95,7 @@
|
|
||||||
|
|
||||||
#include <hp-timing.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
+#include <time.h>
|
|
||||||
#if HP_TIMING_AVAIL
|
|
||||||
# define RANDOM_BITS(Var) { uint64_t v64; HP_TIMING_NOW (v64); Var = v64; }
|
|
||||||
#endif
|
|
||||||
@@ -124,9 +125,12 @@ __res_context_mkquery (struct resolv_context *ctx, int op, const char *dname,
|
|
||||||
#ifdef RANDOM_BITS
|
|
||||||
RANDOM_BITS (randombits);
|
|
||||||
#else
|
|
||||||
- struct timeval tv;
|
|
||||||
- __gettimeofday (&tv, NULL);
|
|
||||||
- randombits = (tv.tv_sec << 8) ^ tv.tv_usec;
|
|
||||||
+ struct timespec tv;
|
|
||||||
+ clock_gettime (CLOCK_MONOTONIC, &tv);
|
|
||||||
+ /* Shuffle the lower bits to minimize the clock bias. */
|
|
||||||
+ uint32_t ret = tv.tv_nsec ^ tv.tv_sec;
|
|
||||||
+ ret ^= (ret << 24) | (ret >> 8);
|
|
||||||
+ randombits = ret;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hp->id = randombits;
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
From d93769405996dfc11d216ddbe415946617b5a494 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Andreas Schwab <schwab@suse.de>
|
|
||||||
Date: Mon, 20 Jan 2020 17:01:50 +0100
|
|
||||||
Subject: [PATCH] Fix array overflow in backtrace on PowerPC (bug 25423)
|
|
||||||
|
|
||||||
When unwinding through a signal frame the backtrace function on PowerPC
|
|
||||||
didn't check array bounds when storing the frame address. Fixes commit
|
|
||||||
d400dcac5e ("PowerPC: fix backtrace to handle signal trampolines").
|
|
||||||
|
|
||||||
Signed-off-by: wuxu.wu <wuxu.wu@huawei.com>
|
|
||||||
---
|
|
||||||
debug/tst-backtrace5.c | 12 ++++++++++++
|
|
||||||
sysdeps/powerpc/powerpc32/backtrace.c | 2 ++
|
|
||||||
sysdeps/powerpc/powerpc64/backtrace.c | 2 ++
|
|
||||||
3 files changed, 16 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/debug/tst-backtrace5.c b/debug/tst-backtrace5.c
|
|
||||||
index e7ce410..b2f4616 100644
|
|
||||||
--- a/debug/tst-backtrace5.c
|
|
||||||
+++ b/debug/tst-backtrace5.c
|
|
||||||
@@ -89,6 +89,18 @@ handle_signal (int signum)
|
|
||||||
}
|
|
||||||
/* Symbol names are not available for static functions, so we do not
|
|
||||||
check do_test. */
|
|
||||||
+
|
|
||||||
+ /* Check that backtrace does not return more than what fits in the array
|
|
||||||
+ (bug 25423). */
|
|
||||||
+ for (int j = 0; j < NUM_FUNCTIONS; j++)
|
|
||||||
+ {
|
|
||||||
+ n = backtrace (addresses, j);
|
|
||||||
+ if (n > j)
|
|
||||||
+ {
|
|
||||||
+ FAIL ();
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
NO_INLINE int
|
|
||||||
diff --git a/sysdeps/powerpc/powerpc32/backtrace.c b/sysdeps/powerpc/powerpc32/backtrace.c
|
|
||||||
index 7c2d472..d1456c8 100644
|
|
||||||
--- a/sysdeps/powerpc/powerpc32/backtrace.c
|
|
||||||
+++ b/sysdeps/powerpc/powerpc32/backtrace.c
|
|
||||||
@@ -114,6 +114,8 @@ __backtrace (void **array, int size)
|
|
||||||
}
|
|
||||||
if (gregset)
|
|
||||||
{
|
|
||||||
+ if (count + 1 == size)
|
|
||||||
+ break;
|
|
||||||
array[++count] = (void*)((*gregset)[PT_NIP]);
|
|
||||||
current = (void*)((*gregset)[PT_R1]);
|
|
||||||
}
|
|
||||||
diff --git a/sysdeps/powerpc/powerpc64/backtrace.c b/sysdeps/powerpc/powerpc64/backtrace.c
|
|
||||||
index 65c260a..8a53a10 100644
|
|
||||||
--- a/sysdeps/powerpc/powerpc64/backtrace.c
|
|
||||||
+++ b/sysdeps/powerpc/powerpc64/backtrace.c
|
|
||||||
@@ -87,6 +87,8 @@ __backtrace (void **array, int size)
|
|
||||||
if (is_sigtramp_address (current->return_address))
|
|
||||||
{
|
|
||||||
struct signal_frame_64 *sigframe = (struct signal_frame_64*) current;
|
|
||||||
+ if (count + 1 == size)
|
|
||||||
+ break;
|
|
||||||
array[++count] = (void*) sigframe->uc.uc_mcontext.gp_regs[PT_NIP];
|
|
||||||
current = (void*) sigframe->uc.uc_mcontext.gp_regs[PT_R1];
|
|
||||||
}
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,862 +0,0 @@
|
|||||||
#define _GNU_SOURCE
|
|
||||||
#include <assert.h>
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <locale.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <getopt.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include "../locale/hashval.h"
|
|
||||||
#define __LC_LAST 13
|
|
||||||
#include "../locale/locarchive.h"
|
|
||||||
#include "../crypt/md5.h"
|
|
||||||
|
|
||||||
const char *alias_file = DATADIR "/locale/locale.alias";
|
|
||||||
const char *locar_file = PREFIX "/lib/locale/locale-archive";
|
|
||||||
const char *tmpl_file = PREFIX "/lib/locale/locale-archive.tmpl";
|
|
||||||
const char *loc_path = PREFIX "/lib/locale/";
|
|
||||||
/* Flags set by `--verbose` option. */
|
|
||||||
int be_quiet = 1;
|
|
||||||
int verbose = 0;
|
|
||||||
int max_locarchive_open_retry = 10;
|
|
||||||
const char *output_prefix;
|
|
||||||
|
|
||||||
/* Endianness should have been taken care of by localedef. We don't need to do
|
|
||||||
additional swapping. We need this variable exported however, since
|
|
||||||
locarchive.c uses it to determine if it needs to swap endianness of a value
|
|
||||||
before writing to or reading from the archive. */
|
|
||||||
bool swap_endianness_p = false;
|
|
||||||
|
|
||||||
static const char *locnames[] =
|
|
||||||
{
|
|
||||||
#define DEFINE_CATEGORY(category, category_name, items, a) \
|
|
||||||
[category] = category_name,
|
|
||||||
#include "../locale/categories.def"
|
|
||||||
#undef DEFINE_CATEGORY
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
|
||||||
is_prime (unsigned long candidate)
|
|
||||||
{
|
|
||||||
/* No even number and none less than 10 will be passed here. */
|
|
||||||
unsigned long int divn = 3;
|
|
||||||
unsigned long int sq = divn * divn;
|
|
||||||
|
|
||||||
while (sq < candidate && candidate % divn != 0)
|
|
||||||
{
|
|
||||||
++divn;
|
|
||||||
sq += 4 * divn;
|
|
||||||
++divn;
|
|
||||||
}
|
|
||||||
|
|
||||||
return candidate % divn != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long
|
|
||||||
next_prime (unsigned long seed)
|
|
||||||
{
|
|
||||||
/* Make it definitely odd. */
|
|
||||||
seed |= 1;
|
|
||||||
|
|
||||||
while (!is_prime (seed))
|
|
||||||
seed += 2;
|
|
||||||
|
|
||||||
return seed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
error (int status, int errnum, const char *message, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
va_start (args, message);
|
|
||||||
fflush (stdout);
|
|
||||||
fprintf (stderr, "%s: ", program_invocation_name);
|
|
||||||
vfprintf (stderr, message, args);
|
|
||||||
va_end (args);
|
|
||||||
if (errnum)
|
|
||||||
fprintf (stderr, ": %s", strerror (errnum));
|
|
||||||
putc ('\n', stderr);
|
|
||||||
fflush (stderr);
|
|
||||||
if (status)
|
|
||||||
exit (errnum == EROFS ? 0 : status);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *
|
|
||||||
xmalloc (size_t size)
|
|
||||||
{
|
|
||||||
void *p = malloc (size);
|
|
||||||
if (p == NULL)
|
|
||||||
error (EXIT_FAILURE, errno, "could not allocate %zd bytes of memory", size);
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
open_tmpl_archive (struct locarhandle *ah)
|
|
||||||
{
|
|
||||||
struct stat64 st;
|
|
||||||
int fd;
|
|
||||||
struct locarhead head;
|
|
||||||
const char *archivefname = ah->fname == NULL ? tmpl_file : ah->fname;
|
|
||||||
|
|
||||||
/* Open the archive. We must have exclusive write access. */
|
|
||||||
fd = open64 (archivefname, O_RDONLY);
|
|
||||||
if (fd == -1)
|
|
||||||
error (EXIT_FAILURE, errno, "cannot open locale archive template file \"%s\"",
|
|
||||||
archivefname);
|
|
||||||
|
|
||||||
if (fstat64 (fd, &st) < 0)
|
|
||||||
error (EXIT_FAILURE, errno, "cannot stat locale archive template file \"%s\"",
|
|
||||||
archivefname);
|
|
||||||
|
|
||||||
/* Read the header. */
|
|
||||||
if (TEMP_FAILURE_RETRY (read (fd, &head, sizeof (head))) != sizeof (head))
|
|
||||||
error (EXIT_FAILURE, errno, "cannot read archive header");
|
|
||||||
|
|
||||||
ah->fd = fd;
|
|
||||||
ah->mmaped = (head.sumhash_offset
|
|
||||||
+ head.sumhash_size * sizeof (struct sumhashent));
|
|
||||||
if (ah->mmaped > (unsigned long) st.st_size)
|
|
||||||
error (EXIT_FAILURE, 0, "locale archive template file truncated");
|
|
||||||
ah->mmaped = st.st_size;
|
|
||||||
ah->reserved = st.st_size;
|
|
||||||
|
|
||||||
/* Now we know how large the administrative information part is.
|
|
||||||
Map all of it. */
|
|
||||||
ah->addr = mmap64 (NULL, ah->mmaped, PROT_READ, MAP_SHARED, fd, 0);
|
|
||||||
if (ah->addr == MAP_FAILED)
|
|
||||||
error (EXIT_FAILURE, errno, "cannot map archive header");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Open the locale archive. */
|
|
||||||
extern void open_archive (struct locarhandle *ah, bool readonly);
|
|
||||||
|
|
||||||
/* Close the locale archive. */
|
|
||||||
extern void close_archive (struct locarhandle *ah);
|
|
||||||
|
|
||||||
/* Add given locale data to the archive. */
|
|
||||||
extern int add_locale_to_archive (struct locarhandle *ah, const char *name,
|
|
||||||
locale_data_t data, bool replace);
|
|
||||||
|
|
||||||
extern void add_alias (struct locarhandle *ah, const char *alias,
|
|
||||||
bool replace, const char *oldname,
|
|
||||||
uint32_t *locrec_offset_p);
|
|
||||||
|
|
||||||
extern struct namehashent *
|
|
||||||
insert_name (struct locarhandle *ah,
|
|
||||||
const char *name, size_t name_len, bool replace);
|
|
||||||
|
|
||||||
struct nameent
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
struct locrecent *locrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct dataent
|
|
||||||
{
|
|
||||||
const unsigned char *sum;
|
|
||||||
uint32_t file_offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
|
||||||
nameentcmp (const void *a, const void *b)
|
|
||||||
{
|
|
||||||
struct locrecent *la = ((const struct nameent *) a)->locrec;
|
|
||||||
struct locrecent *lb = ((const struct nameent *) b)->locrec;
|
|
||||||
uint32_t start_a = -1, end_a = 0;
|
|
||||||
uint32_t start_b = -1, end_b = 0;
|
|
||||||
int cnt;
|
|
||||||
|
|
||||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
|
||||||
if (cnt != LC_ALL)
|
|
||||||
{
|
|
||||||
if (la->record[cnt].offset < start_a)
|
|
||||||
start_a = la->record[cnt].offset;
|
|
||||||
if (la->record[cnt].offset + la->record[cnt].len > end_a)
|
|
||||||
end_a = la->record[cnt].offset + la->record[cnt].len;
|
|
||||||
}
|
|
||||||
assert (start_a != (uint32_t)-1);
|
|
||||||
assert (end_a != 0);
|
|
||||||
|
|
||||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
|
||||||
if (cnt != LC_ALL)
|
|
||||||
{
|
|
||||||
if (lb->record[cnt].offset < start_b)
|
|
||||||
start_b = lb->record[cnt].offset;
|
|
||||||
if (lb->record[cnt].offset + lb->record[cnt].len > end_b)
|
|
||||||
end_b = lb->record[cnt].offset + lb->record[cnt].len;
|
|
||||||
}
|
|
||||||
assert (start_b != (uint32_t)-1);
|
|
||||||
assert (end_b != 0);
|
|
||||||
|
|
||||||
if (start_a != start_b)
|
|
||||||
return (int)start_a - (int)start_b;
|
|
||||||
return (int)end_a - (int)end_b;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
dataentcmp (const void *a, const void *b)
|
|
||||||
{
|
|
||||||
if (((const struct dataent *) a)->file_offset
|
|
||||||
< ((const struct dataent *) b)->file_offset)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (((const struct dataent *) a)->file_offset
|
|
||||||
> ((const struct dataent *) b)->file_offset)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
sumsearchfn (const void *key, const void *ent)
|
|
||||||
{
|
|
||||||
uint32_t keyn = *(uint32_t *)key;
|
|
||||||
uint32_t entn = ((struct dataent *)ent)->file_offset;
|
|
||||||
|
|
||||||
if (keyn < entn)
|
|
||||||
return -1;
|
|
||||||
if (keyn > entn)
|
|
||||||
return 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
compute_data (struct locarhandle *ah, struct nameent *name, size_t sumused,
|
|
||||||
struct dataent *files, locale_data_t data)
|
|
||||||
{
|
|
||||||
int cnt;
|
|
||||||
struct locrecent *locrec = name->locrec;
|
|
||||||
struct dataent *file;
|
|
||||||
data[LC_ALL].addr = ((char *) ah->addr) + locrec->record[LC_ALL].offset;
|
|
||||||
data[LC_ALL].size = locrec->record[LC_ALL].len;
|
|
||||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
|
||||||
if (cnt != LC_ALL)
|
|
||||||
{
|
|
||||||
data[cnt].addr = ((char *) ah->addr) + locrec->record[cnt].offset;
|
|
||||||
data[cnt].size = locrec->record[cnt].len;
|
|
||||||
if (data[cnt].addr >= data[LC_ALL].addr
|
|
||||||
&& data[cnt].addr + data[cnt].size
|
|
||||||
<= data[LC_ALL].addr + data[LC_ALL].size)
|
|
||||||
__md5_buffer (data[cnt].addr, data[cnt].size, data[cnt].sum);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
file = bsearch (&locrec->record[cnt].offset, files, sumused,
|
|
||||||
sizeof (*files), sumsearchfn);
|
|
||||||
if (file == NULL)
|
|
||||||
error (EXIT_FAILURE, 0, "inconsistent template file");
|
|
||||||
memcpy (data[cnt].sum, file->sum, sizeof (data[cnt].sum));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
fill_archive (struct locarhandle *tmpl_ah,
|
|
||||||
const char *fname,
|
|
||||||
size_t install_langs_count, char *install_langs_list[],
|
|
||||||
size_t nlist, char *list[],
|
|
||||||
const char *primary)
|
|
||||||
{
|
|
||||||
struct locarhandle ah;
|
|
||||||
struct locarhead *head;
|
|
||||||
int result = 0;
|
|
||||||
struct nameent *names;
|
|
||||||
struct namehashent *namehashtab;
|
|
||||||
size_t cnt, used;
|
|
||||||
struct dataent *files;
|
|
||||||
struct sumhashent *sumhashtab;
|
|
||||||
size_t sumused;
|
|
||||||
struct locrecent *primary_locrec = NULL;
|
|
||||||
struct nameent *primary_nameent = NULL;
|
|
||||||
|
|
||||||
head = tmpl_ah->addr;
|
|
||||||
names = (struct nameent *) malloc (head->namehash_used
|
|
||||||
* sizeof (struct nameent));
|
|
||||||
files = (struct dataent *) malloc (head->sumhash_used
|
|
||||||
* sizeof (struct dataent));
|
|
||||||
if (names == NULL || files == NULL)
|
|
||||||
error (EXIT_FAILURE, errno, "could not allocate tables");
|
|
||||||
|
|
||||||
namehashtab = (struct namehashent *) ((char *) tmpl_ah->addr
|
|
||||||
+ head->namehash_offset);
|
|
||||||
sumhashtab = (struct sumhashent *) ((char *) tmpl_ah->addr
|
|
||||||
+ head->sumhash_offset);
|
|
||||||
|
|
||||||
for (cnt = used = 0; cnt < head->namehash_size; ++cnt)
|
|
||||||
if (namehashtab[cnt].locrec_offset != 0)
|
|
||||||
{
|
|
||||||
char * name;
|
|
||||||
int i;
|
|
||||||
assert (used < head->namehash_used);
|
|
||||||
name = tmpl_ah->addr + namehashtab[cnt].name_offset;
|
|
||||||
if (install_langs_count == 0)
|
|
||||||
{
|
|
||||||
/* Always intstall the entry. */
|
|
||||||
names[used].name = name;
|
|
||||||
names[used++].locrec
|
|
||||||
= (struct locrecent *) ((char *) tmpl_ah->addr +
|
|
||||||
namehashtab[cnt].locrec_offset);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Only install the entry if the user asked for it via
|
|
||||||
--install-langs. */
|
|
||||||
for (i = 0; i < install_langs_count; i++)
|
|
||||||
{
|
|
||||||
/* Add one for "_" and one for the null terminator. */
|
|
||||||
size_t len = strlen (install_langs_list[i]) + 2;
|
|
||||||
char *install_lang = (char *)xmalloc (len);
|
|
||||||
strcpy (install_lang, install_langs_list[i]);
|
|
||||||
if (strchr (install_lang, '_') == NULL)
|
|
||||||
strcat (install_lang, "_");
|
|
||||||
if (strncmp (name, install_lang, strlen (install_lang)) == 0)
|
|
||||||
{
|
|
||||||
names[used].name = name;
|
|
||||||
names[used++].locrec
|
|
||||||
= (struct locrecent *) ((char *)tmpl_ah->addr
|
|
||||||
+ namehashtab[cnt].locrec_offset);
|
|
||||||
}
|
|
||||||
free (install_lang);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sort the names. */
|
|
||||||
qsort (names, used, sizeof (struct nameent), nameentcmp);
|
|
||||||
|
|
||||||
for (cnt = sumused = 0; cnt < head->sumhash_size; ++cnt)
|
|
||||||
if (sumhashtab[cnt].file_offset != 0)
|
|
||||||
{
|
|
||||||
assert (sumused < head->sumhash_used);
|
|
||||||
files[sumused].sum = (const unsigned char *) sumhashtab[cnt].sum;
|
|
||||||
files[sumused++].file_offset = sumhashtab[cnt].file_offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sort by file locations. */
|
|
||||||
qsort (files, sumused, sizeof (struct dataent), dataentcmp);
|
|
||||||
|
|
||||||
/* Open the archive. This call never returns if we cannot
|
|
||||||
successfully open the archive. */
|
|
||||||
ah.fname = NULL;
|
|
||||||
if (fname != NULL)
|
|
||||||
ah.fname = fname;
|
|
||||||
open_archive (&ah, false);
|
|
||||||
|
|
||||||
if (primary != NULL)
|
|
||||||
{
|
|
||||||
for (cnt = 0; cnt < used; ++cnt)
|
|
||||||
if (strcmp (names[cnt].name, primary) == 0)
|
|
||||||
break;
|
|
||||||
if (cnt < used)
|
|
||||||
{
|
|
||||||
locale_data_t data;
|
|
||||||
|
|
||||||
compute_data (tmpl_ah, &names[cnt], sumused, files, data);
|
|
||||||
result |= add_locale_to_archive (&ah, primary, data, 0);
|
|
||||||
primary_locrec = names[cnt].locrec;
|
|
||||||
primary_nameent = &names[cnt];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (cnt = 0; cnt < used; ++cnt)
|
|
||||||
if (&names[cnt] == primary_nameent)
|
|
||||||
continue;
|
|
||||||
else if ((cnt > 0 && names[cnt - 1].locrec == names[cnt].locrec)
|
|
||||||
|| names[cnt].locrec == primary_locrec)
|
|
||||||
{
|
|
||||||
const char *oldname;
|
|
||||||
struct namehashent *namehashent;
|
|
||||||
uint32_t locrec_offset;
|
|
||||||
|
|
||||||
if (names[cnt].locrec == primary_locrec)
|
|
||||||
oldname = primary;
|
|
||||||
else
|
|
||||||
oldname = names[cnt - 1].name;
|
|
||||||
namehashent = insert_name (&ah, oldname, strlen (oldname), true);
|
|
||||||
assert (namehashent->name_offset != 0);
|
|
||||||
assert (namehashent->locrec_offset != 0);
|
|
||||||
locrec_offset = namehashent->locrec_offset;
|
|
||||||
add_alias (&ah, names[cnt].name, 0, oldname, &locrec_offset);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
locale_data_t data;
|
|
||||||
|
|
||||||
compute_data (tmpl_ah, &names[cnt], sumused, files, data);
|
|
||||||
result |= add_locale_to_archive (&ah, names[cnt].name, data, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (nlist-- > 0)
|
|
||||||
{
|
|
||||||
const char *fname = *list++;
|
|
||||||
size_t fnamelen = strlen (fname);
|
|
||||||
struct stat64 st;
|
|
||||||
DIR *dirp;
|
|
||||||
struct dirent64 *d;
|
|
||||||
int seen;
|
|
||||||
locale_data_t data;
|
|
||||||
int cnt;
|
|
||||||
|
|
||||||
/* First see whether this really is a directory and whether it
|
|
||||||
contains all the require locale category files. */
|
|
||||||
if (stat64 (fname, &st) < 0)
|
|
||||||
{
|
|
||||||
error (0, 0, "stat of \"%s\" failed: %s: ignored", fname,
|
|
||||||
strerror (errno));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!S_ISDIR (st.st_mode))
|
|
||||||
{
|
|
||||||
error (0, 0, "\"%s\" is no directory; ignored", fname);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
dirp = opendir (fname);
|
|
||||||
if (dirp == NULL)
|
|
||||||
{
|
|
||||||
error (0, 0, "cannot open directory \"%s\": %s: ignored",
|
|
||||||
fname, strerror (errno));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
seen = 0;
|
|
||||||
while ((d = readdir64 (dirp)) != NULL)
|
|
||||||
{
|
|
||||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
|
||||||
if (cnt != LC_ALL)
|
|
||||||
if (strcmp (d->d_name, locnames[cnt]) == 0)
|
|
||||||
{
|
|
||||||
unsigned char d_type;
|
|
||||||
|
|
||||||
/* We have an object of the required name. If it's
|
|
||||||
a directory we have to look at a file with the
|
|
||||||
prefix "SYS_". Otherwise we have found what we
|
|
||||||
are looking for. */
|
|
||||||
#ifdef _DIRENT_HAVE_D_TYPE
|
|
||||||
d_type = d->d_type;
|
|
||||||
|
|
||||||
if (d_type != DT_REG)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
char fullname[fnamelen + 2 * strlen (d->d_name) + 7];
|
|
||||||
|
|
||||||
#ifdef _DIRENT_HAVE_D_TYPE
|
|
||||||
if (d_type == DT_UNKNOWN)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
strcpy (stpcpy (stpcpy (fullname, fname), "/"),
|
|
||||||
d->d_name);
|
|
||||||
|
|
||||||
if (stat64 (fullname, &st) == -1)
|
|
||||||
/* We cannot stat the file, ignore it. */
|
|
||||||
break;
|
|
||||||
|
|
||||||
d_type = IFTODT (st.st_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d_type == DT_DIR)
|
|
||||||
{
|
|
||||||
/* We have to do more tests. The file is a
|
|
||||||
directory and it therefore must contain a
|
|
||||||
regular file with the same name except a
|
|
||||||
"SYS_" prefix. */
|
|
||||||
char *t = stpcpy (stpcpy (fullname, fname), "/");
|
|
||||||
strcpy (stpcpy (stpcpy (t, d->d_name), "/SYS_"),
|
|
||||||
d->d_name);
|
|
||||||
|
|
||||||
if (stat64 (fullname, &st) == -1)
|
|
||||||
/* There is no SYS_* file or we cannot
|
|
||||||
access it. */
|
|
||||||
break;
|
|
||||||
|
|
||||||
d_type = IFTODT (st.st_mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we found a regular file (eventually after
|
|
||||||
following a symlink) we are successful. */
|
|
||||||
if (d_type == DT_REG)
|
|
||||||
++seen;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
closedir (dirp);
|
|
||||||
|
|
||||||
if (seen != __LC_LAST - 1)
|
|
||||||
{
|
|
||||||
/* We don't have all locale category files. Ignore the name. */
|
|
||||||
error (0, 0, "incomplete set of locale files in \"%s\"",
|
|
||||||
fname);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add the files to the archive. To do this we first compute
|
|
||||||
sizes and the MD5 sums of all the files. */
|
|
||||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
|
||||||
if (cnt != LC_ALL)
|
|
||||||
{
|
|
||||||
char fullname[fnamelen + 2 * strlen (locnames[cnt]) + 7];
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
strcpy (stpcpy (stpcpy (fullname, fname), "/"), locnames[cnt]);
|
|
||||||
fd = open64 (fullname, O_RDONLY);
|
|
||||||
if (fd == -1 || fstat64 (fd, &st) == -1)
|
|
||||||
{
|
|
||||||
/* Cannot read the file. */
|
|
||||||
if (fd != -1)
|
|
||||||
close (fd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (S_ISDIR (st.st_mode))
|
|
||||||
{
|
|
||||||
char *t;
|
|
||||||
close (fd);
|
|
||||||
t = stpcpy (stpcpy (fullname, fname), "/");
|
|
||||||
strcpy (stpcpy (stpcpy (t, locnames[cnt]), "/SYS_"),
|
|
||||||
locnames[cnt]);
|
|
||||||
|
|
||||||
fd = open64 (fullname, O_RDONLY);
|
|
||||||
if (fd == -1 || fstat64 (fd, &st) == -1
|
|
||||||
|| !S_ISREG (st.st_mode))
|
|
||||||
{
|
|
||||||
if (fd != -1)
|
|
||||||
close (fd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Map the file. */
|
|
||||||
data[cnt].addr = mmap64 (NULL, st.st_size, PROT_READ, MAP_SHARED,
|
|
||||||
fd, 0);
|
|
||||||
if (data[cnt].addr == MAP_FAILED)
|
|
||||||
{
|
|
||||||
/* Cannot map it. */
|
|
||||||
close (fd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
data[cnt].size = st.st_size;
|
|
||||||
__md5_buffer (data[cnt].addr, st.st_size, data[cnt].sum);
|
|
||||||
|
|
||||||
/* We don't need the file descriptor anymore. */
|
|
||||||
close (fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cnt != __LC_LAST)
|
|
||||||
{
|
|
||||||
while (cnt-- > 0)
|
|
||||||
if (cnt != LC_ALL)
|
|
||||||
munmap (data[cnt].addr, data[cnt].size);
|
|
||||||
|
|
||||||
error (0, 0, "cannot read all files in \"%s\": ignored", fname);
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
result |= add_locale_to_archive (&ah, basename (fname), data, 0);
|
|
||||||
|
|
||||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
|
||||||
if (cnt != LC_ALL)
|
|
||||||
munmap (data[cnt].addr, data[cnt].size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We are done. */
|
|
||||||
close_archive (&ah);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void usage()
|
|
||||||
{
|
|
||||||
printf ("\
|
|
||||||
Usage: build-locale-archive [OPTION]... [TEMPLATE-FILE] [ARCHIVE-FILE]\n\
|
|
||||||
Builds a locale archive from a template file.\n\
|
|
||||||
Options:\n\
|
|
||||||
-h, --help Print this usage message.\n\
|
|
||||||
-v, --verbose Verbose execution.\n\
|
|
||||||
-l, --install-langs=LIST Only include locales given in LIST into the \n\
|
|
||||||
locale archive. LIST is a colon separated list\n\
|
|
||||||
of locale prefixes, for example \"de:en:ja\".\n\
|
|
||||||
The special argument \"all\" means to install\n\
|
|
||||||
all languages and it must be present by itself.\n\
|
|
||||||
If \"all\" is present with any other language it\n\
|
|
||||||
will be treated as the name of a locale.\n\
|
|
||||||
If the --install-langs option is missing, all\n\
|
|
||||||
locales are installed. The colon separated list\n\
|
|
||||||
can contain any strings matching the beginning of\n\
|
|
||||||
locale names.\n\
|
|
||||||
If a string does not contain a \"_\", it is added.\n\
|
|
||||||
Examples:\n\
|
|
||||||
--install-langs=\"en\"\n\
|
|
||||||
installs en_US, en_US.iso88591,\n\
|
|
||||||
en_US.iso885915, en_US.utf8,\n\
|
|
||||||
en_GB ...\n\
|
|
||||||
--install-langs=\"en_US.utf8\"\n\
|
|
||||||
installs only en_US.utf8.\n\
|
|
||||||
--install-langs=\"ko\"\n\
|
|
||||||
installs ko_KR, ko_KR.euckr,\n\
|
|
||||||
ko_KR.utf8 but *not* kok_IN\n\
|
|
||||||
because \"ko\" does not contain\n\
|
|
||||||
\"_\" and it is silently added\n\
|
|
||||||
--install-langs\"ko:kok\"\n\
|
|
||||||
installs ko_KR, ko_KR.euckr,\n\
|
|
||||||
ko_KR.utf8, kok_IN, and\n\
|
|
||||||
kok_IN.utf8.\n\
|
|
||||||
--install-langs=\"POSIX\" will\n\
|
|
||||||
installs *no* locales at all\n\
|
|
||||||
because POSIX matches none of\n\
|
|
||||||
the locales. Actually, any string\n\
|
|
||||||
matching nothing will do that.\n\
|
|
||||||
POSIX and C will always be\n\
|
|
||||||
available because they are\n\
|
|
||||||
builtin.\n\
|
|
||||||
Aliases are installed as well,\n\
|
|
||||||
i.e. --install-langs=\"de\"\n\
|
|
||||||
will install not only every locale starting with\n\
|
|
||||||
\"de\" but also the aliases \"deutsch\"\n\
|
|
||||||
and and \"german\" although the latter does not\n\
|
|
||||||
start with \"de\".\n\
|
|
||||||
\n\
|
|
||||||
If the arguments TEMPLATE-FILE and ARCHIVE-FILE are not given the locations\n\
|
|
||||||
where the glibc used expects these files are used by default.\n\
|
|
||||||
");
|
|
||||||
}
|
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
char path[4096];
|
|
||||||
DIR *dirp;
|
|
||||||
struct dirent64 *d;
|
|
||||||
struct stat64 st;
|
|
||||||
char *list[16384], *primary;
|
|
||||||
char *lang;
|
|
||||||
int install_langs_count = 0;
|
|
||||||
int i;
|
|
||||||
char *install_langs_arg, *ila_start;
|
|
||||||
char **install_langs_list = NULL;
|
|
||||||
unsigned int cnt = 0;
|
|
||||||
struct locarhandle tmpl_ah;
|
|
||||||
char *new_locar_fname = NULL;
|
|
||||||
size_t loc_path_len = strlen (loc_path);
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
|
|
||||||
static struct option long_options[] =
|
|
||||||
{
|
|
||||||
{"help", no_argument, 0, 'h'},
|
|
||||||
{"verbose", no_argument, 0, 'v'},
|
|
||||||
{"install-langs", required_argument, 0, 'l'},
|
|
||||||
{0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
/* getopt_long stores the option index here. */
|
|
||||||
int option_index = 0;
|
|
||||||
|
|
||||||
c = getopt_long (argc, argv, "vhl:",
|
|
||||||
long_options, &option_index);
|
|
||||||
|
|
||||||
/* Detect the end of the options. */
|
|
||||||
if (c == -1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
printf ("unknown option %s", long_options[option_index].name);
|
|
||||||
if (optarg)
|
|
||||||
printf (" with arg %s", optarg);
|
|
||||||
printf ("\n");
|
|
||||||
usage ();
|
|
||||||
exit (1);
|
|
||||||
|
|
||||||
case 'v':
|
|
||||||
verbose = 1;
|
|
||||||
be_quiet = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'h':
|
|
||||||
usage ();
|
|
||||||
exit (0);
|
|
||||||
|
|
||||||
case 'l':
|
|
||||||
install_langs_arg = ila_start = strdup (optarg);
|
|
||||||
/* If the argument to --install-lang is "all", do
|
|
||||||
not limit the list of languages to install and install
|
|
||||||
them all. We do not support installing a single locale
|
|
||||||
called "all". */
|
|
||||||
#define MAGIC_INSTALL_ALL "all"
|
|
||||||
if (install_langs_arg != NULL
|
|
||||||
&& install_langs_arg[0] != '\0'
|
|
||||||
&& !(strncmp(install_langs_arg, MAGIC_INSTALL_ALL,
|
|
||||||
strlen(MAGIC_INSTALL_ALL)) == 0
|
|
||||||
&& strlen (install_langs_arg) == 3))
|
|
||||||
{
|
|
||||||
/* Count the number of languages we will install. */
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
lang = strtok(install_langs_arg, ":;,");
|
|
||||||
if (lang == NULL)
|
|
||||||
break;
|
|
||||||
install_langs_count++;
|
|
||||||
install_langs_arg = NULL;
|
|
||||||
}
|
|
||||||
free (ila_start);
|
|
||||||
|
|
||||||
/* Reject an entire string made up of delimiters. */
|
|
||||||
if (install_langs_count == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Copy the list. */
|
|
||||||
install_langs_list = (char **)xmalloc (sizeof(char *) * install_langs_count);
|
|
||||||
install_langs_arg = ila_start = strdup (optarg);
|
|
||||||
install_langs_count = 0;
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
lang = strtok(install_langs_arg, ":;,");
|
|
||||||
if (lang == NULL)
|
|
||||||
break;
|
|
||||||
install_langs_list[install_langs_count] = lang;
|
|
||||||
install_langs_count++;
|
|
||||||
install_langs_arg = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '?':
|
|
||||||
/* getopt_long already printed an error message. */
|
|
||||||
usage ();
|
|
||||||
exit (0);
|
|
||||||
|
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tmpl_ah.fname = NULL;
|
|
||||||
if (optind < argc)
|
|
||||||
tmpl_ah.fname = argv[optind];
|
|
||||||
if (optind + 1 < argc)
|
|
||||||
new_locar_fname = argv[optind + 1];
|
|
||||||
if (verbose)
|
|
||||||
{
|
|
||||||
if (tmpl_ah.fname)
|
|
||||||
printf("input archive file specified on command line: %s\n",
|
|
||||||
tmpl_ah.fname);
|
|
||||||
else
|
|
||||||
printf("using default input archive file.\n");
|
|
||||||
if (new_locar_fname)
|
|
||||||
printf("output archive file specified on command line: %s\n",
|
|
||||||
new_locar_fname);
|
|
||||||
else
|
|
||||||
printf("using default output archive file.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
dirp = opendir (loc_path);
|
|
||||||
if (dirp == NULL)
|
|
||||||
error (EXIT_FAILURE, errno, "cannot open directory \"%s\"", loc_path);
|
|
||||||
|
|
||||||
open_tmpl_archive (&tmpl_ah);
|
|
||||||
|
|
||||||
if (new_locar_fname)
|
|
||||||
unlink (new_locar_fname);
|
|
||||||
else
|
|
||||||
unlink (locar_file);
|
|
||||||
primary = getenv ("LC_ALL");
|
|
||||||
if (primary == NULL)
|
|
||||||
primary = getenv ("LANG");
|
|
||||||
if (primary != NULL)
|
|
||||||
{
|
|
||||||
if (strncmp (primary, "ja", 2) != 0
|
|
||||||
&& strncmp (primary, "ko", 2) != 0
|
|
||||||
&& strncmp (primary, "zh", 2) != 0)
|
|
||||||
{
|
|
||||||
char *ptr = malloc (strlen (primary) + strlen (".utf8") + 1), *p, *q;
|
|
||||||
/* This leads to invalid locales sometimes:
|
|
||||||
de_DE.iso885915@euro -> de_DE.utf8@euro */
|
|
||||||
if (ptr != NULL)
|
|
||||||
{
|
|
||||||
p = ptr;
|
|
||||||
q = primary;
|
|
||||||
while (*q && *q != '.' && *q != '@')
|
|
||||||
*p++ = *q++;
|
|
||||||
if (*q == '.')
|
|
||||||
while (*q && *q != '@')
|
|
||||||
q++;
|
|
||||||
p = stpcpy (p, ".utf8");
|
|
||||||
strcpy (p, q);
|
|
||||||
primary = ptr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
primary = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy (path, loc_path, loc_path_len);
|
|
||||||
|
|
||||||
while ((d = readdir64 (dirp)) != NULL)
|
|
||||||
{
|
|
||||||
if (strcmp (d->d_name, ".") == 0 || strcmp (d->d_name, "..") == 0)
|
|
||||||
continue;
|
|
||||||
if (strchr (d->d_name, '_') == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
size_t d_name_len = strlen (d->d_name);
|
|
||||||
if (loc_path_len + d_name_len + 1 > sizeof (path))
|
|
||||||
{
|
|
||||||
error (0, 0, "too long filename \"%s\"", d->d_name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy (path + loc_path_len, d->d_name, d_name_len + 1);
|
|
||||||
if (stat64 (path, &st) < 0)
|
|
||||||
{
|
|
||||||
error (0, errno, "cannot stat \"%s\"", path);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (! S_ISDIR (st.st_mode))
|
|
||||||
continue;
|
|
||||||
if (cnt == 16384)
|
|
||||||
{
|
|
||||||
error (0, 0, "too many directories in \"%s\"", loc_path);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
list[cnt] = strdup (path);
|
|
||||||
if (list[cnt] == NULL)
|
|
||||||
{
|
|
||||||
error (0, errno, "cannot add file to list \"%s\"", path);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (primary != NULL && cnt > 0 && strcmp (primary, d->d_name) == 0)
|
|
||||||
{
|
|
||||||
char *p = list[0];
|
|
||||||
list[0] = list[cnt];
|
|
||||||
list[cnt] = p;
|
|
||||||
}
|
|
||||||
cnt++;
|
|
||||||
}
|
|
||||||
closedir (dirp);
|
|
||||||
/* Store the archive to the file specified as the second argument on the
|
|
||||||
command line or the default locale archive. */
|
|
||||||
fill_archive (&tmpl_ah, new_locar_fname,
|
|
||||||
install_langs_count, install_langs_list,
|
|
||||||
cnt, list, primary);
|
|
||||||
close_archive (&tmpl_ah);
|
|
||||||
truncate (tmpl_file, 0);
|
|
||||||
if (install_langs_count > 0)
|
|
||||||
{
|
|
||||||
free (ila_start);
|
|
||||||
free (install_langs_list);
|
|
||||||
}
|
|
||||||
char *tz_argv[] = { "/usr/sbin/tzdata-update", NULL };
|
|
||||||
execve (tz_argv[0], (char *const *)tz_argv, (char *const *)&tz_argv[1]);
|
|
||||||
exit (0);
|
|
||||||
}
|
|
||||||
26
delete-no-hard-link-to-avoid-all_language-package-to.patch
Normal file
26
delete-no-hard-link-to-avoid-all_language-package-to.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
From ba6891f0633d394a59d14f0a54090fa1b6260c16 Mon Sep 17 00:00:00 2001
|
||||||
|
From: buque <wuxu.wu@hotmail.com>
|
||||||
|
Date: Wed, 15 Jul 2020 15:09:54 +0800
|
||||||
|
Subject: [PATCH] delete --no-hard-link to avoid all_language package too
|
||||||
|
large.
|
||||||
|
|
||||||
|
---
|
||||||
|
Makefile | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/localedata/Makefile b/localedata/Makefile
|
||||||
|
index b8a3b67..c78d0fe 100644
|
||||||
|
--- a/localedata/Makefile
|
||||||
|
+++ b/localedata/Makefile
|
||||||
|
@@ -444,7 +444,7 @@ $(INSTALL-SUPPORTED-LOCALE-ARCHIVE): install-locales-dir
|
||||||
|
$(build-one-locale)
|
||||||
|
|
||||||
|
$(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir
|
||||||
|
- @flags="-c --no-archive --no-hard-links"; \
|
||||||
|
+ @flags="-c --no-archive"; \
|
||||||
|
$(build-one-locale)
|
||||||
|
|
||||||
|
tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
38
glibc-1070416.patch
Normal file
38
glibc-1070416.patch
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
Short description: Add syslog.target dependency.
|
||||||
|
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||||
|
Origin: PATCH
|
||||||
|
Bug-Fedora: #1070416
|
||||||
|
Upstream status: not-needed
|
||||||
|
|
||||||
|
Fedora-specific changes to the nscd.service file.
|
||||||
|
See also: glibc-nscd-sysconfig.patch.
|
||||||
|
|
||||||
|
--- a/nscd/nscd.service
|
||||||
|
+++ b/nscd/nscd.service
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Name Service Cache Daemon
|
||||||
|
+After=syslog.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
@@ -17,3 +18,4 @@
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
+Also=nscd.socket
|
||||||
|
diff --git a/nscd/nscd.socket b/nscd/nscd.socket
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..7e512d5
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/nscd/nscd.socket
|
||||||
|
@@ -0,0 +1,8 @@
|
||||||
|
+[Unit]
|
||||||
|
+Description=Name Service Cache Daemon Socket
|
||||||
|
+
|
||||||
|
+[Socket]
|
||||||
|
+ListenDatagram=/var/run/nscd/socket
|
||||||
|
+
|
||||||
|
+[Install]
|
||||||
|
+WantedBy=sockets.target
|
||||||
Binary file not shown.
286
glibc-c-utf8-locale.patch
Normal file
286
glibc-c-utf8-locale.patch
Normal file
@ -0,0 +1,286 @@
|
|||||||
|
Short description: Add C.UTF-8 support.
|
||||||
|
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||||
|
Origin: PATCH
|
||||||
|
Upstream status: not-submitted
|
||||||
|
|
||||||
|
This patch needs to upstream as part of Carlos O'Donell
|
||||||
|
<carlos@redhat.com>'s work on enabling upstream C.UTF-8 support. This
|
||||||
|
work is currently blocked on cleaning up the test results to prove that
|
||||||
|
full code-point sorting is working as intended.
|
||||||
|
|
||||||
|
Note that this patch does not provide full code-point sorting as
|
||||||
|
expected.
|
||||||
|
|
||||||
|
This patch needs to upstream as soon as possible since it would be nice
|
||||||
|
to have this in F29 and fixed.
|
||||||
|
|
||||||
|
From 2eda7b462b415105f5a05c1323372d4e39d46439 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike FABIAN <mfabian@redhat.com>
|
||||||
|
Date: Mon, 10 Aug 2015 15:58:12 +0200
|
||||||
|
Subject: [PATCH] Add a C.UTF-8 locale
|
||||||
|
|
||||||
|
---
|
||||||
|
localedata/SUPPORTED | 1 +
|
||||||
|
localedata/locales/C | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 239 insertions(+)
|
||||||
|
create mode 100644 localedata/locales/C
|
||||||
|
|
||||||
|
diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
|
||||||
|
index 8ca023e..2a78391 100644
|
||||||
|
--- a/localedata/SUPPORTED
|
||||||
|
+++ b/localedata/SUPPORTED
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
# This file names the currently supported and somewhat tested locales.
|
||||||
|
# If you have any additions please file a glibc bug report.
|
||||||
|
SUPPORTED-LOCALES=\
|
||||||
|
+C.UTF-8/UTF-8 \
|
||||||
|
aa_DJ.UTF-8/UTF-8 \
|
||||||
|
aa_DJ/ISO-8859-1 \
|
||||||
|
aa_ER/UTF-8 \
|
||||||
|
diff --git a/localedata/locales/C b/localedata/locales/C
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..fdf460e
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/localedata/locales/C
|
||||||
|
@@ -0,0 +1,238 @@
|
||||||
|
+escape_char /
|
||||||
|
+comment_char %
|
||||||
|
+% Locale for C locale in UTF-8
|
||||||
|
+
|
||||||
|
+LC_IDENTIFICATION
|
||||||
|
+title "C locale"
|
||||||
|
+source ""
|
||||||
|
+address ""
|
||||||
|
+contact ""
|
||||||
|
+email "mfabian@redhat.com"
|
||||||
|
+tel ""
|
||||||
|
+fax ""
|
||||||
|
+language "C"
|
||||||
|
+territory ""
|
||||||
|
+revision "1.0"
|
||||||
|
+date "2015-08-10"
|
||||||
|
+%
|
||||||
|
+category "i18n:2012";LC_IDENTIFICATION
|
||||||
|
+category "i18n:2012";LC_CTYPE
|
||||||
|
+category "i18n:2012";LC_COLLATE
|
||||||
|
+category "i18n:2012";LC_TIME
|
||||||
|
+category "i18n:2012";LC_NUMERIC
|
||||||
|
+category "i18n:2012";LC_MONETARY
|
||||||
|
+category "i18n:2012";LC_MESSAGES
|
||||||
|
+category "i18n:2012";LC_PAPER
|
||||||
|
+category "i18n:2012";LC_NAME
|
||||||
|
+category "i18n:2012";LC_ADDRESS
|
||||||
|
+category "i18n:2012";LC_TELEPHONE
|
||||||
|
+category "i18n:2012";LC_MEASUREMENT
|
||||||
|
+END LC_IDENTIFICATION
|
||||||
|
+
|
||||||
|
+LC_CTYPE
|
||||||
|
+copy "i18n"
|
||||||
|
+
|
||||||
|
+translit_start
|
||||||
|
+include "translit_combining";""
|
||||||
|
+translit_end
|
||||||
|
+
|
||||||
|
+END LC_CTYPE
|
||||||
|
+
|
||||||
|
+LC_COLLATE
|
||||||
|
+order_start forward
|
||||||
|
+<U0000>
|
||||||
|
+..
|
||||||
|
+<UFFFF>
|
||||||
|
+<U00010000>
|
||||||
|
+..
|
||||||
|
+<U0001FFFF>
|
||||||
|
+<U00020000>
|
||||||
|
+..
|
||||||
|
+<U0002FFFF>
|
||||||
|
+<U000E0000>
|
||||||
|
+..
|
||||||
|
+<U000EFFFF>
|
||||||
|
+<U000F0000>
|
||||||
|
+..
|
||||||
|
+<U000FFFFF>
|
||||||
|
+<U00100000>
|
||||||
|
+..
|
||||||
|
+<U0010FFFF>
|
||||||
|
+UNDEFINED
|
||||||
|
+order_end
|
||||||
|
+END LC_COLLATE
|
||||||
|
+
|
||||||
|
+LC_MONETARY
|
||||||
|
+% This is the 14652 i18n fdcc-set definition for
|
||||||
|
+% the LC_MONETARY category
|
||||||
|
+% (except for the int_curr_symbol and currency_symbol, they are empty in
|
||||||
|
+% the 14652 i18n fdcc-set definition and also empty in
|
||||||
|
+% glibc/locale/C-monetary.c. But localedef complains in that case).
|
||||||
|
+%
|
||||||
|
+% Using "USD" for int_curr_symbol. But maybe "XXX" would be better?
|
||||||
|
+% XXX is "No currency" (https://en.wikipedia.org/wiki/ISO_4217)
|
||||||
|
+int_curr_symbol "<U0055><U0053><U0044><U0020>"
|
||||||
|
+% Using "$" for currency_symbol. But maybe <U00A4> would be better?
|
||||||
|
+% U+00A4 is the "generic currency symbol"
|
||||||
|
+% (https://en.wikipedia.org/wiki/Currency_sign_%28typography%29)
|
||||||
|
+currency_symbol "<U0024>"
|
||||||
|
+mon_decimal_point "<U002E>"
|
||||||
|
+mon_thousands_sep ""
|
||||||
|
+mon_grouping -1
|
||||||
|
+positive_sign ""
|
||||||
|
+negative_sign "<U002D>"
|
||||||
|
+int_frac_digits -1
|
||||||
|
+frac_digits -1
|
||||||
|
+p_cs_precedes -1
|
||||||
|
+int_p_sep_by_space -1
|
||||||
|
+p_sep_by_space -1
|
||||||
|
+n_cs_precedes -1
|
||||||
|
+int_n_sep_by_space -1
|
||||||
|
+n_sep_by_space -1
|
||||||
|
+p_sign_posn -1
|
||||||
|
+n_sign_posn -1
|
||||||
|
+%
|
||||||
|
+END LC_MONETARY
|
||||||
|
+
|
||||||
|
+LC_NUMERIC
|
||||||
|
+% This is the POSIX Locale definition for
|
||||||
|
+% the LC_NUMERIC category.
|
||||||
|
+%
|
||||||
|
+decimal_point "<U002E>"
|
||||||
|
+thousands_sep ""
|
||||||
|
+grouping -1
|
||||||
|
+END LC_NUMERIC
|
||||||
|
+
|
||||||
|
+LC_TIME
|
||||||
|
+% This is the POSIX Locale definition for
|
||||||
|
+% the LC_TIME category.
|
||||||
|
+%
|
||||||
|
+% Abbreviated weekday names (%a)
|
||||||
|
+abday "<U0053><U0075><U006E>";"<U004D><U006F><U006E>";/
|
||||||
|
+ "<U0054><U0075><U0065>";"<U0057><U0065><U0064>";/
|
||||||
|
+ "<U0054><U0068><U0075>";"<U0046><U0072><U0069>";/
|
||||||
|
+ "<U0053><U0061><U0074>"
|
||||||
|
+
|
||||||
|
+% Full weekday names (%A)
|
||||||
|
+day "<U0053><U0075><U006E><U0064><U0061><U0079>";/
|
||||||
|
+ "<U004D><U006F><U006E><U0064><U0061><U0079>";/
|
||||||
|
+ "<U0054><U0075><U0065><U0073><U0064><U0061><U0079>";/
|
||||||
|
+ "<U0057><U0065><U0064><U006E><U0065><U0073><U0064><U0061><U0079>";/
|
||||||
|
+ "<U0054><U0068><U0075><U0072><U0073><U0064><U0061><U0079>";/
|
||||||
|
+ "<U0046><U0072><U0069><U0064><U0061><U0079>";/
|
||||||
|
+ "<U0053><U0061><U0074><U0075><U0072><U0064><U0061><U0079>"
|
||||||
|
+
|
||||||
|
+% Abbreviated month names (%b)
|
||||||
|
+abmon "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
|
||||||
|
+ "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/
|
||||||
|
+ "<U004D><U0061><U0079>";"<U004A><U0075><U006E>";/
|
||||||
|
+ "<U004A><U0075><U006C>";"<U0041><U0075><U0067>";/
|
||||||
|
+ "<U0053><U0065><U0070>";"<U004F><U0063><U0074>";/
|
||||||
|
+ "<U004E><U006F><U0076>";"<U0044><U0065><U0063>"
|
||||||
|
+
|
||||||
|
+% Full month names (%B)
|
||||||
|
+mon "<U004A><U0061><U006E><U0075><U0061><U0072><U0079>";/
|
||||||
|
+ "<U0046><U0065><U0062><U0072><U0075><U0061><U0072><U0079>";/
|
||||||
|
+ "<U004D><U0061><U0072><U0063><U0068>";/
|
||||||
|
+ "<U0041><U0070><U0072><U0069><U006C>";/
|
||||||
|
+ "<U004D><U0061><U0079>";/
|
||||||
|
+ "<U004A><U0075><U006E><U0065>";/
|
||||||
|
+ "<U004A><U0075><U006C><U0079>";/
|
||||||
|
+ "<U0041><U0075><U0067><U0075><U0073><U0074>";/
|
||||||
|
+ "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/
|
||||||
|
+ "<U004F><U0063><U0074><U006F><U0062><U0065><U0072>";/
|
||||||
|
+ "<U004E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
|
||||||
|
+ "<U0044><U0065><U0063><U0065><U006D><U0062><U0065><U0072>"
|
||||||
|
+
|
||||||
|
+% Week description, consists of three fields:
|
||||||
|
+% 1. Number of days in a week.
|
||||||
|
+% 2. Gregorian date that is a first weekday (19971130 for Sunday, 19971201 for Monday).
|
||||||
|
+% 3. The weekday number to be contained in the first week of the year.
|
||||||
|
+%
|
||||||
|
+% ISO 8601 conforming applications should use the values 7, 19971201 (a
|
||||||
|
+% Monday), and 4 (Thursday), respectively.
|
||||||
|
+week 7;19971201;4
|
||||||
|
+first_weekday 1
|
||||||
|
+first_workday 1
|
||||||
|
+
|
||||||
|
+% Appropriate date and time representation (%c)
|
||||||
|
+% "%a %b %e %H:%M:%S %Y"
|
||||||
|
+d_t_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0059>"
|
||||||
|
+
|
||||||
|
+% Appropriate date representation (%x)
|
||||||
|
+% "%m/%d/%y"
|
||||||
|
+d_fmt "<U0025><U006D><U002F><U0025><U0064><U002F><U0025><U0079>"
|
||||||
|
+
|
||||||
|
+% Appropriate time representation (%X)
|
||||||
|
+% "%H:%M:%S"
|
||||||
|
+t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
|
||||||
|
+
|
||||||
|
+% Appropriate AM/PM time representation (%r)
|
||||||
|
+% "%I:%M:%S %p"
|
||||||
|
+t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070>"
|
||||||
|
+
|
||||||
|
+% Equivalent of AM/PM (%p) "AM"/"PM"
|
||||||
|
+%
|
||||||
|
+am_pm "<U0041><U004D>";"<U0050><U004D>"
|
||||||
|
+
|
||||||
|
+% Appropriate date representation (date(1)) "%a %b %e %H:%M:%S %Z %Y"
|
||||||
|
+date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A><U0020><U0025><U0059>"
|
||||||
|
+END LC_TIME
|
||||||
|
+
|
||||||
|
+LC_MESSAGES
|
||||||
|
+% This is the POSIX Locale definition for
|
||||||
|
+% the LC_NUMERIC category.
|
||||||
|
+%
|
||||||
|
+yesexpr "<U005E><U005B><U0079><U0059><U005D>"
|
||||||
|
+noexpr "<U005E><U005B><U006E><U004E><U005D>"
|
||||||
|
+yesstr "<U0059><U0065><U0073>"
|
||||||
|
+nostr "<U004E><U006F>"
|
||||||
|
+END LC_MESSAGES
|
||||||
|
+
|
||||||
|
+LC_PAPER
|
||||||
|
+% This is the ISO/IEC 14652 "i18n" definition for
|
||||||
|
+% the LC_PAPER category.
|
||||||
|
+% (A4 paper, this is also used in the built in C/POSIX
|
||||||
|
+% locale in glibc/locale/C-paper.c)
|
||||||
|
+height 297
|
||||||
|
+width 210
|
||||||
|
+END LC_PAPER
|
||||||
|
+
|
||||||
|
+LC_NAME
|
||||||
|
+% This is the ISO/IEC 14652 "i18n" definition for
|
||||||
|
+% the LC_NAME category.
|
||||||
|
+% "%p%t%g%t%m%t%f"
|
||||||
|
+% (also used in the built in C/POSIX locale in glibc/locale/C-name.c)
|
||||||
|
+name_fmt "<U0025><U0070><U0025><U0074><U0025><U0067><U0025><U0074>/
|
||||||
|
+<U0025><U006D><U0025><U0074><U0025><U0066>"
|
||||||
|
+END LC_NAME
|
||||||
|
+
|
||||||
|
+LC_ADDRESS
|
||||||
|
+% This is the ISO/IEC 14652 "i18n" definition for
|
||||||
|
+% the LC_ADDRESS category.
|
||||||
|
+% "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N"
|
||||||
|
+% (also used in the built in C/POSIX locale in glibc/locale/C-address.c)
|
||||||
|
+postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E>/
|
||||||
|
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
|
||||||
|
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
|
||||||
|
+<U004E><U0025><U0043><U002D><U0025><U007A><U0020><U0025><U0054><U0025>/
|
||||||
|
+<U004E><U0025><U0063><U0025><U004E>"
|
||||||
|
+END LC_ADDRESS
|
||||||
|
+
|
||||||
|
+LC_TELEPHONE
|
||||||
|
+% This is the ISO/IEC 14652 "i18n" definition for
|
||||||
|
+% the LC_TELEPHONE category.
|
||||||
|
+% "+%c %a %l"
|
||||||
|
+tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
|
||||||
|
+<U006C>"
|
||||||
|
+% (also used in the built in C/POSIX locale in glibc/locale/C-telephone.c)
|
||||||
|
+END LC_TELEPHONE
|
||||||
|
+
|
||||||
|
+LC_MEASUREMENT
|
||||||
|
+% This is the ISO/IEC 14652 "i18n" definition for
|
||||||
|
+% the LC_MEASUREMENT category.
|
||||||
|
+% (same as in the built in C/POSIX locale in glibc/locale/C-measurement.c)
|
||||||
|
+%metric
|
||||||
|
+measurement 1
|
||||||
|
+END LC_MEASUREMENT
|
||||||
|
+
|
||||||
|
--
|
||||||
|
2.4.3
|
||||||
|
|
||||||
246
glibc.spec
246
glibc.spec
@ -58,33 +58,34 @@
|
|||||||
# glibc - The GNU C Library (glibc) core package.
|
# glibc - The GNU C Library (glibc) core package.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
Name: glibc
|
Name: glibc
|
||||||
Version: 2.28
|
Version: 2.31
|
||||||
Release: 45
|
Release: 1
|
||||||
Summary: The GNU libc libraries
|
Summary: The GNU libc libraries
|
||||||
License: %{all_license}
|
License: %{all_license}
|
||||||
URL: http://www.gnu.org/software/glibc/
|
URL: http://www.gnu.org/software/glibc/
|
||||||
|
|
||||||
Source0: https://ftp.gnu.org/gnu/glibc/%{name}-%{version}.tar.xz
|
Source0: https://ftp.gnu.org/gnu/glibc/%{name}-%{version}.tar.xz
|
||||||
Source1: build-locale-archive.c
|
Source1: nscd.conf
|
||||||
Source2: nscd.conf
|
Source2: nsswitch.conf
|
||||||
Source3: nsswitch.conf
|
Source3: bench.mk
|
||||||
Source4: bench.mk
|
Source4: glibc-bench-compare
|
||||||
Source5: glibc-bench-compare
|
Source5: LanguageList
|
||||||
Source6: LicenseList
|
Source6: LicenseList
|
||||||
Source7: LanguageList
|
|
||||||
|
|
||||||
Patch0: Fix-use-after-free-in-glob-when-expanding-user-bug-2.patch
|
Patch0: glibc-1070416.patch
|
||||||
Patch1: backport-Kunpeng-patches.patch
|
Patch1: glibc-c-utf8-locale.patch
|
||||||
Patch2: Avoid-ldbl-96-stack-corruption-from-range-reduction-.patch
|
|
||||||
Patch3: backport-CVE-2020-1751-Fix-array-overflow-in-backtrace-on-PowerPC-bug-25423.patch
|
Patch6000: Fix-use-after-free-in-glob-when-expanding-user-bug-2.patch
|
||||||
Patch4: Do-not-use-gettimeofday-in-random-id.patch
|
Patch6001: Avoid-ldbl-96-stack-corruption-from-range-reduction-.patch
|
||||||
Patch5: Reset-converter-state-after-second-wchar_t-output-Bu.patch
|
Patch6002: Reset-converter-state-after-second-wchar_t-output-Bu.patch
|
||||||
Patch6: Fix-avx2-strncmp-offset-compare-condition-check-BZ-2.patch
|
Patch6003: Fix-avx2-strncmp-offset-compare-condition-check-BZ-2.patch
|
||||||
Patch7: nptl-wait-for-pending-setxid-request-also-in-detache.patch
|
Patch6004: nptl-wait-for-pending-setxid-request-also-in-detache.patch
|
||||||
Patch8: x86-64-Use-RDX_LP-on-__x86_shared_non_temporal_thres.patch
|
Patch6005: x86-64-Use-RDX_LP-on-__x86_shared_non_temporal_thres.patch
|
||||||
Patch9: x86_64-Use-xmmN-with-vpxor-to-clear-a-vector-registe.patch
|
Patch6006: x86_64-Use-xmmN-with-vpxor-to-clear-a-vector-registe.patch
|
||||||
Patch10: nptl-Don-t-madvise-user-provided-stack.patch
|
Patch6007: nptl-Don-t-madvise-user-provided-stack.patch
|
||||||
Patch11: turn-REP_STOSB_THRESHOLD-from-2k-to-1M.patch
|
Patch6008: turn-REP_STOSB_THRESHOLD-from-2k-to-1M.patch
|
||||||
|
|
||||||
|
Patch9000: delete-no-hard-link-to-avoid-all_language-package-to.patch
|
||||||
|
|
||||||
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
|
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ BuildRequires: gcc-c++ libstdc++-static glibc-devel libidn2
|
|||||||
|
|
||||||
Requires: glibc-common = %{version}-%{release}
|
Requires: glibc-common = %{version}-%{release}
|
||||||
Requires: glibc-langpack = %{version}-%{release}
|
Requires: glibc-langpack = %{version}-%{release}
|
||||||
Requires(pre): basesystem
|
Requires: basesystem
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The GNU C Library project provides the core libraries for the GNU system and
|
The GNU C Library project provides the core libraries for the GNU system and
|
||||||
@ -174,7 +175,7 @@ Obsoletes: %{name}-minimal-langpack = 2.28
|
|||||||
%{lua:
|
%{lua:
|
||||||
-- List the Symbol provided by all-langpacks
|
-- List the Symbol provided by all-langpacks
|
||||||
lang_provides = {}
|
lang_provides = {}
|
||||||
for line in io.lines(rpm.expand("%{SOURCE7}")) do
|
for line in io.lines(rpm.expand("%{SOURCE5}")) do
|
||||||
print(rpm.expand([[
|
print(rpm.expand([[
|
||||||
Provides:]]..line..[[ = %{version}-%{release}
|
Provides:]]..line..[[ = %{version}-%{release}
|
||||||
Obsoletes:]]..line..[[ = 2.28
|
Obsoletes:]]..line..[[ = 2.28
|
||||||
@ -208,7 +209,8 @@ Requires: %{name} = %{version}-%{release}
|
|||||||
Requires: libgcc%{_isa}
|
Requires: libgcc%{_isa}
|
||||||
Requires(pre): info
|
Requires(pre): info
|
||||||
Requires(pre): kernel-headers
|
Requires(pre): kernel-headers
|
||||||
Requires: kernel-headers >= 2.2.1
|
Requires(pre): coreutils
|
||||||
|
Requires: kernel-headers >= 3.2
|
||||||
%if 0%{rpm_version_ge_412}
|
%if 0%{rpm_version_ge_412}
|
||||||
Requires: libxcrypt-devel%{_isa} >= 4.0.0
|
Requires: libxcrypt-devel%{_isa} >= 4.0.0
|
||||||
Requires: libxcrypt-static%{?_isa} >= 4.0.0
|
Requires: libxcrypt-static%{?_isa} >= 4.0.0
|
||||||
@ -380,7 +382,7 @@ touch locale/programs/*-kw.h
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
%build
|
%build
|
||||||
|
|
||||||
BuildFlags="-O2 -g -Wno-error"
|
BuildFlags="-O2 -g"
|
||||||
BuildFlags="$BuildFlags -DNDEBUG"
|
BuildFlags="$BuildFlags -DNDEBUG"
|
||||||
reference=" \
|
reference=" \
|
||||||
"-Wp,-D_GLIBCXX_ASSERTIONS" \
|
"-Wp,-D_GLIBCXX_ASSERTIONS" \
|
||||||
@ -390,6 +392,7 @@ reference=" \
|
|||||||
"-m31" \
|
"-m31" \
|
||||||
"-m32" \
|
"-m32" \
|
||||||
"-m64" \
|
"-m64" \
|
||||||
|
"-march=haswell" \
|
||||||
"-march=i686" \
|
"-march=i686" \
|
||||||
"-march=x86-64" \
|
"-march=x86-64" \
|
||||||
"-march=z13" \
|
"-march=z13" \
|
||||||
@ -475,7 +478,7 @@ pushd build-%{target}
|
|||||||
# or create a hard link if there already has a output file who's input is the same,
|
# or create a hard link if there already has a output file who's input is the same,
|
||||||
# so when we use parallel compilation, it will lead to different results, and this will cause BEP inconsistence.
|
# so when we use parallel compilation, it will lead to different results, and this will cause BEP inconsistence.
|
||||||
make -j1 install_root=$RPM_BUILD_ROOT \
|
make -j1 install_root=$RPM_BUILD_ROOT \
|
||||||
install-locales -C ../localedata objdir=`pwd`
|
install-locale-files -C ../localedata objdir=`pwd`
|
||||||
popd
|
popd
|
||||||
|
|
||||||
rm -f $RPM_BUILD_ROOT/%{_libdir}/libNoVersion*
|
rm -f $RPM_BUILD_ROOT/%{_libdir}/libNoVersion*
|
||||||
@ -513,16 +516,15 @@ rm -f locale-archive
|
|||||||
$olddir/build-%{target}/elf/ld.so \
|
$olddir/build-%{target}/elf/ld.so \
|
||||||
--library-path $olddir/build-%{target}/ \
|
--library-path $olddir/build-%{target}/ \
|
||||||
$olddir/build-%{target}/locale/localedef \
|
$olddir/build-%{target}/locale/localedef \
|
||||||
|
--alias-file=$olddir/intl/locale.alias \
|
||||||
--prefix $RPM_BUILD_ROOT --add-to-archive \
|
--prefix $RPM_BUILD_ROOT --add-to-archive \
|
||||||
*_*
|
eo *_*
|
||||||
# Setup the locale-archive template for use by glibc-all-langpacks.
|
|
||||||
mv locale-archive{,.tmpl}
|
|
||||||
%{find_lang} libc
|
%{find_lang} libc
|
||||||
popd
|
popd
|
||||||
mv $RPM_BUILD_ROOT%{_prefix}/lib/locale/libc.lang .
|
mv $RPM_BUILD_ROOT%{_prefix}/lib/locale/libc.lang .
|
||||||
|
|
||||||
# Install configuration files for services
|
# Install configuration files for services
|
||||||
install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/nsswitch.conf
|
install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/nsswitch.conf
|
||||||
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/default
|
mkdir -p $RPM_BUILD_ROOT/etc/default
|
||||||
install -p -m 644 nis/nss $RPM_BUILD_ROOT/etc/default/nss
|
install -p -m 644 nis/nss $RPM_BUILD_ROOT/etc/default/nss
|
||||||
@ -530,7 +532,7 @@ install -p -m 644 nis/nss $RPM_BUILD_ROOT/etc/default/nss
|
|||||||
# This is for ncsd - in glibc 2.2
|
# This is for ncsd - in glibc 2.2
|
||||||
install -m 644 nscd/nscd.conf $RPM_BUILD_ROOT/etc
|
install -m 644 nscd/nscd.conf $RPM_BUILD_ROOT/etc
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir}
|
mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir}
|
||||||
install -m 644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}
|
install -m 644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}
|
||||||
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system
|
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system
|
||||||
install -m 644 nscd/nscd.service nscd/nscd.socket $RPM_BUILD_ROOT/lib/systemd/system
|
install -m 644 nscd/nscd.service nscd/nscd.socket $RPM_BUILD_ROOT/lib/systemd/system
|
||||||
|
|
||||||
@ -547,10 +549,6 @@ truncate -s 0 $RPM_BUILD_ROOT/etc/gai.conf
|
|||||||
truncate -s 0 $RPM_BUILD_ROOT%{_libdir}/gconv/gconv-modules.cache
|
truncate -s 0 $RPM_BUILD_ROOT%{_libdir}/gconv/gconv-modules.cache
|
||||||
chmod 644 $RPM_BUILD_ROOT%{_libdir}/gconv/gconv-modules.cache
|
chmod 644 $RPM_BUILD_ROOT%{_libdir}/gconv/gconv-modules.cache
|
||||||
|
|
||||||
# Install the upgrade program
|
|
||||||
install -m 700 build-%{target}/elf/glibc_post_upgrade \
|
|
||||||
$RPM_BUILD_ROOT%{_prefix}/sbin/glibc_post_upgrade.%{_target_cpu}
|
|
||||||
|
|
||||||
# Install debug copies of unstripped static libraries
|
# Install debug copies of unstripped static libraries
|
||||||
%if 0%{?_enable_debug_packages}
|
%if 0%{?_enable_debug_packages}
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/debug%{_libdir}
|
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/debug%{_libdir}
|
||||||
@ -565,20 +563,6 @@ rm -rf $RPM_BUILD_ROOT%{_prefix}/share/zoneinfo
|
|||||||
touch -r %{SOURCE0} $RPM_BUILD_ROOT/etc/ld.so.conf
|
touch -r %{SOURCE0} $RPM_BUILD_ROOT/etc/ld.so.conf
|
||||||
touch -r sunrpc/etc.rpc $RPM_BUILD_ROOT/etc/rpc
|
touch -r sunrpc/etc.rpc $RPM_BUILD_ROOT/etc/rpc
|
||||||
|
|
||||||
pushd build-%{target}
|
|
||||||
%GCC -Os -g -o build-locale-archive %{SOURCE1} \
|
|
||||||
../build-%{target}/locale/locarchive.o \
|
|
||||||
../build-%{target}/locale/md5.o \
|
|
||||||
../build-%{target}/locale/record-status.o \
|
|
||||||
-I. -DDATADIR=\"%{_datadir}\" -DPREFIX=\"%{_prefix}\" \
|
|
||||||
-L../build-%{target} \
|
|
||||||
-B../build-%{target}/csu/ -lc -lc_nonshared \
|
|
||||||
-Wl,-dynamic-linker=/lib64/ld-%{version}.so \
|
|
||||||
-Wl,-rpath-link=.:./math:./elf:./dlfcn:./nss:./rt:./resolv:./mathvec:./support:./nptl libc.so.6 libc_nonshared.a \
|
|
||||||
-Wl,--as-needed $olddir/build-%{target}/elf/ld.so
|
|
||||||
install -m 700 build-locale-archive $RPM_BUILD_ROOT%{_prefix}/sbin/build-locale-archive
|
|
||||||
popd
|
|
||||||
|
|
||||||
# Lastly copy some additional documentation for the packages.
|
# Lastly copy some additional documentation for the packages.
|
||||||
rm -rf documentation
|
rm -rf documentation
|
||||||
mkdir documentation
|
mkdir documentation
|
||||||
@ -596,7 +580,7 @@ mkdir -p $RPM_BUILD_ROOT%{_prefix}/libexec/glibc-benchtests
|
|||||||
cp $(find build-%{target}/benchtests -type f -executable) $RPM_BUILD_ROOT%{_prefix}/libexec/glibc-benchtests/
|
cp $(find build-%{target}/benchtests -type f -executable) $RPM_BUILD_ROOT%{_prefix}/libexec/glibc-benchtests/
|
||||||
|
|
||||||
#makefile.
|
#makefile.
|
||||||
for b in %{SOURCE4} %{SOURCE5}; do
|
for b in %{SOURCE3} %{SOURCE4}; do
|
||||||
cp $b $RPM_BUILD_ROOT%{_prefix}/libexec/glibc-benchtests/
|
cp $b $RPM_BUILD_ROOT%{_prefix}/libexec/glibc-benchtests/
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -618,7 +602,6 @@ popd
|
|||||||
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
truncate -s 0 $RPM_BUILD_ROOT/%{_prefix}/lib/locale/locale-archive
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/var/{db,run}/nscd
|
mkdir -p $RPM_BUILD_ROOT/var/{db,run}/nscd
|
||||||
touch $RPM_BUILD_ROOT/var/{db,run}/nscd/{passwd,group,hosts,services}
|
touch $RPM_BUILD_ROOT/var/{db,run}/nscd/{passwd,group,hosts,services}
|
||||||
touch $RPM_BUILD_ROOT/var/run/nscd/{socket,nscd.pid}
|
touch $RPM_BUILD_ROOT/var/run/nscd/{socket,nscd.pid}
|
||||||
@ -706,14 +689,13 @@ cat master.filelist \
|
|||||||
-e 'nscd' \
|
-e 'nscd' \
|
||||||
-e '%{_prefix}/bin' \
|
-e '%{_prefix}/bin' \
|
||||||
-e '%{_prefix}/lib/locale' \
|
-e '%{_prefix}/lib/locale' \
|
||||||
-e '%{_prefix}/sbin/[^gi]' \
|
-e '%{_prefix}/sbin/[^i]' \
|
||||||
-e '%{_prefix}/share' \
|
-e '%{_prefix}/share' \
|
||||||
-e '/var/db/Makefile' \
|
-e '/var/db/Makefile' \
|
||||||
-e '/libnss_.*\.so[0-9.]*$' \
|
-e '/libnss_.*\.so[0-9.]*$' \
|
||||||
-e '/libnsl' \
|
-e '/libnsl' \
|
||||||
-e 'glibc-benchtests' \
|
-e 'glibc-benchtests' \
|
||||||
-e 'aux-cache' \
|
-e 'aux-cache' \
|
||||||
-e 'build-locale-archive' \
|
|
||||||
> glibc.filelist
|
> glibc.filelist
|
||||||
|
|
||||||
for module in compat files dns; do
|
for module in compat files dns; do
|
||||||
@ -728,7 +710,8 @@ grep -e "libmemusage.so" -e "libpcprofile.so" master.filelist >> glibc.filelist
|
|||||||
# glibc "common" sub-package
|
# glibc "common" sub-package
|
||||||
##############################################################################
|
##############################################################################
|
||||||
grep '%{_prefix}/bin' master.filelist > common.filelist
|
grep '%{_prefix}/bin' master.filelist > common.filelist
|
||||||
grep '%{_prefix}/sbin/[^gi]' master.filelist \
|
grep '%{_prefix}/sbin' master.filelist \
|
||||||
|
| grep -v '%{_prefix}/sbin/iconvconfig' \
|
||||||
| grep -v 'nscd' >> common.filelist
|
| grep -v 'nscd' >> common.filelist
|
||||||
|
|
||||||
grep '%{_prefix}/share' master.filelist \
|
grep '%{_prefix}/share' master.filelist \
|
||||||
@ -738,8 +721,6 @@ grep '%{_prefix}/share' master.filelist \
|
|||||||
-e '%%dir %{prefix}/share' \
|
-e '%%dir %{prefix}/share' \
|
||||||
>> common.filelist
|
>> common.filelist
|
||||||
|
|
||||||
echo '%{_prefix}/sbin/build-locale-archive' >> common.filelist
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# glibc "devel" sub-package
|
# glibc "devel" sub-package
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -808,7 +789,7 @@ find build-%{target}/benchtests -type f -executable | while read b; do
|
|||||||
echo "%{_prefix}/libexec/glibc-benchtests/$(basename $b)"
|
echo "%{_prefix}/libexec/glibc-benchtests/$(basename $b)"
|
||||||
done > benchtests.filelist
|
done > benchtests.filelist
|
||||||
# ... and the makefile.
|
# ... and the makefile.
|
||||||
for b in %{SOURCE4} %{SOURCE5}; do
|
for b in %{SOURCE3} %{SOURCE4}; do
|
||||||
echo "%{_prefix}/libexec/glibc-benchtests/$(basename $b)" >> benchtests.filelist
|
echo "%{_prefix}/libexec/glibc-benchtests/$(basename $b)" >> benchtests.filelist
|
||||||
done
|
done
|
||||||
# ... and finally, the comparison scripts.
|
# ... and finally, the comparison scripts.
|
||||||
@ -859,6 +840,7 @@ remove_dir="$remove_dir $(echo %{_prefix}/lib/debug%{_prefix}{,/%{_lib},/libexec
|
|||||||
for d in $(echo $remove_dir | sed 's/ /\n/g'); do
|
for d in $(echo $remove_dir | sed 's/ /\n/g'); do
|
||||||
sed -i "\|^%%dir $d/\?$|d" debuginfo.filelist
|
sed -i "\|^%%dir $d/\?$|d" debuginfo.filelist
|
||||||
done
|
done
|
||||||
|
|
||||||
%endif # %{with benchtests}
|
%endif # %{with benchtests}
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Run the glibc testsuite
|
# Run the glibc testsuite
|
||||||
@ -933,20 +915,131 @@ if rpm.vercmp(rel, required) < 0 then
|
|||||||
error("FATAL: kernel too old", 0)
|
error("FATAL: kernel too old", 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
%post -p %{_prefix}/sbin/glibc_post_upgrade.%{_target_cpu}
|
%post -p <lua>
|
||||||
|
-- We use lua's posix.exec because there may be no shell that we can
|
||||||
%posttrans common -e -p <lua>
|
-- run during glibc upgrade.
|
||||||
if posix.stat("%{_prefix}/lib/locale/locale-archive.tmpl", "size") > 0 then
|
function post_exec (program, ...)
|
||||||
pid = posix.fork()
|
local pid = posix.fork ()
|
||||||
if pid == 0 then
|
if pid == 0 then
|
||||||
posix.exec("%{_prefix}/sbin/build-locale-archive", "--install-langs", "%%{_install_langs}")
|
assert (posix.exec (program, ...))
|
||||||
elseif pid > 0 then
|
elseif pid > 0 then
|
||||||
posix.wait(pid)
|
posix.wait (pid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
%postun common -p <lua>
|
-- (1) Remove multilib libraries from previous installs.
|
||||||
os.remove("%{_prefix}/lib/locale/locale-archive")
|
-- In order to support in-place upgrades, we must immediately remove
|
||||||
|
-- obsolete platform directories after installing a new glibc
|
||||||
|
-- version. RPM only deletes files removed by updates near the end
|
||||||
|
-- of the transaction. If we did not remove the obsolete platform
|
||||||
|
-- directories here, they may be preferred by the dynamic linker
|
||||||
|
-- during the execution of subsequent RPM scriptlets, likely
|
||||||
|
-- resulting in process startup failures.
|
||||||
|
|
||||||
|
-- Full set of libraries glibc may install.
|
||||||
|
install_libs = { "anl", "BrokenLocale", "c", "dl", "m", "mvec",
|
||||||
|
"nss_compat", "nss_db", "nss_dns", "nss_files",
|
||||||
|
"nss_hesiod", "pthread", "resolv", "rt", "SegFault",
|
||||||
|
"thread_db", "util" }
|
||||||
|
|
||||||
|
-- We are going to remove these libraries. Generally speaking we remove
|
||||||
|
-- all core libraries in the multilib directory.
|
||||||
|
-- We employ a tight match where X.Y is in [2.0,9.9*], so we would
|
||||||
|
-- match "libc-2.0.so" and so on up to "libc-9.9*".
|
||||||
|
remove_regexps = {}
|
||||||
|
for i = 1, #install_libs do
|
||||||
|
remove_regexps[i] = ("lib" .. install_libs[i]
|
||||||
|
.. "%%-[2-9]%%.[0-9]+%%.so$")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Two exceptions:
|
||||||
|
remove_regexps[#install_libs + 1] = "libthread_db%%-1%%.0%%.so"
|
||||||
|
remove_regexps[#install_libs + 2] = "libSegFault%%.so"
|
||||||
|
|
||||||
|
-- We are going to search these directories.
|
||||||
|
local remove_dirs = { "%{_libdir}/i686",
|
||||||
|
"%{_libdir}/i686/nosegneg" }
|
||||||
|
|
||||||
|
-- Walk all the directories with files we need to remove...
|
||||||
|
for _, rdir in ipairs (remove_dirs) do
|
||||||
|
if posix.access (rdir) then
|
||||||
|
-- If the directory exists we look at all the files...
|
||||||
|
local remove_files = posix.files (rdir)
|
||||||
|
for rfile in remove_files do
|
||||||
|
for _, rregexp in ipairs (remove_regexps) do
|
||||||
|
-- Does it match the regexp?
|
||||||
|
local dso = string.match (rfile, rregexp)
|
||||||
|
if (dso ~= nil) then
|
||||||
|
-- Removing file...
|
||||||
|
os.remove (rdir .. '/' .. rfile)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- (2) Update /etc/ld.so.conf
|
||||||
|
-- Next we update /etc/ld.so.conf to ensure that it starts with
|
||||||
|
-- a literal "include ld.so.conf.d/*.conf".
|
||||||
|
|
||||||
|
local ldsoconf = "/etc/ld.so.conf"
|
||||||
|
local ldsoconf_tmp = "/etc/glibc_post_upgrade.ld.so.conf"
|
||||||
|
|
||||||
|
if posix.access (ldsoconf) then
|
||||||
|
|
||||||
|
-- We must have a "include ld.so.conf.d/*.conf" line.
|
||||||
|
local have_include = false
|
||||||
|
for line in io.lines (ldsoconf) do
|
||||||
|
-- This must match, and we don't ignore whitespace.
|
||||||
|
if string.match (line, "^include ld.so.conf.d/%%*%%.conf$") ~= nil then
|
||||||
|
have_include = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not have_include then
|
||||||
|
-- Insert "include ld.so.conf.d/*.conf" line at the start of the
|
||||||
|
-- file. We only support one of these post upgrades running at
|
||||||
|
-- a time (temporary file name is fixed).
|
||||||
|
local tmp_fd = io.open (ldsoconf_tmp, "w")
|
||||||
|
if tmp_fd ~= nil then
|
||||||
|
tmp_fd:write ("include ld.so.conf.d/*.conf\n")
|
||||||
|
for line in io.lines (ldsoconf) do
|
||||||
|
tmp_fd:write (line .. "\n")
|
||||||
|
end
|
||||||
|
tmp_fd:close ()
|
||||||
|
local res = os.rename (ldsoconf_tmp, ldsoconf)
|
||||||
|
if res == nil then
|
||||||
|
io.stdout:write ("Error: Unable to update configuration file (rename).\n")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
io.stdout:write ("Error: Unable to update configuration file (open).\n")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- (3) Rebuild ld.so.cache early.
|
||||||
|
-- If the format of the cache changes then we need to rebuild
|
||||||
|
-- the cache early to avoid any problems running binaries with
|
||||||
|
-- the new glibc.
|
||||||
|
|
||||||
|
-- Note: We use _prefix because Fedora's UsrMove says so.
|
||||||
|
post_exec ("%{_prefix}/sbin/ldconfig")
|
||||||
|
|
||||||
|
-- (4) Update gconv modules cache.
|
||||||
|
-- If the /usr/lib/gconv/gconv-modules.cache exists, then update it
|
||||||
|
-- with the latest set of modules that were just installed.
|
||||||
|
-- We assume that the cache is in _libdir/gconv and called
|
||||||
|
-- "gconv-modules.cache".
|
||||||
|
local iconv_dir = "%{_libdir}/gconv"
|
||||||
|
local iconv_cache = iconv_dir .. "/gconv-modules.cache"
|
||||||
|
if (posix.utime (iconv_cache) == 0) then
|
||||||
|
post_exec ("%{_prefix}/sbin/iconvconfig",
|
||||||
|
"-o", iconv_cache,
|
||||||
|
"--nostdlib",
|
||||||
|
iconv_dir)
|
||||||
|
else
|
||||||
|
io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n")
|
||||||
|
end
|
||||||
|
|
||||||
%pre devel
|
%pre devel
|
||||||
# this used to be a link and it is causing nightmares now
|
# this used to be a link and it is causing nightmares now
|
||||||
@ -954,16 +1047,6 @@ if [ -L %{_prefix}/include/scsi ] ; then
|
|||||||
rm -f %{_prefix}/include/scsi
|
rm -f %{_prefix}/include/scsi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%if %{with docs}
|
|
||||||
%post devel
|
|
||||||
/sbin/install-info %{_infodir}/libc.info.gz %{_infodir}/dir > /dev/null 2>&1 || :
|
|
||||||
|
|
||||||
%preun devel
|
|
||||||
if [ "$1" = 0 ]; then
|
|
||||||
/sbin/install-info --delete %{_infodir}/libc.info.gz %{_infodir}/dir > /dev/null 2>&1 || :
|
|
||||||
fi
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%pre -n nscd
|
%pre -n nscd
|
||||||
getent group nscd >/dev/null || /usr/sbin/groupadd -g 28 -r nscd
|
getent group nscd >/dev/null || /usr/sbin/groupadd -g 28 -r nscd
|
||||||
getent passwd nscd >/dev/null ||
|
getent passwd nscd >/dev/null ||
|
||||||
@ -1001,7 +1084,6 @@ fi
|
|||||||
%license COPYING COPYING.LIB LICENSES
|
%license COPYING COPYING.LIB LICENSES
|
||||||
|
|
||||||
%files -f common.filelist common
|
%files -f common.filelist common
|
||||||
%attr(0644,root,root) %verify(not md5 size mtime) %{_prefix}/lib/locale/locale-archive.tmpl
|
|
||||||
%attr(0644,root,root) %verify(not md5 size mtime mode) %ghost %config(missingok,noreplace) %{_prefix}/lib/locale/locale-archive
|
%attr(0644,root,root) %verify(not md5 size mtime mode) %ghost %config(missingok,noreplace) %{_prefix}/lib/locale/locale-archive
|
||||||
%dir %{_prefix}/lib/locale
|
%dir %{_prefix}/lib/locale
|
||||||
%dir %{_prefix}/lib/locale/C.utf8
|
%dir %{_prefix}/lib/locale/C.utf8
|
||||||
@ -1016,7 +1098,6 @@ fi
|
|||||||
%files -f libc.lang all-langpacks
|
%files -f libc.lang all-langpacks
|
||||||
%{_prefix}/lib/locale
|
%{_prefix}/lib/locale
|
||||||
%exclude %{_prefix}/lib/locale/locale-archive
|
%exclude %{_prefix}/lib/locale/locale-archive
|
||||||
%exclude %{_prefix}/lib/locale/locale-archive.tmpl
|
|
||||||
%exclude %{_prefix}/lib/locale/C.utf8
|
%exclude %{_prefix}/lib/locale/C.utf8
|
||||||
%exclude %{_prefix}/lib/locale/zh_CN.utf8
|
%exclude %{_prefix}/lib/locale/zh_CN.utf8
|
||||||
%exclude %{_prefix}/lib/locale/en_US.utf8
|
%exclude %{_prefix}/lib/locale/en_US.utf8
|
||||||
@ -1066,10 +1147,11 @@ fi
|
|||||||
|
|
||||||
%if 0%{?_enable_debug_packages}
|
%if 0%{?_enable_debug_packages}
|
||||||
%files -f debuginfo.filelist debuginfo
|
%files -f debuginfo.filelist debuginfo
|
||||||
|
|
||||||
%files debugsource
|
%files debugsource
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%files help
|
%files help
|
||||||
#Doc of glibc package
|
#Doc of glibc package
|
||||||
%doc README NEWS INSTALL elf/rtld-debugger-interface.txt
|
%doc README NEWS INSTALL elf/rtld-debugger-interface.txt
|
||||||
@ -1080,6 +1162,14 @@ fi
|
|||||||
%doc hesiod/README.hesiod
|
%doc hesiod/README.hesiod
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jul 9 2020 wuxu<wuxu.wu@hotmail.com> - 2.31-1
|
||||||
|
- upgrade glibc to 2.31-1
|
||||||
|
- delete build-locale-archive command
|
||||||
|
- delete nsswitch.conf file
|
||||||
|
- replace glibc_post_upgrade function with lua
|
||||||
|
- remove sys/sysctl.h header file
|
||||||
|
- delete stime, ftime function
|
||||||
|
|
||||||
* Tue Jul 7 2020 Wang Shuo<wangshuo47@huawei.com> - 2.28-45
|
* Tue Jul 7 2020 Wang Shuo<wangshuo47@huawei.com> - 2.28-45
|
||||||
- disable rpc, it has been splited to libnss and libtirpc
|
- disable rpc, it has been splited to libnss and libtirpc
|
||||||
- disable parallel compilation
|
- disable parallel compilation
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
version_control: git
|
version_control: git
|
||||||
src_repo: git://sourceware.org/git/glibc.git
|
src_repo: git://sourceware.org/git/glibc.git
|
||||||
tag_prefix: "glibc-"
|
tag_prefix: glibc-
|
||||||
seperator: "."
|
seperator: "."
|
||||||
|
|||||||
@ -24,7 +24,7 @@ diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
|
|||||||
index 179f07a1..00931c19 100644
|
index 179f07a1..00931c19 100644
|
||||||
--- a/nptl/pthread_create.c
|
--- a/nptl/pthread_create.c
|
||||||
+++ b/nptl/pthread_create.c
|
+++ b/nptl/pthread_create.c
|
||||||
@@ -573,8 +573,9 @@ START_THREAD_DEFN
|
@@ -564,8 +564,9 @@ START_THREAD_DEFN
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
|
|||||||
index afd379e89a..a43089065c 100644
|
index afd379e89a..a43089065c 100644
|
||||||
--- a/nptl/pthread_create.c
|
--- a/nptl/pthread_create.c
|
||||||
+++ b/nptl/pthread_create.c
|
+++ b/nptl/pthread_create.c
|
||||||
@@ -552,11 +552,7 @@ START_THREAD_DEFN
|
@@ -567,11 +567,7 @@ START_THREAD_DEFN
|
||||||
advise_stack_range (pd->stackblock, pd->stackblock_size, (uintptr_t) pd,
|
advise_stack_range (pd->stackblock, pd->stackblock_size, (uintptr_t) pd,
|
||||||
pd->guardsize);
|
pd->guardsize);
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ index afd379e89a..a43089065c 100644
|
|||||||
{
|
{
|
||||||
/* Some other thread might call any of the setXid functions and expect
|
/* Some other thread might call any of the setXid functions and expect
|
||||||
us to reply. In this case wait until we did that. */
|
us to reply. In this case wait until we did that. */
|
||||||
@@ -572,6 +568,11 @@ START_THREAD_DEFN
|
@@ -587,6 +583,11 @@ START_THREAD_DEFN
|
||||||
pd->setxid_futex = 0;
|
pd->setxid_futex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user