From 0dd4aebc2e63d9dd1c523425b768be295a6af1e9e233354b2b179c9f31bf299f Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 14 May 2012 09:39:40 +0000 Subject: [PATCH] Accepting request 120884 from home:a_jaeger:my-factory-packages Add nscd --foreground option. OBS-URL: https://build.opensuse.org/request/show/120884 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=181 --- armhf-ld-so.patch | 23 --------- glibc-armhf-compat.patch | 22 +++++++++ glibc-nscd-foreground.patch | 98 +++++++++++++++++++++++++++++++++++++ glibc.changes | 6 +++ glibc.spec | 16 ++++-- nscd.service | 9 ++-- 6 files changed, 143 insertions(+), 31 deletions(-) create mode 100644 glibc-armhf-compat.patch create mode 100644 glibc-nscd-foreground.patch diff --git a/armhf-ld-so.patch b/armhf-ld-so.patch index ce66dfb..c616b53 100644 --- a/armhf-ld-so.patch +++ b/armhf-ld-so.patch @@ -1,9 +1,3 @@ -For backward compatibility with armhf binaries built with the -old linker SONAME, we need to fake out the linker to believe -the new is the old, until such a point as everything is rebuilt. - -Patch for elf/dl-load.c taken from Debian. - diff --git a/sysdeps/arm/shlib-versions b/sysdeps/arm/shlib-versions index 491dd0a..5464959 100644 --- a/glibc-ports-2.15/sysdeps/arm/shlib-versions @@ -15,20 +9,3 @@ index 491dd0a..5464959 100644 +arm.*-.*-linux-gnueabi.* ld=ld-linux-armhf.so.3 arm.*-.*-linux.* ld=ld-linux.so.2 ---- glibc-2.15/elf/dl-load.c.~1~ 2011-12-30 23:13:56.000000000 +0100 -+++ glibc-2.15/elf/dl-load.c 2012-04-18 15:05:33.203485389 +0200 -@@ -2082,10 +2082,13 @@ - soname = ((const char *) D_PTR (l, l_info[DT_STRTAB]) - + l->l_info[DT_SONAME]->d_un.d_val); - if (strcmp (name, soname) != 0) -+#ifdef __arm__ -+ if (strcmp(name, "ld-linux.so.3") || strcmp(soname, "ld-linux-armhf.so.3")) -+#endif - continue; - - /* We have a match on a new name -- cache it. */ -- add_name_to_object (l, soname); -+ add_name_to_object (l, name); - l->l_soname_added = 1; - } - diff --git a/glibc-armhf-compat.patch b/glibc-armhf-compat.patch new file mode 100644 index 0000000..01e656f --- /dev/null +++ b/glibc-armhf-compat.patch @@ -0,0 +1,22 @@ +Patch for elf/dl-load.c taken from Debian: +For backward compatibility with armhf binaries built with the +old linker SONAME, we need to fake out the linker to believe +the new is the old, until such a point as everything is rebuilt. + +--- glibc-2.15/elf/dl-load.c.~1~ 2011-12-30 23:13:56.000000000 +0100 ++++ glibc-2.15/elf/dl-load.c 2012-04-18 15:05:33.203485389 +0200 +@@ -2082,10 +2082,13 @@ + soname = ((const char *) D_PTR (l, l_info[DT_STRTAB]) + + l->l_info[DT_SONAME]->d_un.d_val); + if (strcmp (name, soname) != 0) ++#ifdef __arm__ ++ if (strcmp(name, "ld-linux.so.3") || strcmp(soname, "ld-linux-armhf.so.3")) ++#endif + continue; + + /* We have a match on a new name -- cache it. */ +- add_name_to_object (l, soname); ++ add_name_to_object (l, name); + l->l_soname_added = 1; + } + diff --git a/glibc-nscd-foreground.patch b/glibc-nscd-foreground.patch new file mode 100644 index 0000000..f1ab742 --- /dev/null +++ b/glibc-nscd-foreground.patch @@ -0,0 +1,98 @@ +diff -rup a/nscd/nscd.c b/nscd/nscd.c +--- a/nscd/nscd.c 2012-01-01 05:16:32.000000000 -0700 ++++ b/nscd/nscd.c 2012-02-03 13:07:50.509740586 -0700 +@@ -72,7 +72,12 @@ thread_info_t thread_info; + int do_shutdown; + int disabled_passwd; + int disabled_group; +-int go_background = 1; ++ ++/* Default is to daemonize. Set to 1 to run in foreground in ++ debugging mode, or negative to run in foreground but otherwise ++ behave like a daemon, i.e., detach from terminal and use ++ syslog. */ ++static int run_in_foreground = 0; + + static const char *conffile = _PATH_NSCDCONF; + +@@ -104,6 +109,8 @@ static const struct argp_option options[ + N_("Read configuration data from NAME") }, + { "debug", 'd', NULL, 0, + N_("Do not fork and display messages on the current tty") }, ++ { "foreground", 'F', NULL, 0, ++ N_("Do not fork, but otherwise behave like a deamon") }, + { "nthreads", 't', N_("NUMBER"), 0, N_("Start NUMBER threads") }, + { "shutdown", 'K', NULL, 0, N_("Shut the server down") }, + { "statistics", 'g', NULL, 0, N_("Print current configuration statistics") }, +@@ -174,16 +181,22 @@ main (int argc, char **argv) + /* Determine page size. */ + pagesize_m1 = getpagesize () - 1; + +- /* Behave like a daemon. */ +- if (go_background) ++ if (run_in_foreground <= 0) + { + int i; ++ pid_t pid; + +- pid_t pid = fork (); +- if (pid == -1) +- error (EXIT_FAILURE, errno, _("cannot fork")); +- if (pid != 0) +- exit (0); ++ /* Behave like a daemon. */ ++ if (!run_in_foreground) ++ { ++ pid = fork (); ++ if (pid == -1) ++ error (EXIT_FAILURE, errno, _("cannot fork")); ++ if (pid != 0) ++ exit (0); ++ } ++ else ++ fprintf (stderr, _("further output sent to syslog\n")); + + int nullfd = open (_PATH_DEVNULL, O_RDWR); + if (nullfd != -1) +@@ -234,11 +247,14 @@ main (int argc, char **argv) + for (i = min_close_fd; i < getdtablesize (); i++) + close (i); + +- pid = fork (); +- if (pid == -1) +- error (EXIT_FAILURE, errno, _("cannot fork")); +- if (pid != 0) +- exit (0); ++ if (!run_in_foreground) ++ { ++ pid = fork (); ++ if (pid == -1) ++ error (EXIT_FAILURE, errno, _("cannot fork")); ++ if (pid != 0) ++ exit (0); ++ } + + setsid (); + +@@ -260,7 +276,7 @@ main (int argc, char **argv) + signal (SIGTSTP, SIG_IGN); + } + else +- /* In foreground mode we are not paranoid. */ ++ /* In debug mode we are not paranoid. */ + paranoia = 0; + + signal (SIGINT, termination_handler); +@@ -309,7 +325,11 @@ parse_opt (int key, char *arg, struct ar + { + case 'd': + ++debug_level; +- go_background = 0; ++ run_in_foreground = 1; ++ break; ++ ++ case 'F': ++ run_in_foreground = -1; + break; + + case 'f': diff --git a/glibc.changes b/glibc.changes index 26fb8f7..d68494b 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed May 9 07:30:36 UTC 2012 - aj@suse.de + +- Split out glibc-armhf-compat.patch from armhf-ld-so.patch. +- Run nscd in the foreground with systemd (glibc-nscd-foreground-patch) + ------------------------------------------------------------------- Tue May 8 14:00:52 UTC 2012 - aj@suse.de diff --git a/glibc.spec b/glibc.spec index c917b47..6067293 100644 --- a/glibc.spec +++ b/glibc.spec @@ -205,6 +205,8 @@ Patch18: glibc-cpusetsize.diff # According the the Debian bug report, this is fixed in valgrind now, so disable # this patch. Patch19: x86-cpuid-level2.patch +# PATCH-FIX-OPENSUSE Allow ARM binaries with old linker path to run - aj@suse.de +Patch20: glibc-armhf-compat.patch ### Locale related patches # PATCH-FIX-OPENSUSE Add additional locales @@ -275,14 +277,16 @@ Patch1008: glibc-2.16-fix-check-localplt.patch Patch1009: glibc-uio-cell.diff # PATCH-FIX-UPSTREAM - do not use initfini anymore Patch1010: glibc-2.16-powerpc-initfini.patch +# PATCH-FIX-UPSTREAM Use new common path for ARMv7 hardware float linker - aj@suse.de +Patch1011: armhf-ld-so.patch +# PATCH-FIX-UPSTREAM Add --foreground for nscd (from Fedora) - aj@suse.de +Patch1012: glibc-nscd-foreground.patch ### # Patches awaiting upstream approval ### # PATCH-FIX-UPSTREAM Fix assertion error in res_query.c (bso#13013) Patch2001: glibc-resolv-assert.diff -# PATCH-FIX-UPSTREAM Use new common path for ARMv7 hardware float linker - aj@suse.de -Patch2002: armhf-ld-so.patch # PATCH-FIX-UPSTREAM Fix crash when nscd is not running (bso#135949) - aj@suse.de Patch2003: glibc-nscd-crash-bso13594.patch # PATCH-FIX-OPENSUSE Fix crash (access-after-free) in dl_lookup_x bnc#703140, bso#13579 matz@suse.de @@ -546,11 +550,13 @@ rm nscd/s-stamp # to support further architectures, some more changes are needed %patch1010 -p1 %endif +%ifarch armv7l armv7hl +%patch1011 -p1 +%patch20 -p1 +%endif +%patch1012 -p1 %patch2001 -p1 -%ifarch armv7l armv7hl -%patch2002 -p1 -%endif %patch2003 -p1 %patch2004 -p1 # XXX: Does not pass testsuite, still there's no better solution yet diff --git a/nscd.service b/nscd.service index 80e7626..a4a25d0 100644 --- a/nscd.service +++ b/nscd.service @@ -3,11 +3,14 @@ Description=Name Service Cache Daemon After=syslog.target [Service] -Type=forking -ExecStart=/usr/sbin/nscd +ExecStart=/usr/sbin/nscd --foreground ExecStop=/usr/sbin/nscd --shutdown +ExecReload=/usr/sbin/nscd -i passwd +ExecReload=/usr/sbin/nscd -i group +ExecReload=/usr/sbin/nscd -i hosts +ExecReload=/usr/sbin/nscd -i services +ExecReload=/usr/sbin/nscd -i netgroup Restart=always -PIDFile=/var/run/nscd/nscd.pid [Install] WantedBy=multi-user.target