The branch, master has been updated
       via  b5fe9c6 selftest: Fix timestamps on FreeBSD 11
       via  656f2a9 s3/dump_core: Honour pipe symbol (|) in system-wide 
core_pattern under linux
      from  530c2c8 ldb: version 1.1.28

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b5fe9c685fcdf62fb1c42543933d12d018297b04
Author: Volker Lendecke <[email protected]>
Date:   Wed Nov 23 13:54:39 2016 +0100

    selftest: Fix timestamps on FreeBSD 11
    
    FreeBSD's date does not print the %, and \? does not catch that
    
    Tested this manually:
    
    $ echo 'time: 2016-11-23 12:52:19.123456Z'| sed 's/\..*NZ$/.000000Z/'
    time: 2016-11-23 12:52:19.123456Z
    $ echo 'time: 2016-11-23 12:52:19.%6NZ'| sed 's/\..*NZ$/.000000Z/'
    time: 2016-11-23 12:52:19.000000Z
    $ echo 'time: 2016-11-23 12:52:19.6NZ'| sed 's/\..*NZ$/.000000Z/'
    time: 2016-11-23 12:52:19.000000Z
    $ echo 'time: 2016-11-23 12:52:19.NZ'| sed 's/\..*NZ$/.000000Z/'
    time: 2016-11-23 12:52:19.000000Z
    $
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>
    
    Autobuild-User(master): Michael Adam <[email protected]>
    Autobuild-Date(master): Thu Nov 24 00:42:55 CET 2016 on sn-devel-144

commit 656f2a9dcd6822e1e8606a56bf4cd8984ce80f5d
Author: Anoop C S <[email protected]>
Date:   Wed Nov 16 08:55:13 2016 +0000

    s3/dump_core: Honour pipe symbol (|) in system-wide core_pattern under linux
    
    From man core(5):
    
    "Since  kernel  2.6.19, Linux supports an alternate syntax for the
    /proc/sys/kernel/core_pattern file.  If the first character of this
    file is a pipe symbol (|), then the remainder of the line is interpreted
    as a user-space program to be executed."
    
    Discarding this symbol would result in misleading logs for 
smbd/nmbd/winbindd.
    For example even if core_pattern contains '|', smbd logs would suggest the
    following:
    
    ...
    dumping core in /var/log/samba/cores/smbd
    ...
    
    and coredump may or may not get created at that location depending on which
    helper binary is being used for handling coredumps.
    
    Signed-off-by: Anoop C S <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/dumpcore.c        | 32 ++++++++++++++++++++++++--------
 testprogs/blackbox/subunit.sh |  2 +-
 2 files changed, 25 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/dumpcore.c b/source3/lib/dumpcore.c
index c72aa88..6c305ab 100644
--- a/source3/lib/dumpcore.c
+++ b/source3/lib/dumpcore.c
@@ -37,6 +37,7 @@
 #endif
 
 static char *corepath;
+static bool using_helper_binary = false;
 
 /**
  * Build up the default corepath as "<logbase>/cores/<progname>"
@@ -169,6 +170,12 @@ static char *get_linux_corepath(void)
                /*
                 * No absolute path, use the default (cwd)
                 */
+               if (result[0] == '|') {
+                       /*
+                       * Core dump handled by helper binaries
+                       */
+                       using_helper_binary = true;
+               }
                TALLOC_FREE(result);
                return NULL;
        }
@@ -291,16 +298,25 @@ void dump_core_setup(const char *progname, const char 
*log_file)
        }
 
        if (*corepath != '\0') {
-               /* The chdir might fail if we dump core before we finish
-                * processing the config file.
+               /*
+                * Check whether coredump is handled by helper binaries or not.
+                * If so skip chdir().
                 */
-               if (chdir(corepath) != 0) {
-                       DEBUG(0, ("unable to change to %s\n", corepath));
-                       DEBUGADD(0, ("refusing to dump core\n"));
-                       exit(1);
-               }
+               if (!using_helper_binary) {
+                       /* The chdir might fail if we dump core before we finish
+                        * processing the config file.
+                        */
+                       if (chdir(corepath) != 0) {
+                               DEBUG(0, ("unable to change to %s\n", 
corepath));
+                               DEBUGADD(0, ("refusing to dump core\n"));
+                               exit(1);
+                       }
 
-               DEBUG(0,("dumping core in %s\n", corepath));
+                       DEBUG(0,("dumping core in %s\n", corepath));
+               } else {
+                       DEBUG(0,("coredump is handled by helper binary "
+                                "specified at /proc/sys/kernel/core_pattern"));
+               }
        }
 
        umask(~(0700));
diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh
index 70fe2d7..0791d77 100755
--- a/testprogs/blackbox/subunit.sh
+++ b/testprogs/blackbox/subunit.sh
@@ -22,7 +22,7 @@ timestamp() {
   # mark the start time. With Gnu date, you get nanoseconds from %N
   # (here truncated to microseconds with %6N), but not on BSDs,
   # Solaris, etc, which will apparently leave either %N or N at the end.
-  date -u +'time: %Y-%m-%d %H:%M:%S.%6NZ' | sed 's/%\?NZ$/000000Z/'
+  date -u +'time: %Y-%m-%d %H:%M:%S.%6NZ' | sed 's/\..*NZ$/.000000Z/'
 }
 
 subunit_start_test () {


-- 
Samba Shared Repository

Reply via email to