Merge commit '293db26d857ebdef0ceeea5da44f166d91d0e5fb' into master-riscv64

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
This commit is contained in:
David Abdurachmanov 2019-09-24 08:00:47 +03:00
commit 4be26d7c24
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
11 changed files with 670 additions and 1702 deletions

View File

@ -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);
}

View File

@ -1,46 +0,0 @@
Short description: Allow access to internal locale archive functions.
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
Origin: PATCH
Upstream status: not-needed
This is a part of commit glibc-2.3.3-1492-ga891c7b,
needed for fedora/build-locale-archive.c only.
2007-04-16 Jakub Jelinek <jakub@redhat.com>
* locale/programs/locarchive.c (add_alias, insert_name): Remove static.
diff -Nrup a/locale/programs/locarchive.c b/locale/programs/locarchive.c
--- a/locale/programs/locarchive.c 2012-06-05 07:42:49.000000000 -0600
+++ b/locale/programs/locarchive.c 2012-06-07 12:15:21.585319540 -0600
@@ -252,9 +252,9 @@ oldlocrecentcmp (const void *a, const vo
/* forward decls for below */
static uint32_t add_locale (struct locarhandle *ah, const char *name,
locale_data_t data, bool replace);
-static void add_alias (struct locarhandle *ah, const char *alias,
- bool replace, const char *oldname,
- uint32_t *locrec_offset_p);
+void add_alias (struct locarhandle *ah, const char *alias,
+ bool replace, const char *oldname,
+ uint32_t *locrec_offset_p);
static bool
@@ -635,7 +635,7 @@ close_archive (struct locarhandle *ah)
#include "../../intl/explodename.c"
#include "../../intl/l10nflist.c"
-static struct namehashent *
+struct namehashent *
insert_name (struct locarhandle *ah,
const char *name, size_t name_len, bool replace)
{
@@ -693,7 +693,7 @@ insert_name (struct locarhandle *ah,
return &namehashtab[idx];
}
-static void
+void
add_alias (struct locarhandle *ah, const char *alias, bool replace,
const char *oldname, uint32_t *locrec_offset_p)
{

View File

@ -0,0 +1,30 @@
Fedora-specific warnings about using nscd with sssd, and that
shared mappings don't show up in nscd -g statistics.
diff --git a/nscd/nscd.conf b/nscd/nscd.conf
index 3730835c50a349c4..b66faa3ca33b4b64 100644
--- a/nscd/nscd.conf
+++ b/nscd/nscd.conf
@@ -3,6 +3,9 @@
#
# An example Name Service Cache config file. This file is needed by nscd.
#
+# WARNING: Running nscd with a secondary caching service like sssd may lead to
+# unexpected behaviour, especially with how long entries are cached.
+#
# Legal entries are:
#
# logfile <file>
@@ -22,7 +25,12 @@
# suggested-size <service> <prime number>
# check-files <service> <yes|no>
# persistent <service> <yes|no>
+#
# shared <service> <yes|no>
+# NOTE: Setting 'shared' to a value of 'yes' will accelerate the lookup
+# with the help of the client, but these lookups will not be
+# counted as cache hits i.e. 'nscd -g' may show '0%'.
+#
# max-db-size <service> <number bytes>
# auto-propagate <service> <yes|no>
#

View File

@ -1,38 +0,0 @@
Short description: Do not define _XOPEN_STREAMS.
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
Origin: PATCH
Bug-Fedora: #436349
Upstream status: not-submitted
This patch should go upstream. Not defining _XOPEN_STREAMS is the
same as setting it to -1 for POSIX conformance. The headers setting
needs to be reviewed indepedently.
This is part of commit glibc-2.3.3-1564-gd0b6ac6
* Fri Mar 14 2008 Jakub Jelinek <jakub@redhat.com> 2.7.90-11
- remove <stropts.h>, define _XOPEN_STREAMS -1 (#436349)
diff -Nrup a/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h b/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
--- a/sysdeps/unix/sysv/linux/bits/posix_opt.h 2012-06-05 07:42:49.000000000 -0600
+++ b/sysdeps/unix/sysv/linux/bits/posix_opt.h 2012-06-07 12:15:21.817318674 -0600
@@ -188,4 +188,7 @@
/* Typed memory objects are not available. */
#define _POSIX_TYPED_MEMORY_OBJECTS -1
+/* Streams are not available. */
+#define _XOPEN_STREAMS -1
+
#endif /* bits/posix_opt.h */
diff -Nrup a/streams/Makefile b/streams/Makefile
--- a/streams/Makefile 2012-06-05 07:42:49.000000000 -0600
+++ b/streams/Makefile 2012-06-07 12:15:21.824318649 -0600
@@ -20,7 +20,7 @@
include ../Makeconfig
-headers = stropts.h sys/stropts.h bits/stropts.h bits/xtitypes.h
+#headers = stropts.h sys/stropts.h bits/stropts.h bits/xtitypes.h
routines = isastream getmsg getpmsg putmsg putpmsg fattach fdetach
include ../Rules

View File

@ -1,272 +0,0 @@
Short description: RPM Post-upgrade cleanup program.
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
Origin: PATCH
Upstream status: not-needed
A helper program is needed to clean up the system configuration
early during RPM package installation, so that other scriptlets
can run successfully.
diff --git a/elf/Makefile b/elf/Makefile
index 2a432d8beebcd207..368dcae477fff2ae 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -117,6 +117,14 @@ others-extras = $(ldconfig-modules)
endif
endif
+# This needs to be statically linked because it is executed at a time
+# when there might be incompatible shared objects on disk, and the
+# purpose of this program is to remove them (among other things).
+others-static += glibc_post_upgrade
+others += glibc_post_upgrade
+glibc_post_upgrade-modules := static-stubs
+CFLAGS-glibc_post_upgrade.c += -DGCONV_MODULES_DIR='"$(gconvdir)"'
+
# To find xmalloc.c and xstrdup.c
vpath %.c ../locale/programs
@@ -559,6 +567,8 @@ $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
$(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
+$(objpfx)glibc_post_upgrade: $(glibc_post_upgrade-modules:%=$(objpfx)%.o)
+
SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
CFLAGS-ldconfig.c += $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
-D'SLIBDIR="$(slibdir)"'
diff --git a/elf/glibc_post_upgrade.c b/elf/glibc_post_upgrade.c
new file mode 100644
index 0000000000000000..19b59f70e2308032
--- /dev/null
+++ b/elf/glibc_post_upgrade.c
@@ -0,0 +1,229 @@
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <dirent.h>
+#include <stddef.h>
+#include <fcntl.h>
+#include <string.h>
+
+#define LD_SO_CONF "/etc/ld.so.conf"
+#define ICONVCONFIG "/usr/sbin/iconvconfig"
+
+#define verbose_exec(failcode, path...) \
+ do \
+ { \
+ char *const arr[] = { path, NULL }; \
+ vexec (failcode, arr); \
+ } while (0)
+
+__attribute__((noinline)) static void vexec (int failcode, char *const path[]);
+__attribute__((noinline)) static void says (const char *str);
+__attribute__((noinline)) static void sayn (long num);
+__attribute__((noinline)) static void message (char *const path[]);
+
+int
+main (void)
+{
+ char initpath[256];
+
+ char buffer[4096];
+ struct pref {
+ const char *p;
+ int len;
+ } prefix[] = { { "libc-", 5 }, { "libm-", 5 },
+ { "librt-", 6 }, { "libpthread-", 11 },
+ { "librtkaio-", 10 }, { "libthread_db-", 13 } };
+ int i, j, fd;
+ off_t base;
+ ssize_t ret;
+
+ /* 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 would be preferred by the dynamic linker
+ during the execution of subsequent RPM scriptlets, likely
+ resulting in process startup failures. */
+ const char *remove_dirs[] =
+ {
+#if defined (__i386__)
+ "/lib/i686",
+ "/lib/i686/nosegneg",
+#elif defined (__powerpc64__) && _CALL_ELF != 2
+ "/lib64/power6",
+#endif
+ };
+ for (j = 0; j < sizeof (remove_dirs) / sizeof (remove_dirs[0]); ++j)
+ {
+ size_t rmlen = strlen (remove_dirs[j]);
+ fd = open (remove_dirs[j], O_RDONLY);
+ if (fd >= 0
+ && (ret = getdirentries (fd, buffer, sizeof (buffer), &base))
+ >= (ssize_t) offsetof (struct dirent, d_name))
+ {
+ for (base = 0; base + offsetof (struct dirent, d_name) < ret; )
+ {
+ struct dirent *d = (struct dirent *) (buffer + base);
+
+ for (i = 0; i < sizeof (prefix) / sizeof (prefix[0]); i++)
+ if (! strncmp (d->d_name, prefix[i].p, prefix[i].len))
+ {
+ char *p = d->d_name + prefix[i].len;
+
+ while (*p == '.' || (*p >= '0' && *p <= '9')) p++;
+ if (p[0] == 's' && p[1] == 'o' && p[2] == '\0'
+ && p + 3 - d->d_name
+ < sizeof (initpath) - rmlen - 1)
+ {
+ memcpy (initpath, remove_dirs[j], rmlen);
+ initpath[rmlen] = '/';
+ strcpy (initpath + rmlen + 1, d->d_name);
+ unlink (initpath);
+ break;
+ }
+ }
+ base += d->d_reclen;
+ }
+ close (fd);
+ }
+ }
+
+ int ldsocfd = open (LD_SO_CONF, O_RDONLY);
+ struct stat ldsocst;
+ if (ldsocfd >= 0 && fstat (ldsocfd, &ldsocst) >= 0)
+ {
+ char p[ldsocst.st_size + 1];
+ if (read (ldsocfd, p, ldsocst.st_size) == ldsocst.st_size)
+ {
+ p[ldsocst.st_size] = '\0';
+ if (strstr (p, "include ld.so.conf.d/*.conf") == NULL)
+ {
+ close (ldsocfd);
+ ldsocfd = open (LD_SO_CONF, O_WRONLY | O_TRUNC);
+ if (ldsocfd >= 0)
+ {
+ size_t slen = strlen ("include ld.so.conf.d/*.conf\n");
+ if (write (ldsocfd, "include ld.so.conf.d/*.conf\n", slen)
+ != slen
+ || write (ldsocfd, p, ldsocst.st_size) != ldsocst.st_size)
+ _exit (109);
+ }
+ }
+ }
+ if (ldsocfd >= 0)
+ close (ldsocfd);
+ }
+
+ /* If installing bi-arch glibc, rpm sometimes doesn't unpack all files
+ before running one of the lib's %post scriptlet. /sbin/ldconfig will
+ then be run by the other arch's %post. */
+ if (! access ("/sbin/ldconfig", X_OK))
+ verbose_exec (110,
+ (char *) "/sbin/ldconfig",
+ (char *) "/sbin/ldconfig");
+
+ if (! utimes (GCONV_MODULES_DIR "/gconv-modules.cache", NULL))
+ {
+ const char *iconv_cache = GCONV_MODULES_DIR "/gconv-modules.cache";
+ const char *iconv_dir = GCONV_MODULES_DIR;
+ verbose_exec (113,
+ (char *) ICONVCONFIG,
+ (char *) "/usr/sbin/iconvconfig",
+ (char *) "-o",
+ (char *) iconv_cache,
+ (char *) "--nostdlib",
+ (char *) iconv_dir);
+ }
+
+ _exit(0);
+}
+
+void
+vexec (int failcode, char *const path[])
+{
+ pid_t pid;
+ int status, save_errno;
+ int devnull = 0;
+
+ if (failcode < 0)
+ {
+ devnull = 1;
+ failcode = -failcode;
+ }
+ pid = vfork ();
+ if (pid == 0)
+ {
+ int fd;
+ if (devnull && (fd = open ("/dev/null", O_WRONLY)) >= 0)
+ {
+ dup2 (fd, 1);
+ dup2 (fd, 2);
+ close (fd);
+ }
+ execv (path[0], path + 1);
+ save_errno = errno;
+ message (path);
+ says (" exec failed with errno ");
+ sayn (save_errno);
+ says ("\n");
+ _exit (failcode);
+ }
+ else if (pid < 0)
+ {
+ save_errno = errno;
+ message (path);
+ says (" fork failed with errno ");
+ sayn (save_errno);
+ says ("\n");
+ _exit (failcode + 1);
+ }
+ if (waitpid (0, &status, 0) != pid || !WIFEXITED (status))
+ {
+ message (path);
+ says (" child terminated abnormally\n");
+ _exit (failcode + 2);
+ }
+ if (WEXITSTATUS (status))
+ {
+ message (path);
+ says (" child exited with exit code ");
+ sayn (WEXITSTATUS (status));
+ says ("\n");
+ _exit (WEXITSTATUS (status));
+ }
+}
+
+static void
+says (const char *str)
+{
+ write (1, str, strlen (str));
+}
+
+static void
+sayn (long num)
+{
+ char string[sizeof (long) * 3 + 1];
+ char *p = string + sizeof (string) - 1;
+
+ *p = '\0';
+ if (num == 0)
+ *--p = '0';
+ else
+ while (num)
+ {
+ *--p = '0' + num % 10;
+ num = num / 10;
+ }
+
+ says (p);
+}
+
+static void
+message (char *const path[])
+{
+ says ("/usr/sbin/glibc_post_upgrade: While trying to execute ");
+ says (path[0]);
+}

View File

@ -1,100 +0,0 @@
resolv: Enable full ICMP error reporting for UDP DNS sockets
The Linux kernel suppresses some ICMP error messages by default for UDP
sockets. This commit enables full ICMP error reporting, hopefully
resulting in faster timeouts.
diff --git a/resolv/Makefile b/resolv/Makefile
index 8f22e6a154621238..ebe1b733f294a97c 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -105,7 +105,7 @@ libresolv-routines := res_comp res_debug \
res_data res_mkquery res_query res_send \
inet_net_ntop inet_net_pton inet_neta base64 \
ns_parse ns_name ns_netint ns_ttl ns_print \
- ns_samedomain ns_date \
+ ns_samedomain ns_date res_enable_icmp \
compat-hooks compat-gethnamaddr
libanl-routines := gai_cancel gai_error gai_misc gai_notify gai_suspend \
diff --git a/resolv/res_enable_icmp.c b/resolv/res_enable_icmp.c
new file mode 100644
index 0000000000000000..bdc9220f08cef71d
--- /dev/null
+++ b/resolv/res_enable_icmp.c
@@ -0,0 +1,37 @@
+/* Enable full ICMP errors on a socket.
+ Copyright (C) 2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+
+int
+__res_enable_icmp (int family, int fd)
+{
+ int one = 1;
+ switch (family)
+ {
+ case AF_INET:
+ return setsockopt (fd, SOL_IP, IP_RECVERR, &one, sizeof (one));
+ case AF_INET6:
+ return setsockopt (fd, SOL_IPV6, IPV6_RECVERR, &one, sizeof (one));
+ default:
+ __set_errno (EAFNOSUPPORT);
+ return -1;
+ }
+}
diff --git a/resolv/res_send.c b/resolv/res_send.c
index fa040c1198fadce5..0f6ec83a7ba05986 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -943,6 +943,18 @@ reopen (res_state statp, int *terrno, int ns)
return (-1);
}
+ /* Enable full ICMP error reporting for this
+ socket. */
+ if (__res_enable_icmp (nsap->sa_family,
+ EXT (statp).nssocks[ns]) < 0)
+ {
+ int saved_errno = errno;
+ __res_iclose (statp, false);
+ __set_errno (saved_errno);
+ *terrno = saved_errno;
+ return -1;
+ }
+
/*
* On a 4.3BSD+ machine (client and server,
* actually), sending to a nameserver datagram
diff --git a/resolv/resolv-internal.h b/resolv/resolv-internal.h
index 6ab8f2af09a7ce0b..1500adc607f2ce3e 100644
--- a/resolv/resolv-internal.h
+++ b/resolv/resolv-internal.h
@@ -100,4 +100,10 @@ libc_hidden_proto (__inet_pton_length)
/* Called as part of the thread shutdown sequence. */
void __res_thread_freeres (void) attribute_hidden;
+/* The Linux kernel does not enable all ICMP messages on a UDP socket
+ by default. A call this function enables full error reporting for
+ the socket FD. FAMILY must be AF_INET or AF_INET6. Returns 0 on
+ success, -1 on failure. */
+int __res_enable_icmp (int family, int fd) attribute_hidden;
+
#endif /* _RESOLV_INTERNAL_H */

View File

@ -1,26 +0,0 @@
Fix a user-after-free bug in the Systemtap probe in
__pthread_timedjoin_ex:
/* Free the TCB. */
__free_tcb (pd);
}
else
pd->joinid = NULL;
LIBC_PROBE (pthread_join_ret, 3, threadid, result, pd->result);
__free_tcb has freed the stack, the access pd->result is invalid.
diff --git a/nptl/pthread_join_common.c b/nptl/pthread_join_common.c
index ecb78ffba5861bdc..45deba6a74c5efd2 100644
--- a/nptl/pthread_join_common.c
+++ b/nptl/pthread_join_common.c
@@ -101,7 +101,7 @@ __pthread_timedjoin_ex (pthread_t threadid, void **thread_return,
else
pd->joinid = NULL;
- LIBC_PROBE (pthread_join_ret, 3, threadid, result, pd->result);
+ LIBC_PROBE (pthread_join_ret, 3, threadid, result, result);
return result;
}

View File

@ -1,5 +1,5 @@
%define glibcsrcdir glibc-2.29-5-gc096b008d2
%define glibcversion 2.29
%define glibcsrcdir glibc-2.30-1-gbe9a328c93
%define glibcversion 2.30
# Pre-release tarballs are pulled in from git using a command that is
# effectively:
#
@ -87,7 +87,7 @@
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 7.0.riscv64%{?dist}
Release: 1%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@ -118,7 +118,6 @@ License: LGPLv2+ and LGPLv2+ with exceptions and GPLv2+ and GPLv2+ with exceptio
URL: http://www.gnu.org/software/glibc/
Source0: %{?glibc_release_url}%{glibcsrcdir}.tar.xz
Source1: build-locale-archive.c
Source4: nscd.conf
Source7: nsswitch.conf
Source8: power6emul.c
@ -137,7 +136,6 @@ Source12: ChangeLog.old
# - See each individual patch file for origin and upstream status.
# - For new patches follow template.patch format.
##############################################################################
Patch1: glibc-post_upgrade.patch
Patch2: glibc-fedora-nscd.patch
Patch3: glibc-rh697421.patch
Patch4: glibc-fedora-linux-tcsetattr.patch
@ -146,8 +144,6 @@ Patch6: glibc-fedora-localedef.patch
Patch7: glibc-fedora-nis-rh188246.patch
Patch8: glibc-fedora-manual-dircategory.patch
Patch9: glibc-rh827510.patch
Patch10: glibc-fedora-locarchive.patch
Patch11: glibc-fedora-streams-rh436349.patch
Patch12: glibc-rh819430.patch
Patch13: glibc-fedora-localedata-rh61908.patch
Patch14: glibc-fedora-__libc_multiple_libcs.patch
@ -157,11 +153,13 @@ Patch17: glibc-cs-path.patch
Patch18: glibc-c-utf8-locale.patch
Patch23: glibc-python3.patch
Patch28: glibc-rh1615608.patch
Patch29: glibc-rh1670028.patch
Patch99: glibc-rh1674280.patch
# Backport https://sourceware.org/git/?p=glibc.git;a=commit;h=85bd1ddbdfdfd13cfd06f7c367519b6ed3360843
Patch120: glibc-riscv-85bd1ddbdfdfd13cfd06f7c367519b6ed3360843.patch
# In progress upstream submission for nsswitch.conf changes:
# https://www.sourceware.org/ml/libc-alpha/2019-03/msg00425.html
# In progress upstream submission for nscd.conf changes:
# https://www.sourceware.org/ml/libc-alpha/2019-03/msg00436.html
Patch31: glibc-fedora-nscd-warnings.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -401,8 +399,11 @@ libraries, as well as national language (locale) support.
/sbin/ldconfig
%end
# We need to run ldconfig manually because ldconfig cannot handle the
# relative include path in the /etc/ld.so.conf file we gneerate.
# We need to run ldconfig manually because __brp_ldconfig assumes that
# glibc itself is always installed in $RPM_BUILD_ROOT, but with sysroots
# we may be installed into a subdirectory of that path. Therefore we
# unset __brp_ldconfig and run ldconfig by hand with the sysroots path
# passed to -r.
%undefine __brp_ldconfig
######################################################################
@ -659,8 +660,8 @@ This package provides debug information for package %{name}.
Debug information is useful when developing applications that use this
package or when debugging this package.
%endif # %{debuginfocommonarches}
%endif # 0%{?_enable_debug_packages}
%endif
%endif
%if %{with benchtests}
%package benchtests
@ -1032,15 +1033,17 @@ rm -f %{glibc_sysroot}%{_infodir}/libc.info*
olddir=`pwd`
pushd %{glibc_sysroot}%{_prefix}/lib/locale
rm -f locale-archive
# Intentionally we do not pass --alias-file=, aliases will be added
# by build-locale-archive.
$olddir/build-%{target}/elf/ld.so \
--library-path $olddir/build-%{target}/ \
$olddir/build-%{target}/locale/localedef \
--alias-file=$olddir/intl/locale.alias \
--prefix %{glibc_sysroot} --add-to-archive \
eo *_*
# Setup the locale-archive template for use by glibc-all-langpacks.
mv locale-archive{,.tmpl}
# Historically, glibc-all-langpacks deleted the file on updates (sic),
# so we need to restore it in the posttrans scriptlet (like the old
# glibc-all-langpacks versions)
ln locale-archive locale-archive.real
# Create the file lists for the language specific sub-packages:
for i in eo *_*
do
@ -1094,10 +1097,6 @@ truncate -s 0 %{glibc_sysroot}/etc/gai.conf
truncate -s 0 %{glibc_sysroot}%{_libdir}/gconv/gconv-modules.cache
chmod 644 %{glibc_sysroot}%{_libdir}/gconv/gconv-modules.cache
# Install the upgrade program
install -m 700 build-%{target}/elf/glibc_post_upgrade \
%{glibc_sysroot}%{_prefix}/sbin/glibc_post_upgrade.%{_target_cpu}
##############################################################################
# Install debug copies of unstripped static libraries
# - This step must be last in order to capture any additional static
@ -1120,22 +1119,11 @@ rm -rf %{glibc_sysroot}%{_prefix}/share/zoneinfo
#
# XXX: Ideally ld.so.conf should have the timestamp of the spec file, but there
# doesn't seem to be any macro to give us that. So we do the next best thing,
# which is to at least keep the timestamp consistent. The choice of using
# glibc_post_upgrade.c is arbitrary.
# which is to at least keep the timestamp consistent. The choice of using
# SOURCE0 is arbitrary.
touch -r %{SOURCE0} %{glibc_sysroot}/etc/ld.so.conf
touch -r sunrpc/etc.rpc %{glibc_sysroot}/etc/rpc
pushd build-%{target}
$GCC -Os -g -static -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
install -m 700 build-locale-archive %{glibc_sysroot}%{_prefix}/sbin/build-locale-archive
popd
# Lastly copy some additional documentation for the packages.
rm -rf documentation
mkdir documentation
@ -1166,6 +1154,7 @@ cp benchtests/scripts/benchout.schema.json %{glibc_sysroot}%{_prefix}/libexec/gl
cp benchtests/scripts/compare_bench.py %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
cp benchtests/scripts/import_bench.py %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
cp benchtests/scripts/validate_benchout.py %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
%endif
%if 0%{?_enable_debug_packages}
# The #line directives gperf generates do not give the proper
@ -1184,7 +1173,6 @@ rm -f %{glibc_sysroot}%{_infodir}/dir
%endif
%ifnarch %{auxarches}
truncate -s 0 %{glibc_sysroot}/%{_prefix}/lib/locale/locale-archive
mkdir -p %{glibc_sysroot}/var/{db,run}/nscd
touch %{glibc_sysroot}/var/{db,run}/nscd/{passwd,group,hosts,services}
touch %{glibc_sysroot}/var/run/nscd/{socket,nscd.pid}
@ -1357,12 +1345,12 @@ chmod 0444 master.filelist
# - The partial (lib*_p.a) static libraries, include files.
# - The static files, objects, unversioned DSOs, and nscd.
# - The bin, locale, some sbin, and share.
# - The use of [^gi] is meant to exclude all files except glibc_post_upgrade,
# and iconvconfig, which we want in the main packages.
# - We want iconvconfig in the main package and we do this by using
# a double negation of -v and [^i] so it removes all files in
# sbin *but* iconvconfig.
# - All the libnss files (we add back the ones we want later).
# - All bench test binaries.
# - The aux-cache, since it's handled specially in the files section.
# - The build-locale-archive binary since it's in the common package.
cat master.filelist \
| grep -v \
-e '%{_infodir}' \
@ -1374,14 +1362,13 @@ cat master.filelist \
-e 'nscd' \
-e '%{_prefix}/bin' \
-e '%{_prefix}/lib/locale' \
-e '%{_prefix}/sbin/[^gi]' \
-e '%{_prefix}/sbin/[^i]' \
-e '%{_prefix}/share' \
-e '/var/db/Makefile' \
-e '/libnss_.*\.so[0-9.]*$' \
-e '/libnsl' \
-e 'glibc-benchtests' \
-e 'aux-cache' \
-e 'build-locale-archive' \
> glibc.filelist
# Add specific files:
@ -1451,10 +1438,13 @@ grep '%{_libdir}/lib.*\.a' < master.filelist \
###############################################################################
# All of the bin and certain sbin files go into the common package except
# glibc_post_upgrade.* and iconvconfig which need to go in glibc. Likewise
# nscd is excluded because it goes in nscd.
# iconvconfig which needs to go in glibc. Likewise nscd is excluded because
# it goes in nscd. The iconvconfig binary is kept in the main glibc package
# because we use it in the post-install scriptlet to rebuild the
# gconv-modules.cache.
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
# All of the files under share go into the common package since they should be
# multilib-independent.
@ -1468,9 +1458,6 @@ grep '%{_prefix}/share' master.filelist \
-e '%%dir %{prefix}/share' \
>> common.filelist
# Add the binary to build locales to the common subpackage.
echo '%{_prefix}/sbin/build-locale-archive' >> common.filelist
###############################################################################
# nscd
###############################################################################
@ -1520,6 +1507,7 @@ grep '/libnss_[a-z]*\.so$' master.filelist > nss-devel.filelist
grep '/libnsl-[0-9.]*.so$' master.filelist > libnsl.filelist
test $(wc -l < libnsl.filelist) -eq 1
%if %{with benchtests}
###############################################################################
# glibc-benchtests
###############################################################################
@ -1548,7 +1536,7 @@ echo "%{_libdir}/libpthread_nonshared.a" >> compat-libpthread-nonshared.filelist
# glibc-debuginfocommon, and glibc-debuginfo
###############################################################################
find_debuginfo_args='--strict-build-id -g'
find_debuginfo_args='--strict-build-id -g -i'
%ifarch %{debuginfocommonarches}
find_debuginfo_args="$find_debuginfo_args \
-l common.filelist \
@ -1608,13 +1596,13 @@ egrep "$auxarches_debugsources" debuginfocommon.sources >> debuginfo.filelist
egrep -v "$auxarches_debugsources" \
debuginfocommon.sources >> debuginfocommon.filelist
%endif # %{biarcharches}
%endif
# Add the list of *.a archives in the debug directory to
# the common debuginfo package.
list_debug_archives >> debuginfocommon.filelist
%endif # %{debuginfocommonarches}
%endif
# Remove some common directories from the common package debuginfo so that we
# don't end up owning them.
@ -1634,7 +1622,7 @@ exclude_common_dirs debuginfocommon.filelist
%endif
exclude_common_dirs debuginfo.filelist
%endif # 0%{?_enable_debug_packages}
%endif
##############################################################################
# Delete files that we do not intended to ship with the auxarch.
@ -1650,7 +1638,7 @@ sed -e '/%%dir/d;/%%config/d;/%%verify/d;s/%%lang([^)]*) //;s#^/*##' \
debuginfocommon.filelist \
%endif
| (cd %{glibc_sysroot}; xargs --no-run-if-empty rm -f 2> /dev/null || :)
%endif # %{auxarches}
%endif
##############################################################################
# Run the glibc testsuite
@ -1724,24 +1712,28 @@ echo ====================PLT RELOCS LIBC.SO==============
readelf -Wr %{glibc_sysroot}/%{_lib}/libc-*.so | sed -n -e "$PLTCMD"
echo ====================PLT RELOCS END==================
# Obtain a way to run the dynamic loader. Avoid matching the symbolic
# link and then pick the first loader (although there should be only
# one).
run_ldso="$(find %{glibc_sysroot}/%{_lib}/ld-*.so -type f | LC_ALL=C sort | head -n1) --library-path %{glibc_sysroot}/%{_lib}"
# Show the auxiliary vector as seen by the new library
# (even if we do not perform the valgrind test).
LD_SHOW_AUXV=1 $run_ldso /bin/true
# Finally, check if valgrind runs with the new glibc.
# We want to fail building if valgrind is not able to run with this glibc so
# that we can then coordinate with valgrind to get it fixed before we update
# glibc.
pushd build-%{target}
# Show the auxiliary vector as seen by the new library
# (even if we do not perform the valgrind test).
LD_SHOW_AUXV=1 elf/ld.so --library-path .:elf:nptl:dlfcn /bin/true
%if %{with valgrind}
elf/ld.so --library-path .:elf:nptl:dlfcn \
/usr/bin/valgrind --error-exitcode=1 \
elf/ld.so --library-path .:elf:nptl:dlfcn /usr/bin/true
$run_ldso /usr/bin/valgrind --error-exitcode=1 \
$run_ldso /usr/bin/true
# true --help performs some memory allocations.
$run_ldso /usr/bin/valgrind --error-exitcode=1 \
$run_ldso /usr/bin/true --help >/dev/null
%endif
popd
%endif # %{run_glibc_tests}
%endif
%pre -p <lua>
@ -1752,28 +1744,159 @@ if rpm.vercmp(rel, required) < 0 then
error("FATAL: kernel too old", 0)
end
%post -p %{_prefix}/sbin/glibc_post_upgrade.%{_target_cpu}
%posttrans all-langpacks -e -p <lua>
-- If at the end of the transaction we are still installed
-- (have a template of non-zero size), then we rebuild the
-- locale cache (locale-archive) from the pre-populated
-- locale cache (locale-archive.tmpl) i.e. template.
if posix.stat("%{_prefix}/lib/locale/locale-archive.tmpl", "size") > 0 then
pid = posix.fork()
%post -p <lua>
-- We use lua's posix.exec because there may be no shell that we can
-- run during glibc upgrade.
function post_exec (program, ...)
local pid = posix.fork ()
if pid == 0 then
posix.exec("%{_prefix}/sbin/build-locale-archive", "--install-langs", "%%{_install_langs}")
assert (posix.exec (program, ...))
elseif pid > 0 then
posix.wait(pid)
posix.wait (pid)
end
end
%postun all-langpacks -p <lua>
-- In the postun we always remove the locale cache.
-- We are being uninstalled and if this is an upgrade
-- then the new packages template will be used to
-- recreate a new copy of the cache.
os.remove("%{_prefix}/lib/locale/locale-archive")
-- (1) Remove multilib libraries from previous installs.
-- 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",
"%{_libdir}/power6",
"%{_libdir}/power7",
"%{_libdir}/power8" }
-- 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
%posttrans all-langpacks -e -p <lua>
-- The old glibc-all-langpacks postun scriptlet deleted the locale-archive
-- file, so we may have to resurrect it on upgrades.
local archive_path = "%{_prefix}/lib/locale/locale-archive"
local real_path = "%{_prefix}/lib/locale/locale-archive.real"
local stat_archive = posix.stat(archive_path)
local stat_real = posix.stat(real_path)
-- If the hard link was removed, restore it.
if stat_archive ~= nil and stat_real ~= nil
and (stat_archive.ino ~= stat_real.ino
or stat_archive.dev ~= stat_real.dev) then
posix.unlink(archive_path)
stat_archive = nil
end
-- If the file is gone, restore it.
if stat_archive == nil then
posix.link(real_path, archive_path)
end
-- Remove .rpmsave file potentially created due to config file change.
local save_path = archive_path .. ".rpmsave"
if posix.access(save_path) then
posix.unlink(save_path)
end
%pre headers
# this used to be a link and it is causing nightmares now
@ -1831,8 +1954,8 @@ fi
%doc documentation/gai.conf
%files all-langpacks
%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
%{_prefix}/lib/locale/locale-archive
%{_prefix}/lib/locale/locale-archive.real
%files locale-source
%dir %{_prefix}/share/i18n/locales
@ -1893,6 +2016,436 @@ fi
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Fri Aug 02 2019 Florian Weimer <fweimer@redhat.com> - 2.30-1
- Drop glibc-rh1734680.patch, applied upstream.
- Auto-sync with upstream branch release/2.30/master,
commit be9a328c93834648e0bec106a1f86357d1a8c7e1:
- malloc: Remove unwanted leading whitespace in malloc_info (swbz#24867)
- glibc 2.30 release
- iconv: Revert steps array reference counting changes (#1734680)
- Restore r31 setting in powerpc32 swapcontext
* Wed Jul 31 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-37
- Fix memory leak in iconv_open (#1734680)
* Tue Jul 30 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-36
- Drop glibc-rh1732406.patch, fix for the regression applied upstream.
- Auto-sync with upstream branch master,
commit 8a814e20d443adc460a1030fa1a66aa9ae817483:
- nptl: Use uintptr_t for address diagnostic in nptl/tst-pthread-getattr
- Linux: Move getdents64 to <dirent.h>
- test-container: Install with $(sorted-subdirs) (swbz#24794)
- gconv: Check reference count in __gconv_release_cache (#1732406)
- x86-64: Compile branred.c with -mprefer-vector-width=128 (swbz#24603)
- build-many-glibcs.py: Use Linux 5.2 by default
- Linux: Use in-tree copy of SO_ constants for !__USE_MISC (swbz#24532)
- test-container: Avoid copying unintended system libraries
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Tue Jul 23 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-34
- Revert libio change that causes crashes (#1732406)
* Mon Jul 22 2019 DJ Delorie <dj@redhat.com> - 2.29.9000-33
- Auto-sync with upstream branch master,
commit dcf36bcad3f283f77893d3b157ef7bb2c99419f2.
- Add NEWS entry about the new AArch64 IFUNC resolver call ABI
- locale/C-translit.h.in: Cyrillic -> ASCII transliteration [BZ #2872]
- Linux: Update syscall-names.list to Linux 5.2
* Thu Jul 18 2019 DJ Delorie <dj@redhat.com> - 2.29.9000-32
- Auto-sync with upstream branch master,
commit 3556658c5b8765480711b265abc901c67d5fc060.
- Regenerate po/libc.pot for 2.30 release.
- nptl: Add POSIX-proposed _clock functions to hppa pthread.h
- nptl: Remove unnecessary forwarding of pthread_cond_clockwait from libc
- Afar locales: Months and days updated from CLDR (bug 21897).
- nl_BE locale: Use "copy "nl_NL"" in LC_NAME (bug 23996).
- nl_BE and nl_NL locales: Dutch salutations (bug 23996).
- ga_IE and en_IE locales: Revert first_weekday removal (bug 24200).
- nptl: Remove futex_supports_exact_relative_timeouts
- Update NEWS for new _clockwait and _clocklock functions
- nptl: Add POSIX-proposed pthread_mutex_clocklock
- nptl: Rename lll_timedlock to lll_clocklock and add clockid parameter
- nptl: Add POSIX-proposed pthread_rwlock_clockrdlock & pthread_rwlock_clockwrlock
- nptl: pthread_rwlock: Move timeout validation into _full functions
- nptl: Add POSIX-proposed pthread_cond_clockwait
- nptl: Add POSIX-proposed sem_clockwait
- nptl: Add clockid parameter to futex timed wait calls
- posix: Fix large mmap64 offset for mips64n32 (BZ#24699)
- nss_db: fix endent wrt NULL mappings [BZ #24695] [BZ #24696]
* Wed Jul 10 2019 Carlos O'Donell <carlos@redhat.com> - 2.29.9000-31
- Auto-sync with upstream branch master,
commit 30ba0375464f34e4bf8129f3d3dc14d0c09add17.
- Don't declare __malloc_check_init in <malloc.h> (bug 23352)
- nftw: fill in stat buf for dangling links [BZ #23501]
- dl-vdso: Add LINUX_4 HASH CODE to support nds32 vdso mechanism
- riscv: restore ABI compatibility (bug 24484)
- aarch64: new ifunc resolver ABI
- nptl: Remove vfork IFUNC-based forwarder from libpthread [BZ #20188]
- malloc: Add nptl, htl dependency for the subdirectory [BZ #24757]
- Call _dl_open_check after relocation [BZ #24259]
- Linux: Use mmap instead of malloc in dirent/tst-getdents64
- ld.so: Support moving versioned symbols between sonames [BZ #24741]
- io: Remove copy_file_range emulation [BZ #24744]
- Linux: Adjust gedents64 buffer size to int range [BZ #24740]
- powerpc: Use generic e_expf
- Linux: Add nds32 specific syscalls to syscall-names.list
- szl_PL locale: Fix a typo in the previous commit (bug 24652).
* Mon Jun 24 2019 DJ Delorie <dj@redhat.com> - 2.29.9000-30
- Auto-sync with upstream branch master,
commit 2bd81b60d6ffdf7e0d22006d69f4b812b1c80513.
- szl_PL locale: Spelling corrections (swbz 24652).
- nl_{AW,NL}: Correct the thousands separator and grouping (swbz 23831).
- Add missing VDSO_{NAME,HASH}_* macros and use them for PREPARE_VERSION_KNOWN
- nptl: Convert various tests to use libsupport
- support: Invent verbose_printf macro
- support: Add xclock_now helper function.
* Fri Jun 21 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-29
- Auto-sync with upstream branch master,
commit 21cc130b78a4db9113fb6695e2b951e697662440:
- During exit, skip wide buffer handling for legacy stdio handles (#1722216)
- powerpc: add 'volatile' to asm
- powerpc: Fix static-linked version of __ppc_get_timebase_freq (swbz#24640)
- nl_AW locale: Correct the negative monetary format (swb#z24614)
- Fix gcc 9 build errors for make xcheck. (swbz#24556)
- dlfcn: Avoid one-element flexible array in Dl_serinfo (swbz#24166)
- elf: Refuse to dlopen PIE objects (swbz#24323)
- nl_NL locale: Correct the negative monetary format (swbz#24614)
- powerpc: Refactor powerpc64 lround/lroundf/llround/llroundf
- powerpc: refactor powerpc64 lrint/lrintf/llrint/llrintf
* Mon Jun 17 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-28
- Auto-sync with upstream branch master,
commit 48c3c1238925410b4e777dc94e2fde4cc9132d44.
- Linux: Fix __glibc_has_include use for <sys/stat.h> and statx (#1721129)
- <sys/cdefs.h>: Inhibit macro expansion for __glibc_has_include
- Add IPV6_ROUTER_ALERT_ISOLATE from Linux 5.1 to bits/in.h
- aarch64: handle STO_AARCH64_VARIANT_PCS
- aarch64: add STO_AARCH64_VARIANT_PCS and DT_AARCH64_VARIANT_PCS
- powerpc: Remove optimized finite
- math: Use wordsize-64 version for finite
- powerpc: Remove optimized isinf
- math: Use wordsize-64 version for isinf
- powerpc: Remove optimized isnan
- math: Use wordsize-64 version for isnan
- benchtests: Add isnan/isinf/isfinite benchmark
- powerpc: copysign cleanup
- powerpc: consolidate rint
- libio: freopen of default streams crashes in old programs (swbz#24632)
- Linux: Deprecate <sys/sysctl.h> and sysctl
- <sys/stat.h>: Use Linux UAPI header for statx if available and useful
(#1721129)
- <sys/cdefs.h>: Add __glibc_has_include macro
- Improve performance of memmem
- Improve performance of strstr
- Benchmark strstr hard needles
- Fix malloc tests build with GCC 10
* Mon Jun 10 2019 Patsy Franklin <patsy@redhat.com> - 2.29.9000-27
- Auto-sync with upstream branch master,
commit 51ea67d54882318c4fa5394c386f4816ddc22408.
- powerpc: get_rounding_mode: utilize faster method to get rounding mode
- riscv: Do not use __has_include__
- powerpc: fegetexcept: utilize function instead of duplicating code
- iconv: Use __twalk_r in __gconv_release_shlib
- Fix iconv buffer handling with IGNORE error handler (swbz#18830)
* Wed Jun 5 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-26
- Restore /usr/lib/locale/locale-archive under its original name (#1716710)
* Tue Jun 4 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-25
- Add glibc version to locale-archive name (#1716710)
* Mon Jun 03 2019 Carlos O'Donell <carlos@redhat.com> - 2.29.9000-24
- Auto-sync with upstream branch master,
commit dc91a19e6f71e1523f4ac179191a29b2131d74bb:
- Linux: Add oddly-named arm syscalls to syscall-names.list.
- arm: Remove ioperm/iopl/inb/inw/inl/outb/outw/outl support.
- Add INADDR_ALLSNOOPERS_GROUP from Linux 5.1 to netinet/in.h.
* Sat Jun 01 2019 Carlos O'Donell <carlos@redhat.com> - 2.29.9000-23
- Convert glibc_post_upgrade to lua.
* Sat Jun 01 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-22
- Remove support for filtering glibc-all-langpacks (#1715891)
- Auto-sync with upstream branch master,
commit 9250e6610fdb0f3a6f238d2813e319a41fb7a810:
- powerpc: Fix build failures with current GCC
- Remove unused get_clockfreq files
- powerpc: generic nearbyint/nearbyintf
- tt_RU: Add lang_name (swbz#24370)
- tt_RU: Fix orthographic mistakes in mon and abmon sections (swbz#24369)
- Add IGMP_MRDISC_ADV from Linux 5.1 to netinet/igmp.h.
* Mon May 27 2019 Arjun Shankar <arjun@redhat.com> - 2.29.9000-21
- Auto-sync with upstream branch master,
commit 85188d8211698d1a255f0aec6529546db5c56de3:
- Remove support for PowerPC SPE extension
- elf: Add tst-ldconfig-bad-aux-cache test
- Add F_SEAL_FUTURE_WRITE from Linux 5.1 to bits/fcntl-linux.h
- nss_dns: Check for proper A/AAAA address alignment
* Tue May 21 2019 DJ Delorie <dj@redhat.com> - 2.29.9000-20
- Auto-sync with upstream branch master,
commit 46ae07324b1cd50fbf8f37a076d6babcfca7c510.
- Improve string benchtest timing
- sysvipc: Add missing bit of semtimedop s390 consolidation
- wcsmbs: Fix data race in __wcsmbs_clone_conv [swbz #24584]
- libio: Fix gconv-related memory leak [swbz #24583]
- libio: Remove codecvt vtable [swbz #24588]
- support: Expose sbindir as support_sbindir_prefix
- support: Add missing EOL terminators on timespec
- support: Correct confusing comment
- sysvipc: Consolidate semtimedop s390
- sysvipc: Fix compat msgctl (swbz#24570)
- Add NT_ARM_PACA_KEYS and NT_ARM_PACG_KEYS from Linux 5.1 to elf.h.
- Small tcache improvements
- manual: Document O_DIRECTORY
- Update kernel-features.h files for Linux 5.1.
- nss_nis, nss_nisplus: Remove RES_USE_INET6 handling
- nss_files: Remove RES_USE_INET6 from hosts processing
- support: Report NULL blobs explicitly in TEST_COMPARE
- dlfcn: Guard __dlerror_main_freeres with __libc_once_get (once) [swbz# 24476]
- Add missing Changelog entry
* Wed May 15 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-19
- Auto-sync with upstream branch master,
commit 32ff397533715988c19cbf3675dcbd727ec13e18:
- Fix crash in _IO_wfile_sync (#1710460)
- nss: Turn __nss_database_lookup into a compatibility symbol
- support: Add support_install_rootsbindir
- iconv: Remove public declaration of __gconv_transliterate
- Linux: Add the tgkill function
- manual: Adjust twalk_r documentation.
- elf: Fix tst-pldd for non-default --prefix and/or --bindir (swbz#24544)
- support: Export bindir path on support_path
- configure: Make --bindir effective
- x86: Remove arch-specific low level lock implementation
- nptl: Assume LLL_LOCK_INITIALIZER is 0
- nptl: Small optimization for lowlevellock
- Add single-thread.h header
- locale: Update to Unicode 12.1.0 (swbz#24535)
- malloc: Fix tcache count maximum (swbz#24531)
- sem_close: Use __twalk_r
- support: Fix timespec printf
- nptl/tst-abstime: Use libsupport
- nptl: Convert some rwlock tests to use libsupport
- nptl: Use recent additions to libsupport in tst-sem5
- nptl: Convert tst-cond11.c to use libsupport
- support: Add timespec.h
- Move nptl/tst-eintr1 to xtests (swbz#24537)
- powerpc: trunc/truncf refactor
- powerpc: round/roundf refactor
- powerpc: floor/floorf refactor
- support: Add xclock_gettime
- malloc/tst-mallocfork2: Use process-shared barriers
- Update syscall-names.list for Linux 5.1
- Use GCC 9 in build-many-glibcs.py
- aarch64: thunderx2 memmove performance improvements
- misc/tst-tsearch: Additional explicit error checking
- elf: Fix elf/tst-pldd with --enable-hardcoded-path-in-tests (swbz#24506)
- misc: Add twalk_r function
* Thu May 02 2019 Arjun Shankar <arjun@redhat.com> - 2.29.9000-18
- Auto-sync with upstream branch master,
commit 20aa5819586ac7ad11f711bab64feda307965191:
- semaphore.h: Add nonnull attributes
- powerpc: Remove power4 mpa optimization
- powerpc: Refactor ceil/ceilf
- Fix -O1 compilation errors with `__ddivl' and `__fdivl' [BZ #19444]
- Make mktime etc. compatible with __time64_t
* Fri Apr 26 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-17
- Auto-sync with upstream branch master,
commit c57afec0a9b318bb691e0f5fa4e9681cf30df7a4:
- Increase BIND_NOW coverage (#1702671)
- Fix pldd hang (#1361689)
- riscv: remove DL_RO_DYN_SECTION (swbz#24484)
- locale: Add LOCPATH diagnostics to the locale program
- Reduce benchtests time
* Mon Apr 22 2019 DJ Delorie <dj@redhat.com> - 2.29.9000-16
- Auto-sync with upstream branch master,
commit 25f7a3c96116a9102df8bf7b04ef160faa32416d.
- malloc: make malloc fail with requests larger than PTRDIFF_MAX (BZ#23741)
- powerpc: Fix format issue from 3a16dd780eeba602
- powerpc: fma using builtins
- powerpc: Use generic fabs{f} implementations
- mips: Remove rt_sigreturn usage on context function
- powerpc: Remove rt_sigreturn usage on context function
- support: Add support_capture_subprogram
- stdlib/tst-secure-getenv: handle >64 groups
* Mon Apr 15 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-15
- Auto-sync with upstream branch master,
commit e3f454bac0f968216699ca405c127c858f0657c7:
- nss_dns: Do not replace root domain with empty string
- alloc_buffer: Return unqualified pointer type in alloc_buffer_next
- malloc: Set and reset all hooks for tracing (swbz#16573)
* Thu Apr 11 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-14
- Run valgrind smoke test against the install tree
* Thu Apr 11 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-13
- Do not use --g-libs with find-debuginfo.sh; it breaks valgrind (#1698824)
* Wed Apr 10 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-12
- Strip debugging information from installed programs again (#1661510)
* Tue Apr 09 2019 Carlos O'Donell <carlos@redhat.com> - 2.29.9000-11
- Drop glibc-warning-fix.patch. Microbenchmark code fixed upstream.
- Auto-sync with upstream branch master,
commit 648279f4af423c4783ec1dfa63cb7b46a7640217:
- powerpc: Use generic wcscpy optimization
- powerpc: Use generic wcschr optimization
- powerpc: Use generic wcsrchr optimization
- aarch64: thunderx2 memcpy implementation cleanup and streamlining
- resolv: Remove support for RES_USE_INET6 and the inet6 option
- resolv: Remove RES_INSECURE1, RES_INSECURE2
* Thu Apr 04 2019 Arjun Shankar <arjun@redhat.com> - 2.29.9000-10
- Auto-sync with upstream branch master,
commit 8260f23616c1a2a4e609f989a195fba7690a42ca:
- Fix strptime era handling, add more strftime tests [BZ #24394]
- time/tst-strftime2.c: Make the file easier to maintain
- time: Add tests for Minguo calendar [BZ #24293]
- ja_JP locale: Add entry for the new Japanese era [BZ #22964]
- Add Reiwa era tests to time/tst-strftime3.c
* Mon Apr 01 2019 Arjun Shankar <arjun@redhat.com> - 2.29.9000-9
- Auto-sync with upstream branch master,
commit 993e3107af67edefcfc79a62ae55f7b98aa5151e:
- Add AArch64 HWCAPs from Linux 5.0
- tt_RU: Fix orthographic mistakes in day and abday sections [BZ #24296]
- iconv, localedef: avoid floating point rounding differences [BZ #24372]
- Fix parentheses error in iconvconfig.c and ld-collate.c [BZ #24372]
- S390: New configure check and hwcap values for new CPU architecture arch13
- S390: Add memmove, strstr, and memmem ifunc variants for arch13
- nptl: Remove pthread_clock_gettime pthread_clock_settime
- linux: Assume clock_getres CLOCK_{PROCESS,THREAD}_CPUTIME_ID
- Remove __get_clockfreq
- Do not use HP_TIMING_NOW for random bits
- hp-timing: Refactor rtld usage, add generic support
- Add NT_ARM_PAC_MASK and NT_MIPS_MSA from Linux 5.0 to elf.h
- Add UDP_GRO from Linux 5.0 to netinet/udp.h
- nptl: Convert tst-sem5 & tst-sem13 to use libsupport
- nptl/tst-rwlock14: Test pthread_rwlock_timedwrlock correctly
- nss/tst-nss-files-alias-leak: add missing opening quote in printf
- math: Enable some math builtins for clang
- powerpc: Use __builtin_{mffs,mtfsf}
- RISC-V: Fix `test' operand error with soft-float ABI being configured
* Wed Mar 20 2019 Carlos O'Donell <carlos@redhat.com> - 2.29.9000-8
- Add warnings and notes to /etc/nsswitch.conf and /etc/nscd.conf.
* Mon Mar 18 2019 DJ Delorie <dj@redhat.com> - 2.29.9000-7
- Auto-sync with upstream branch master,
commit 78919d3886c9543279ec755a701e279c62b44164.
* Thu Mar 14 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-6
- Drop glibc-fedora-streams-rh436349.patch. STREAMS was removed upstream.
- Auto-sync with upstream branch master,
commit a0a0dc83173ce11ff45105fd32e5d14356cdfb9c:
- Remove obsolete, never-implemented XSI STREAMS declarations
- nss: Fix tst-nss-files-alias-truncated for default --as-needed linking
- scripts/check-obsolete-constructs.py: Process all headers as UTF-8.
- Use Linux 5.0 in build-many-glibcs.py.
- hurd: Add no-op version of __res_enable_icmp [BZ #24047]
- Move inttypes.h and stdint.h to stdlib.
- Use a proper C tokenizer to implement the obsolete typedefs test.
- Fix output of LD_SHOW_AUXV=1.
* Wed Mar 13 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-5
- Drop glibc-rh1670028.patch, applied upstream
- Auto-sync with upstream branch master,
commit 38b52865d4ccfee3647f27e969e539a4396a73b1:
- elf: Add DF_1_KMOD, DF_1_WEAKFILTER, DF_1_NOCOMMON to <elf.h>
- resolv: Enable full ICMP errors for UDP DNS sockets [BZ #24047]
- C-SKY: add elf header definition for elfutils
- C-SKY: mark lr as undefined to stop unwinding
- C-SKY: remove user_regs definition
- C-SKY: fix sigcontext miss match
- Bug 24307: Update to Unicode 12.0.0
- Break lines before not after operators, batch 4.
- check-wrapper-headers test: Adjust Fortran include file directory
- Fix location where math-vector-fortran.h is installed.
* Wed Mar 06 2019 DJ Delorie <dj@redhat.com> - 2.29.9000-4
- Auto-sync with upstream branch master,
commit 0ddb7ea842abf63516b74d4b057c052afc6ba863.
- nptl: Assume __ASSUME_FUTEX_CLOCK_REALTIME support
- powerpc: Fix build of wcscpy with --disable-multi-arch
- elf: Remove remnants of MAP_ANON emulation
- S390: Increase function alignment to 16 bytes.
- ja_JP: Change the offset for Taisho gan-nen from 2 to 1 [BZ #24162]
- ldbl-opt: Reuse test cases from misc/ that check long double
- ldbl-opt: Add error and error_at_line (bug 23984)
- ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984)
- ldbl-opt: Reuse argp tests that print long double
- ldbl-opt: Add argp_error and argp_failure (bug 23983)
- elf/tst-big-note: Improve accuracy of test [BZ #20419]
- S390: Fix introduction of __wcscpy and weak wcscpy symbols.
- __netlink_assert_response: Add more __libc_fatal newlines [BZ #20271]
- Add more spaces before '('.
- elf: Add tests with a local IFUNC resolver [BZ #23937]
- elf/Makefile: Run IFUNC tests if binutils supports IFUNC
- powerpc: Fix linknamespace introduced by 4d8015639a75
- hurd: Add renameat2 support for RENAME_NOREPLACE
- Fix -Wempty-body warnings in Hurd-specific code.
- Add some spaces before '('.
- wcsmbs: optimize wcsnlen
- wcsmbs: optimize wcsncpy
- wcsmbs: optimize wcsncat
- wcsmbs: optimize wcscpy
- wcsmbs: optimize wcscat
- wcsmbs: optimize wcpncpy
- wcsmbs: optimize wcpcpy
- Break further lines before not after operators.
- Add and move fall-through comments in system-specific code.
* Fri Mar 1 2019 DJ Delorie <dj@redhat.com> - 2.29.9000-3
- Add .gdb_index to debug information (rhbz#1680765)
* Wed Feb 27 2019 Carlos O'Donell <carlos@redhat.com> - 2.29.9000-2
- Fix build failure related to microbenchmarks.
* Tue Feb 26 2019 Carlos O'Donell <carlos@redhat.com> - 2.29.9000-1
- Auto-sync with upstream branch master,
commit e0cb7b6131ee5f2dca2938069b8b9590304e6f6b:
- nss_files: Fix /etc/aliases null pointer dereference (swbz#24059)
- regex: fix read overrun (swbz#24114)
- libio: use stdout in puts and putchar, etc (swbz#24051)
- aarch64: Add AmpereComputing emag to tunable cpu list
- aarch64: Optimized memset specific to AmpereComputing emag
- aarch64: Optimized memchr specific to AmpereComputing emag
- Require GCC 6.2 or later to build glibc
- manual: Document lack of conformance of sched_* functions (swbz#14829)
- libio: Use stdin consistently for input functions (swbz#24153)
- x86-64 memcmp: Use unsigned Jcc instructions on size (swbz#24155)
- Fix handling of collating elements in fnmatch (swbz#17396,swbz#16976)
- arm: Use "nr" constraint for Systemtap probes (swbz#24164)
- Fix alignment of TLS variables for tls variant TLS_TCB_AT_TP (swbz#23403)
- Add compiler barriers for pthread_mutex_trylock (swbz#24180)
- rt: Turn forwards from librt to libc into compat symbols (swbz#24194)
- Linux: Add gettid system call wrapper (swbz#6399)
- nptl: Avoid fork handler lock for async-signal-safe fork (swbz#24161)
- elf: Ignore LD_AUDIT interfaces if la_version returns 0 (swbz#24122)
- nptl: Reinstate pthread_timedjoin_np as a cancellation point (swbz#24215)
- nptl: Fix invalid Systemtap probe in pthread_join (swbz#24211)
* Tue Feb 19 2019 Florian Weimer <fweimer@redhat.com> - 2.29-8
- Drop glibc-rh1674280.patch. Different fix applied upstream. (#1674280)
- Auto-sync with upstream branch release/2.29/master,
commit 067fc32968b601493f4b247a3ac00caeea3f3d61:
- nptl: Fix invalid Systemtap probe in pthread_join (#1674280)
* Mon Feb 11 2019 Florian Weimer <fweimer@redhat.com> - 2.29-7
- Hotfix for invalid Systemtap probe in pthread_join (#1674280)

View File

@ -1,274 +0,0 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/time.h>
#include <dirent.h>
#include <stddef.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <elf.h>
#define LD_SO_CONF "/etc/ld.so.conf"
#define ICONVCONFIG "/usr/sbin/iconvconfig"
#define verbose_exec(failcode, path...) \
do \
{ \
char *const arr[] = { path, NULL }; \
vexec (failcode, arr); \
} while (0)
__attribute__((noinline)) void vexec (int failcode, char *const path[]);
__attribute__((noinline)) void says (const char *str);
__attribute__((noinline)) void sayn (long num);
__attribute__((noinline)) void message (char *const path[]);
__attribute__((noinline)) int check_elf (const char *name);
int
main (void)
{
struct stat statbuf;
char initpath[256];
char buffer[4096];
struct pref {
char *p;
int len;
} prefix[] = { { "libc-", 5 }, { "libm-", 5 },
{ "librt-", 6 }, { "libpthread-", 11 },
{ "librtkaio-", 10 }, { "libthread_db-", 13 } };
int i, j, fd;
off_t base;
ssize_t ret;
/* 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 would be preferred by the dynamic linker
during the execution of subsequent RPM scriptlets, likely
resulting in process startup failures. */
const char *remove_dirs[] =
{
#if defined (__i386__)
"/lib/i686",
"/lib/i686/nosegneg",
#elif defined (__powerpc64__) && _CALL_ELF != 2
"/lib64/power6",
"/lib64/power7",
"/lib64/power8",
#endif
};
for (j = 0; j < sizeof (remove_dirs) / sizeof (remove_dirs[0]); ++j)
{
size_t rmlen = strlen (remove_dirs[j]);
fd = open (remove_dirs[j], O_RDONLY);
if (fd >= 0
&& (ret = getdirentries (fd, buffer, sizeof (buffer), &base))
>= (ssize_t) offsetof (struct dirent, d_name))
{
for (base = 0; base + offsetof (struct dirent, d_name) < ret; )
{
struct dirent *d = (struct dirent *) (buffer + base);
for (i = 0; i < sizeof (prefix) / sizeof (prefix[0]); i++)
if (! strncmp (d->d_name, prefix[i].p, prefix[i].len))
{
char *p = d->d_name + prefix[i].len;
while (*p == '.' || (*p >= '0' && *p <= '9')) p++;
if (p[0] == 's' && p[1] == 'o' && p[2] == '\0'
&& p + 3 - d->d_name
< sizeof (initpath) - rmlen - 1)
{
memcpy (initpath, remove_dirs[j], rmlen);
initpath[rmlen] = '/';
strcpy (initpath + rmlen + 1, d->d_name);
unlink (initpath);
break;
}
}
base += d->d_reclen;
}
close (fd);
}
}
int ldsocfd = open (LD_SO_CONF, O_RDONLY);
struct stat ldsocst;
if (ldsocfd >= 0 && fstat (ldsocfd, &ldsocst) >= 0)
{
char p[ldsocst.st_size + 1];
if (read (ldsocfd, p, ldsocst.st_size) == ldsocst.st_size)
{
p[ldsocst.st_size] = '\0';
if (strstr (p, "include ld.so.conf.d/*.conf") == NULL)
{
close (ldsocfd);
ldsocfd = open (LD_SO_CONF, O_WRONLY | O_TRUNC);
if (ldsocfd >= 0)
{
size_t slen = strlen ("include ld.so.conf.d/*.conf\n");
if (write (ldsocfd, "include ld.so.conf.d/*.conf\n", slen)
!= slen
|| write (ldsocfd, p, ldsocst.st_size) != ldsocst.st_size)
_exit (109);
}
}
}
if (ldsocfd >= 0)
close (ldsocfd);
}
/* If installing bi-arch glibc, rpm sometimes doesn't unpack all files
before running one of the lib's %post scriptlet. /sbin/ldconfig will
then be run by the other arch's %post. */
if (! access ("/sbin/ldconfig", X_OK))
verbose_exec (110, "/sbin/ldconfig", "/sbin/ldconfig");
if (! utimes (GCONV_MODULES_DIR "/gconv-modules.cache", NULL))
{
char *iconv_cache = GCONV_MODULES_DIR"/gconv-modules.cache";
char *iconv_dir = GCONV_MODULES_DIR;
verbose_exec (113, ICONVCONFIG, "/usr/sbin/iconvconfig",
"-o", iconv_cache,
"--nostdlib", iconv_dir);
}
_exit(0);
}
void
vexec (int failcode, char *const path[])
{
pid_t pid;
int status, save_errno;
int devnull = 0;
if (failcode < 0)
{
devnull = 1;
failcode = -failcode;
}
pid = vfork ();
if (pid == 0)
{
int fd;
if (devnull && (fd = open ("/dev/null", O_WRONLY)) >= 0)
{
dup2 (fd, 1);
dup2 (fd, 2);
close (fd);
}
execv (path[0], path + 1);
save_errno = errno;
message (path);
says (" exec failed with errno ");
sayn (save_errno);
says ("\n");
_exit (failcode);
}
else if (pid < 0)
{
save_errno = errno;
message (path);
says (" fork failed with errno ");
sayn (save_errno);
says ("\n");
_exit (failcode + 1);
}
if (waitpid (0, &status, 0) != pid || !WIFEXITED (status))
{
message (path);
says (" child terminated abnormally\n");
_exit (failcode + 2);
}
if (WEXITSTATUS (status))
{
message (path);
says (" child exited with exit code ");
sayn (WEXITSTATUS (status));
says ("\n");
_exit (WEXITSTATUS (status));
}
}
void
says (const char *str)
{
write (1, str, strlen (str));
}
void
sayn (long num)
{
char string[sizeof (long) * 3 + 1];
char *p = string + sizeof (string) - 1;
*p = '\0';
if (num == 0)
*--p = '0';
else
while (num)
{
*--p = '0' + num % 10;
num = num / 10;
}
says (p);
}
void
message (char *const path[])
{
says ("/usr/sbin/glibc_post_upgrade: While trying to execute ");
says (path[0]);
}
int
check_elf (const char *name)
{
/* Play safe, if we can't open or read, assume it might be
ELF for the current arch. */
int ret = 1;
int fd = open (name, O_RDONLY);
if (fd >= 0)
{
Elf32_Ehdr ehdr;
if (read (fd, &ehdr, offsetof (Elf32_Ehdr, e_version))
== offsetof (Elf32_Ehdr, e_version))
{
ret = 0;
if (ehdr.e_ident[EI_CLASS]
== (sizeof (long) == 8 ? ELFCLASS64 : ELFCLASS32))
{
#if defined __i386__
ret = ehdr.e_machine == EM_386;
#elif defined __x86_64__
ret = ehdr.e_machine == EM_X86_64;
#elif defined __powerpc64__
ret = ehdr.e_machine == EM_PPC64;
#elif defined __powerpc__
ret = ehdr.e_machine == EM_PPC;
#elif defined __s390__ || defined __s390x__
ret = ehdr.e_machine == EM_S390;
#elif defined __x86_64__
ret = ehdr.e_machine == EM_X86_64;
#elif defined __sparc__
if (sizeof (long) == 8)
ret = ehdr.e_machine == EM_SPARCV9;
else
ret = (ehdr.e_machine == EM_SPARC
|| ehdr.e_machine == EM_SPARC32PLUS);
#else
ret = 1;
#endif
}
}
close (fd);
}
return ret;
}

View File

@ -24,6 +24,9 @@
#
# 'sssd' performs its own 'files'-based caching, so it should
# generally come before 'files'.
#
# WARNING: Running nscd with a secondary caching service like sssd may lead to
# unexpected behaviour, especially with how long entries are cached.
# To use 'db', install the nss_db package, and put the 'db' in front
# of 'files' for entries you want to be looked up first in the

View File

@ -1 +1 @@
SHA512 (glibc-2.29-5-gc096b008d2.tar.xz) = b2caff098709183f3c02dabbb75926d067006f442ab15531c14a33f2a4b04e064fce2e4bdfb27dd9f148122de057e4884f8fdc426bd7aa9315d4e67d60c6b4c5
SHA512 (glibc-2.30-1-gbe9a328c93.tar.xz) = ad471d2b9d81a12e36e100a18685fe1de3461a372151506b8021f52aeb7180727f807044b9cbdbda61911f2ed48192c906f743c46677fc55e608530b8bb856d0