Accepting request 691281 from home:Andreas_Schwab:Factory

- japanese-era-name-may-2019.patch: ja_JP locale: Add entry for the new
  Japanese era (BZ #22964)
- Replace glibc_post_upgrade with lua script

OBS-URL: https://build.opensuse.org/request/show/691281
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=525
This commit is contained in:
Andreas Schwab 2019-04-03 15:39:26 +00:00 committed by Git OBS Bridge
parent 971269e835
commit 8b74a572f5
4 changed files with 92 additions and 242 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Apr 3 14:56:02 UTC 2019 - Andreas Schwab <schwab@suse.de>
- japanese-era-name-may-2019.patch: ja_JP locale: Add entry for the new
Japanese era (BZ #22964)
- Replace glibc_post_upgrade with lua script
-------------------------------------------------------------------
Thu Mar 7 09:01:37 UTC 2019 - Andreas Schwab <schwab@suse.de>

View File

@ -170,7 +170,6 @@ Source2: http://savannah.gnu.org/project/memberlist-gpgkeys.php?group=lib
Source4: manpages.tar.bz2
Source5: nsswitch.conf
Source7: bindresvport.blacklist
Source8: glibc_post_upgrade.c
Source9: glibc.rpmlintrc
Source10: baselibs.conf
# For systemd
@ -285,6 +284,8 @@ Patch1005: riscv-clone-unwind.patch
Patch1006: add-new-Fortran-vector-math-header-file.patch
# PATCH-FIX-UPSTREAM regex: fix read overrun (CVE-2019-9169, BZ #24114)
Patch1007: regex-read-overrun.patch
# PATCH-FIX-UPSTREAM ja_JP locale: Add entry for the new Japanese era (BZ #22964)
Patch1008: japanese-era-name-may-2019.patch
###
# Patches awaiting upstream approval
@ -504,6 +505,7 @@ makedb: A program to create a database for nss
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch2000 -p1
%patch2004 -p1
@ -718,39 +720,6 @@ configure_and_build_glibc() {
make -C cc-base html
%endif
#
# Build glibc_post_upgrade binary
#
mkdir glibc-post-upgrade
cat > glibc-post-upgrade/Makefile <<\EOF
subdir := glibc-post-upgrade
include ../Makeconfig
vpath %.c $(dir %{SOURCE8})
others = glibc_post_upgrade
others-static = glibc_post_upgrade
libof-glibc_post_upgrade = glibc_post_upgrade
$(objpfx)glibc_post_upgrade: $(common-objpfx)elf/static-stubs.o
CFLAGS-glibc_post_upgrade.o = \
-Os -Wno-write-strings -DREMOVE_TLS_DIRS -DREMOVE_PPC_OPTIMIZE_POWER5 \
%ifarch ppc ppc64
%if !%{powerpc_optimize_cpu_power4}
-DREMOVE_PPC_OPTIMIZE_POWER4 \
%endif
%if !%{powerpc_optimize_cpu_power6}
-DREMOVE_PPC_OPTIMIZE_POWER6 \
%endif
%if !%{powerpc_optimize_cpu_power7}
-DREMOVE_PPC_OPTIMIZE_POWER7 \
%endif
%if !%{powerpc_optimize_cpu_cell}
-DREMOVE_PPC_OPTIMIZE_CELL \
%endif
%endif
-DLIBDIR='"/%{_lib}"' -DGCONV_MODULES_DIR='"%{_libdir}/gconv"'
include ../Rules
EOF
make -C cc-base subdirs=glibc-post-upgrade glibc-post-upgrade/others
%check
%if %{build_testsuite}
# The testsuite will fail if asneeded is used
@ -891,8 +860,6 @@ cc-base/elf/ldconfig -vn $destdir
# Miscelanna:
install -m 0700 cc-base/glibc-post-upgrade/glibc_post_upgrade %{buildroot}%{_sbindir}
install -m 644 %{SOURCE7} %{buildroot}/etc
install -m 644 %{SOURCE5} %{buildroot}/etc
install -m 644 posix/gai.conf %{buildroot}/etc
@ -1033,7 +1000,67 @@ rm %{buildroot}/%{_lib}/lp64d %{buildroot}%{_libdir}/lp64d
%if %{build_main}
%post -p %{_sbindir}/glibc_post_upgrade
%post -p <lua>
function exec(path, ...)
local pid = posix.fork()
if pid == 0 then
posix.exec(path, ...)
io.write(path, ": exec failed: ", posix.errno(), "\n")
os.exit(1)
end
if not pid then
error(path .. ": fork failed: " .. posix.errno() .. "\n")
end
posix.wait(pid)
end
-- First, get rid of platform-optimized libraries. We remove any we have
-- ever built, since otherwise we might end up using some old leftover
-- libraries when new ones aren't installed in their place anymore.
libraries = { "libc.so.6", "libc.so.6.1", "libm.so.6", "libm.so.6.1",
"librt.so.1", "libpthread.so.0", "libthread_db.so.1" }
remove_dirs = {
%ifarch i586
"/%{_lib}/i686/",
%endif
%ifarch ppc ppc64
%if !%{powerpc_optimize_cpu_power4}
"/%{_lib}/power4/", "/%{_lib}/ppc970/",
%endif
"/%{_lib}/power5/", "/%{_lib}/power5+/",
%if !%{powerpc_optimize_cpu_power6}
"/%{_lib}/power6/", "/%{_lib}/power6x/",
%endif
%if !%{powerpc_optimize_cpu_power7}
"/%{_lib}/power7/",
%endif
%if !%{powerpc_optimize_cpu_cell}
"/%{_lib}/ppc-cell-be/",
%endif
%endif
"/%{_lib}/tls/"
}
for i, remove_dir in ipairs(remove_dirs) do
for j, library in ipairs(libraries) do
local file = remove_dir .. library
-- This file could be a symlink to library-%{version}.so, so check
-- this and don't remove only the link, but also the library itself.
local link = posix.readlink(file)
if link then
if link:sub(1, 1) ~= "/" then link = remove_dir .. link end
os.remove(link)
end
os.remove(file)
end
end
if posix.access("/sbin/ldconfig", "x") then
exec("/sbin/ldconfig", "-X")
end
if posix.utime("%{_libdir}/gconv/gconv-modules.cache") then
exec("/usr/sbin/iconvconfig", "-o", "%{_libdir}/gconv/gconv-modules.cache",
"--nostdlib", "%{_libdir}/gconv")
end
%postun -p /sbin/ldconfig
%post locale-base
@ -1214,7 +1241,6 @@ exit 0
%{_bindir}/localedef
%dir %attr(0755,root,root) %{_libexecdir}/getconf
%{_libexecdir}/getconf/*
%{_sbindir}/glibc_post_upgrade
%{_sbindir}/iconvconfig
%files locale-base -f libc.lang

View File

@ -1,204 +0,0 @@
/* skeleton based on version from Fedora Core 3 */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
#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 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[]);
int
main (void)
{
/* First, get rid of platform-optimized libraries. We remove any we have
ever built, since otherwise we might end up using some old leftover
libraries when new ones aren't installed in their place anymore. */
#ifdef REMOVE_TLS_DIRS
const char *library[] = {"libc.so.6", "libc.so.6.1", "libm.so.6",
"libm.so.6.1", "librt.so.1", "librtkaio.so.1",
"libpthread.so.0", "libthread_db.so.1"};
const char *remove_dir[] = {
#ifdef __i386__
"/lib/i686/",
#endif
#ifdef __powerpc64__
#ifdef REMOVE_PPC_OPTIMIZE_POWER4
"/lib64/power4/",
"/lib64/ppc970/",
#endif
#ifdef REMOVE_PPC_OPTIMIZE_POWER5
"/lib64/power5/",
"/lib64/power5+/",
#endif
#ifdef REMOVE_PPC_OPTIMIZE_POWER6
"/lib64/power6/",
"/lib64/power6x/",
#endif
#ifdef REMOVE_PPC_OPTIMIZE_POWER7
"/lib64/power7/",
#endif
#ifdef REMOVE_PPC_OPTIMIZE_CELL
"/lib64/ppc-cell-be/",
#endif
#endif /* __powerpc64__ */
#ifdef __powerpc__
#ifdef REMOVE_PPC_OPTIMIZE_POWER4
"/lib/power4/",
"/lib/ppc970/",
#endif
#ifdef REMOVE_PPC_OPTIMIZE_POWER5
"/lib/power5/",
"/lib/power5+/",
#endif
#ifdef REMOVE_PPC_OPTIMIZE_POWER6
"/lib/power6/",
"/lib/power6x/",
#endif
#ifdef REMOVE_PPC_OPTIMIZE_POWER7
"/lib/power7/",
#endif
#ifdef REMOVE_PPC_OPTIMIZE_CELL
"/lib/ppc-cell-be/",
#endif
#endif /* __powerpc__ */
LIBDIR"/tls/" };
int i, j;
for (i = 0; i < sizeof (remove_dir) / sizeof (remove_dir[0]); ++i)
for (j = 0; j < sizeof (library) / sizeof (library[0]); j++)
{
char buf[strlen (remove_dir[i]) + strlen (library[j]) + 1];
char readlink_buf[(strlen (remove_dir[i]) + strlen (library[j])) * 2 + 30];
ssize_t len;
char *cp;
cp = stpcpy (buf, remove_dir[i]);
strcpy (cp, library[j]);
/* This file could be a symlink to library-%{version}.so, so check
this and don't remove only the link, but also the library itself. */
cp = stpcpy (readlink_buf, remove_dir[i]);
if ((len = readlink (buf, cp, (sizeof (readlink_buf)
- (cp - readlink_buf) - 1))) > 0)
{
cp[len] = '\0';
if (cp[0] != '/') cp = readlink_buf;
unlink (cp);
}
unlink (buf);
}
#endif
/* 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) == 0)
verbose_exec (110, "/sbin/ldconfig", "/sbin/ldconfig", "-X");
if (utimes (GCONV_MODULES_DIR "/gconv-modules.cache", NULL) == 0)
{
#ifndef ICONVCONFIG
#define ICONVCONFIG "/usr/sbin/iconvconfig"
#endif
verbose_exec (113, ICONVCONFIG, "/usr/sbin/iconvconfig",
"-o", GCONV_MODULES_DIR"/gconv-modules.cache",
"--nostdlib", GCONV_MODULES_DIR);
}
_exit(0);
}
void
vexec (int failcode, char *const path[])
{
pid_t pid;
int status, save_errno;
pid = vfork ();
if (pid == 0)
{
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]);
}

View File

@ -0,0 +1,21 @@
2019-04-02 TAMUKI Shoichi <tamuki@linet.gr.jp>
[BZ #22964]
* localedata/locales/ja_JP (LC_TIME): Add entry for the new Japanese
era.
Index: glibc-2.29/localedata/locales/ja_JP
===================================================================
--- glibc-2.29.orig/localedata/locales/ja_JP
+++ glibc-2.29/localedata/locales/ja_JP
@@ -14946,7 +14946,9 @@ am_pm "<U5348><U524D>";"<U5348><U5F8C>"
t_fmt_ampm "%p%I<U6642>%M<U5206>%S<U79D2>"
-era "+:2:1990//01//01:+*:<U5E73><U6210>:%EC%Ey<U5E74>";/
+era "+:2:2020//01//01:+*:<U4EE4><U548C>:%EC%Ey<U5E74>";/
+ "+:1:2019//05//01:2019//12//31:<U4EE4><U548C>:%EC<U5143><U5E74>";/
+ "+:2:1990//01//01:2019//04//30:<U5E73><U6210>:%EC%Ey<U5E74>";/
"+:1:1989//01//08:1989//12//31:<U5E73><U6210>:%EC<U5143><U5E74>";/
"+:2:1927//01//01:1989//01//07:<U662D><U548C>:%EC%Ey<U5E74>";/
"+:1:1926//12//25:1926//12//31:<U662D><U548C>:%EC<U5143><U5E74>";/