Browse Source

Merge branch 'candidate-6.0.8' into candidate-6.2.0

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 years ago
parent
commit
f0280cd3e5

+ 10 - 1
cmake_modules/commonSetup.cmake

@@ -225,6 +225,11 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
   set(CMAKE_MODULE_PATH "${HPCC_SOURCE_DIR}/cmake_modules/")
 
   if(UNIX AND SIGN_MODULES)
+      execute_process(COMMAND bash "-c" "gpg --version | awk 'NR==1{print $3}'"
+        OUTPUT_VARIABLE GPG_VERSION
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        ERROR_QUIET)
+    message(STATUS "gpg version ${GPG_VERSION}")
     #export gpg public key used for signing to new installation
     add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/pub.key
       COMMAND gpg --output=${CMAKE_BINARY_DIR}/pub.key --batch --no-tty --export ${SIGN_MODULES_KEYID}
@@ -945,9 +950,13 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
       if(DEFINED SIGN_MODULES_KEYID)
         set(GPG_DEFAULT_KEY_OPTION --default-key)
       endif()
+      set(GPG_BATCH_OPTIONS --batch --no-tty)
+      if("${GPG_VERSION}" VERSION_GREATER "2.1")
+          set(GPG_BATCH_OPTIONS --pinentry-mode=loopback ${GPG_BATCH_OPTIONS})
+      endif()
       add_custom_command(
         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${module}
-        COMMAND gpg --output ${CMAKE_CURRENT_BINARY_DIR}/${module} ${GPG_DEFAULT_KEY_OPTION} ${SIGN_MODULES_KEYID}  --clearsign ${GPG_PASSPHRASE_OPTION} ${SIGN_MODULES_PASSPHRASE} --batch --no-tty ${module}
+        COMMAND gpg ${GPG_BATCH_OPTIONS} --output ${CMAKE_CURRENT_BINARY_DIR}/${module} ${GPG_PASSPHRASE_OPTION} ${SIGN_MODULES_PASSPHRASE} ${GPG_DEFAULT_KEY_OPTION} ${SIGN_MODULES_KEYID} --clearsign ${module} </dev/null
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
         COMMENT "Adding signed ${module} to project"
         )

+ 1 - 0
cmake_modules/dependencies/yakkety.cmake

@@ -0,0 +1 @@
+SET_DEPENDENCIES ( CPACK_DEBIAN_PACKAGE_DEPENDS g++ openssh-client openssh-server expect rsync libapr1 python psmisc )

+ 3 - 4
system/jlib/jdebug.cpp

@@ -1481,7 +1481,7 @@ class CProcessMonitor
     CIArrayOf<CProcInfo> processes;
     unsigned tot_time;
     bool busy;
-
+    CriticalSection sect;
 
     static int compare(CInterface * const *i1, CInterface * const *i2)
     {
@@ -1502,9 +1502,8 @@ public:
             processes.item(i1).active = false;
         DIR *dir = opendir("/proc");
         loop {
-            struct dirent *ent;
-            struct dirent entryMem;
-            readdir_r(dir, &entryMem, &ent);
+            CriticalBlock b(sect);
+            struct dirent *ent = readdir(dir);
             if (!ent)
                 break;
             if ((ent->d_name[0]>='0')&&(ent->d_name[0]<='9')) {

+ 3 - 2
system/jlib/jfile.cpp

@@ -3557,6 +3557,7 @@ class CLinuxDirectoryIterator : public CDirectoryIterator
     DIR *           handle;
     struct stat     st;
     bool            gotst;
+    CriticalSection sect;
 
     bool loadst()
     {
@@ -3617,11 +3618,11 @@ public:
     bool next()
     {
         loop {
-            struct dirent dirEntry;
             struct dirent *entry;
             loop {
                 gotst = false;
-                readdir_r(handle, &dirEntry, &entry);
+                CriticalBlock b(sect);
+                entry = readdir(handle);
                 // need better checking here?
                 if (!entry)
                     break;

+ 3 - 2
system/jlib/jregexp.cpp

@@ -1344,10 +1344,11 @@ static bool WildMatchNreplace ( const char *src, int srclen, int srcidx,
                     (toupper(src[srcidx])!=toupper(next_char)))
                     goto Fail;
             }
-            else
+            else {
                 if ((srcidx == srclen) || (src[srcidx]!=next_char))
                     goto Fail;
-                srcidx++;
+            }
+            srcidx++;
         }
         else {
             loop {

+ 6 - 2
system/jlib/jthread.cpp

@@ -1644,20 +1644,24 @@ class CIgnoreSIGPIPE
 public:
     CIgnoreSIGPIPE()
     {
+        oact.sa_handler = SIG_IGN;
         struct sigaction act;
         sigset_t blockset;
         sigemptyset(&blockset);
         act.sa_mask = blockset;
         act.sa_handler = SIG_IGN;
         act.sa_flags = 0;
-        sigaction(SIGPIPE, &act, NULL);
+        sigaction(SIGPIPE, &act, &oact);
     }
 
     ~CIgnoreSIGPIPE()
     {
-        signal(SIGPIPE, SIG_DFL);
+        if (oact.sa_handler != SIG_IGN)
+            sigaction(SIGPIPE, &oact, NULL);
     }
 
+private:
+    struct sigaction oact;
 };
 
 #define WHITESPACE " \t\n\r"

+ 9 - 1
system/security/LdapSecurity/ldaputils.cpp

@@ -23,6 +23,9 @@
 
 #include "ldaputils.hpp"
 
+#ifndef _WIN32
+# include <signal.h>
+#endif
 
 //------------------------------------
 // LdapUtils implementation
@@ -107,7 +110,12 @@ int LdapUtils::LdapSimpleBind(LDAP* ld, char* userdn, char* password)
     ldap_set_option(ld, LDAP_OPT_TIMEOUT, &timeout);
     ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &timeout);
 #endif
-    return ldap_bind_s(ld, userdn, password, LDAP_AUTH_SIMPLE);
+    int srtn = ldap_bind_s(ld, userdn, password, LDAP_AUTH_SIMPLE);
+#ifndef _WIN32
+    // secure ldap tls might overwrite SIGPIPE handler
+    signal(SIGPIPE, SIG_IGN);
+#endif
+    return srtn;
 }
 
 // userdn is required for ldap_simple_bind_s, not really necessary for ldap_bind_s.

+ 2 - 0
thorlcr/graph/thgraphmaster.cpp

@@ -237,6 +237,8 @@ void CSlaveMessageHandler::main()
                             size32_t startCtxLen;
                             msg.read(startCtxLen);
                             element->doCreateActivity(parentExtractSz, parentExtract, startCtxLen ? &msg : nullptr);
+                            if (element->queryActivity())
+                                element->preStart(parentExtractSz, parentExtract);
                         }
                         catch (IException *e)
                         {