Hello community,

here is the log from the commit of package watchman for openSUSE:Factory 
checked in at 2018-06-29 22:29:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/watchman (Old)
 and      /work/SRC/openSUSE:Factory/.watchman.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "watchman"

Fri Jun 29 22:29:39 2018 rev:3 rq:617742 version:unknown

Changes:
--------
--- /work/SRC/openSUSE:Factory/watchman/watchman.changes        2017-06-21 
13:58:05.471756797 +0200
+++ /work/SRC/openSUSE:Factory/.watchman.new/watchman.changes   2018-06-29 
22:29:41.658333749 +0200
@@ -1,0 +2,64 @@
+Tue Jun 12 07:37:59 UTC 2018 - [email protected]
+
+- watchman_4.7.0_makefile-am.diff: dropped, included in tarball by now
+- 0001-Replaced-memset-calls-with-appopriate-C-11-init-or-a.patch: fix invalid
+  raw memory accesses of non-POD objects, fixes ppc build.
+- 0002-Re-worked-replacement-of-memset-with-proper-init-to-.patch: fix
+  compiler errors introduced by the above patch ...
+- update to version 4.9.0:
+  - Changes in 4.8.0:
+    * New command `flush-subscriptions` to synchronize subscriptions associated
+      with the current session.
+    * Enforce socket Unix groups more strongly — Watchman will now refuse to 
start
+      if it couldn't gain the right group memberships, as can happen for sites 
that
+      are experiencing intermittent LDAP connectivity problems.
+    * pywatchman now officially supports Python 3. pywatchman will return 
Unicode
+      strings (possibly with surrogate escapes) by default, but can optionally 
return
+      bytestrings. Note that on Python 3, pywatchman requires Watchman 4.8 and 
above.
+      The Python 2 interface and requirements remain unchanged.
+    * Prior to 4.8, methods on the Java WatchmanClient that returned
+       ListenableFutures would swallow exceptions and hang in an unfinished 
state
+       under situations like socket closure or thread death.  This has been 
fixed, and
+       now ListenableFutures propagate exception conditions immediately.  
(Note that
+       this is typically unrecoverable, and users should create a new 
WatchmanClient
+       to re-establish communication with Watchman.)  See #412.
+    * The minimum Java version for the Watchman Java client has always been 
1.7,
+       but it was incorrectly described to be 1.6.  The Java client's build 
file has
+       been fixed accordingly.
+    * Watchman was converted from C to C++.  The conversion exposed several
+       concurrency bugs, all of which have now been fixed.
+    * Subscription queries are now executed in the context of the client 
thread,
+       which means that subscriptions are dispatched in parallel.  Previously,
+       subscriptions would be serially dispatched and block the disk IO thread.
+    * Triggers are now dispatched in parallel and waits are managed in their 
own
+       threads (one thread per trigger).  This improves concurrency and 
resolves a
+       couple of waitpid related issues where watchman may not reap spawned 
children
+       in a timely fashion, or may spin on CPU until another child is spawned.
+    * Fixed an object lifecycle management issue that could cause a crash when
+      aging out old/transient files.
+    * Implement an upgraded wire protocol, BSERv2, on the server and in 
pywatchman.
+       BSERv2 can carry information about string encoding over the wire. This 
lets
+       pywatchman convert to Unicode strings on Python 3. Clients and servers 
know how
+       to  transparently fall back to BSERv1.
+  - Changes in 4.9.0:
+    * New field: `content.sha1hex`.  This field expands to the SHA1 hash of
+      the file contents, expressed in hex digits (40 character hex string).
+      Watchman maintains a cache of the content hashes and can compute the
+      hash on demand and also heuristically as files are changed.  This is
+      useful for tooling that wants to perform more intelligent cache 
invalidation
+      or build artifact fetching from content addressed storage.
+    * Fixed an issue that resulted in the perf logging thread deadlocking when
+      `perf_logger_command` is enabled in the global configuration
+    * Fixed an issue where queries larger than 1MB would likely result in
+      a PDU error response.
+    * Reduced lock contention for subscriptions that do no use the advanced
+      settling (`drop`, `defer`) options.
+    * Fixed `since` generator behavior when using unix timestamps rather than
+      the preferred clock string syntax
+    * Improved the reporting of "new" files in watchman results
+    * Improved performance of handling changes on case insensitive filesystems
+    * pywatchman: the python wheel format is used for publishing watchman pypi 
package
+    * pywatchman: now watchman path is configurable in python client
+    * pywatchman: now python client can be used as a context manager
+
+-------------------------------------------------------------------

Old:
----
  fallthrough.diff
  v4.7.0.tar.gz

New:
----
  0001-Replaced-memset-calls-with-appopriate-C-11-init-or-a.patch
  0002-Re-worked-replacement-of-memset-with-proper-init-to-.patch
  v4.9.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ watchman.spec ++++++
--- /var/tmp/diff_new_pack.Ew0TmU/_old  2018-06-29 22:29:42.334333234 +0200
+++ /var/tmp/diff_new_pack.Ew0TmU/_new  2018-06-29 22:29:42.338333231 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package watchman
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -21,17 +21,20 @@
 Name:           watchman
 BuildRequires:  autoconf
 BuildRequires:  automake
+BuildRequires:  gcc-c++
+BuildRequires:  libtool
+BuildRequires:  openssl-devel
 BuildRequires:  pcre-devel
 BuildRequires:  python
 BuildRequires:  systemd-rpm-macros
 Requires:       pcre
 %{?systemd_requires}
-Version:        4.7.0
+Version:        4.9.0
 Release:        0
 Url:            https://facebook.github.io/watchman/
 Summary:        A file watching service
 # the thirdparty code is partially MIT-licensed or at least some such
-License:        Apache-2.0 and MIT
+License:        Apache-2.0 AND MIT
 Group:          System/Monitoring
 Source0:        https://github.com/facebook/watchman/archive/v%version.tar.gz
 # tmpfiles.d configuration for statedir
@@ -41,11 +44,8 @@
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 # prevent the build system overwriting the autotools docdir in a hard-coded way
 Patch0:         %{name}_4.7.0_makefile-am.diff
-# fix build with gcc 7 regarding switch/case fall through logic
-# this is already fixed upstream, but they have no new release and also
-# refactored a lot of code, for example hash.c is now hash.cpp, that's why I
-# made my own patch against 4.7.0
-Patch1:         fallthrough.diff
+Patch1:         0001-Replaced-memset-calls-with-appopriate-C-11-init-or-a.patch
+Patch2:         0002-Re-worked-replacement-of-memset-with-proper-init-to-.patch
 PreReq:         %fillup_prereq
 
 %description
@@ -93,7 +93,8 @@
 %prep
 %setup -q
 %patch0
-%patch1 -p 1
+%patch1 -p1
+%patch2 -p1
 
 # There is some basic support for watchman to run under systemd:
 #
@@ -153,6 +154,7 @@
 #
 # So let's build everything with no strict aliasing then
 export CFLAGS="%optflags -fno-strict-aliasing"
+export CXXFLAGS="%optflags -Wno-format-truncation"
 %configure \
        --without-ruby \
        --enable-statedir=%{rundir} \
@@ -177,11 +179,16 @@
 install -D -m 444 %{SOURCE2} %{build_unitdir}/%{name}@.service
 install -D -m 444 %{SOURCE3} %{build_unitdir}/%{name}@.socket
 
-%files
 %define tmpfile_conf %{_tmpfilesdir}/%{name}.conf
+%files
 %defattr(-,root,root)
 %doc %{docdir}
 %_bindir/watchman
+# explicitly own this dir, otherwise SLE12-SP2 build breaks? should actually
+# be owned by the filesystem package.
+%if 0%{?sle_version} <= 120200
+%dir %{_tmpfilesdir}
+%endif
 
 %{tmpfile_conf}
 # avoid rpmlint warning tmpfile-not-in-filelist

++++++ 0001-Replaced-memset-calls-with-appopriate-C-11-init-or-a.patch ++++++
>From 8ab92d2d307066f3aa44f13be0e4ac7c11c740ca Mon Sep 17 00:00:00 2001
From: Sergey Zhupanov <[email protected]>
Date: Thu, 25 Jan 2018 14:58:21 -0800
Subject: [PATCH 1/2] Replaced memset calls with appopriate C++11 init or
 assignment.

Summary: Replaced memset calls with appropriate C++ init or assignment to 
default-constructed struct.

Reviewed By: wez

Differential Revision: D6770919

fbshipit-source-id: 7d623da7935b54cf00c4775f56298845c528c9f1
---
 FileDescriptor.cpp       |  6 ++----
 Pipe.cpp                 |  3 +--
 json.cpp                 |  2 +-
 listener.cpp             |  6 ++----
 log.cpp                  |  3 +--
 main.cpp                 |  6 ++----
 opendir.cpp              |  4 ++--
 scm/Mercurial.cpp        |  2 +-
 stream_unix.cpp          |  3 +--
 stream_win.cpp           |  3 +--
 tests/bser.cpp           |  2 +-
 watcher/eden.cpp         |  2 +-
 watcher/fsevents.cpp     |  6 ++----
 watcher/kqueue.cpp       |  9 +++------
 watcher/win32.cpp        |  3 +--
 winbuild/backtrace.cpp   |  2 +-
 winbuild/dir.cpp         |  2 +-
 winbuild/posix_spawn.cpp | 14 +++++---------
 18 files changed, 29 insertions(+), 49 deletions(-)

Index: watchman-4.9.0/FileDescriptor.cpp
===================================================================
--- watchman-4.9.0.orig/FileDescriptor.cpp
+++ watchman-4.9.0/FileDescriptor.cpp
@@ -151,7 +151,7 @@ bool FileDescriptor::isNonBlock() const
  * If the case does not match, throws an exception. */
 static void checkCanonicalBaseName(const char *path) {
 #ifdef __APPLE__
-  struct attrlist attrlist;
+  struct attrlist attrlist = {};
   struct {
     uint32_t len;
     attrreference_t ref;
@@ -160,7 +160,6 @@ static void checkCanonicalBaseName(const
   w_string_piece pathPiece(path);
   auto base = pathPiece.baseName();
 
-  memset(&attrlist, 0, sizeof(attrlist));
   attrlist.bitmapcount = ATTR_BIT_MAP_COUNT;
   attrlist.commonattr = ATTR_CMN_NAME;
 
@@ -237,7 +236,7 @@ FileDescriptor openFileHandle(const char
 #else // _WIN32
   DWORD access = 0, share = 0, create = 0, attrs = 0;
   DWORD err;
-  SECURITY_ATTRIBUTES sec;
+  SECURITY_ATTRIBUTES sec = {};
 
   if (!strcmp(path, "/dev/null")) {
     path = "NUL:";
@@ -259,7 +258,6 @@ FileDescriptor openFileHandle(const char
   // We want more posix-y behavior by default
   share = FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE;
 
-  memset(&sec, 0, sizeof(sec));
   sec.nLength = sizeof(sec);
   sec.bInheritHandle = TRUE;
   if (opts.closeOnExec) {
Index: watchman-4.9.0/Pipe.cpp
===================================================================
--- watchman-4.9.0.orig/Pipe.cpp
+++ watchman-4.9.0/Pipe.cpp
@@ -11,9 +11,8 @@ Pipe::Pipe() {
 #ifdef _WIN32
   HANDLE readPipe;
   HANDLE writePipe;
-  SECURITY_ATTRIBUTES sec;
+  SECURITY_ATTRIBUTES sec = {};
 
-  memset(&sec, 0, sizeof(sec));
   sec.nLength = sizeof(sec);
   sec.bInheritHandle = FALSE; // O_CLOEXEC equivalent
   constexpr DWORD kPipeSize = 64 * 1024;
Index: watchman-4.9.0/json.cpp
===================================================================
--- watchman-4.9.0.orig/json.cpp
+++ watchman-4.9.0/json.cpp
@@ -492,7 +492,7 @@ bool watchman_json_buffer::passThru(
 }
 
 json_ref watchman_json_buffer::decodeNext(w_stm_t stm, json_error_t* jerr) {
-  memset(jerr, 0, sizeof(*jerr));
+  *jerr = json_error_t();
   if (!readAndDetectPdu(stm, jerr)) {
     return nullptr;
   }
Index: watchman-4.9.0/listener.cpp
===================================================================
--- watchman-4.9.0.orig/listener.cpp
+++ watchman-4.9.0/listener.cpp
@@ -442,7 +442,7 @@ static std::shared_ptr<watchman_client>
 #ifdef _WIN32
 static void named_pipe_accept_loop(const char *path) {
   HANDLE handles[2];
-  OVERLAPPED olap;
+  OVERLAPPED olap = {};
   HANDLE connected_event = CreateEvent(NULL, FALSE, TRUE, NULL);
 
   if (!connected_event) {
@@ -455,7 +455,6 @@ static void named_pipe_accept_loop(const
 
   handles[0] = connected_event;
   handles[1] = listener_thread_event;
-  memset(&olap, 0, sizeof(olap));
   olap.hEvent = connected_event;
 
   w_log(W_LOG_ERR, "waiting for pipe clients on %s\n", path);
@@ -574,7 +573,7 @@ static void accept_loop(FileDescriptor&&
 bool w_start_listener(const char *path)
 {
 #ifndef _WIN32
-  struct sigaction sa;
+  struct sigaction sa = {};
   sigset_t sigset;
 #endif
 
@@ -649,7 +648,6 @@ bool w_start_listener(const char *path)
 
   /* allow SIGUSR1 and SIGCHLD to wake up a blocked thread, without restarting
    * syscalls */
-  memset(&sa, 0, sizeof(sa));
   sa.sa_handler = wakeme;
   sa.sa_flags = 0;
   sigaction(SIGUSR1, &sa, NULL);
Index: watchman-4.9.0/log.cpp
===================================================================
--- watchman-4.9.0.orig/log.cpp
+++ watchman-4.9.0/log.cpp
@@ -298,9 +298,8 @@ static LONG WINAPI exception_filter(LPEX
 
 void w_setup_signal_handlers(void) {
 #ifndef _WIN32
-  struct sigaction sa;
+  struct sigaction sa = {};
 
-  memset(&sa, 0, sizeof(sa));
   sa.sa_sigaction = crash_handler;
   sa.sa_flags = SA_SIGINFO|SA_RESETHAND;
 
Index: watchman-4.9.0/main.cpp
===================================================================
--- watchman-4.9.0.orig/main.cpp
+++ watchman-4.9.0/main.cpp
@@ -49,7 +49,7 @@ static void compute_file_name(char **str
 
 static bool lock_pidfile(void) {
 #if !defined(USE_GIMLI) && !defined(_WIN32)
-  struct flock lock;
+  struct flock lock = {};
   pid_t mypid;
 
   // We defer computing this path until we're in the server context because
@@ -58,7 +58,6 @@ static bool lock_pidfile(void) {
   compute_file_name(&pid_file, compute_user_name(), "pid", "pidfile");
 
   mypid = getpid();
-  memset(&lock, 0, sizeof(lock));
   lock.l_type = F_WRLCK;
   lock.l_start = 0;
   lock.l_whence = SEEK_SET;
@@ -887,10 +886,9 @@ static json_ref build_command(int argc,
 
   // Read blob from stdin
   if (json_input_arg) {
-    json_error_t err;
+    json_error_t err = {};
     w_jbuffer_t buf;
 
-    memset(&err, 0, sizeof(err));
     auto cmd = buf.decodeNext(w_stm_stdin(), &err);
 
     if (buf.pdu_type == is_bser) {
Index: watchman-4.9.0/opendir.cpp
===================================================================
--- watchman-4.9.0.orig/opendir.cpp
+++ watchman-4.9.0/opendir.cpp
@@ -142,7 +142,7 @@ DirHandle::DirHandle(const char* path, b
       throw std::system_error(ENOTDIR, std::generic_category(), path);
     }
 
-    memset(&attrlist_, 0, sizeof(attrlist_));
+    attrlist_ = attrlist();
     attrlist_.bitmapcount = ATTR_BIT_MAP_COUNT;
     attrlist_.commonattr = ATTR_CMN_RETURNED_ATTRS |
       ATTR_CMN_ERROR |
@@ -216,7 +216,7 @@ const watchman_dir_ent* DirHandle::readD
       return &ent_;
     }
 
-    memset(&ent_.stat, 0, sizeof(ent_.stat));
+    ent_.stat = watchman::FileInformation();
 
     ent_.stat.dev = item->dev;
     memcpy(&ent_.stat.mtime, &item->mtime, sizeof(item->mtime));
Index: watchman-4.9.0/scm/Mercurial.cpp
===================================================================
--- watchman-4.9.0.orig/scm/Mercurial.cpp
+++ watchman-4.9.0/scm/Mercurial.cpp
@@ -13,7 +13,7 @@ namespace watchman {
 using Options = ChildProcess::Options;
 
 Mercurial::infoCache::infoCache(std::string path) : dirStatePath(path) {
-  memset(&dirstate, 0, sizeof(dirstate));
+  dirstate = FileInformation();
 }
 
 w_string Mercurial::infoCache::lookupMergeBase(const std::string& commitId) {
Index: watchman-4.9.0/stream_unix.cpp
===================================================================
--- watchman-4.9.0.orig/stream_unix.cpp
+++ watchman-4.9.0/stream_unix.cpp
@@ -222,7 +222,7 @@ std::unique_ptr<watchman_stream> w_stm_f
 std::unique_ptr<watchman_stream> w_stm_connect_unix(
     const char* path,
     int timeoutms) {
-  struct sockaddr_un un;
+  struct sockaddr_un un = {};
   int max_attempts = timeoutms / 10;
   int attempts = 0;
   int bufsize = WATCHMAN_IO_BUF_SIZE;
@@ -238,7 +238,6 @@ std::unique_ptr<watchman_stream> w_stm_c
     return nullptr;
   }
 
-  memset(&un, 0, sizeof(un));
   un.sun_family = PF_LOCAL;
   memcpy(un.sun_path, path, strlen(path));
 
Index: watchman-4.9.0/stream_win.cpp
===================================================================
--- watchman-4.9.0.orig/stream_win.cpp
+++ watchman-4.9.0/stream_win.cpp
@@ -715,7 +715,7 @@ int w_poll_events(struct watchman_event_
 FileDescriptor w_handle_open(const char* path, int flags) {
   DWORD access = 0, share = 0, create = 0, attrs = 0;
   DWORD err;
-  SECURITY_ATTRIBUTES sec;
+  SECURITY_ATTRIBUTES sec = {};
 
   if (!strcmp(path, "/dev/null")) {
     path = "NUL:";
@@ -733,7 +733,6 @@ FileDescriptor w_handle_open(const char*
   // We want more posix-y behavior by default
   share = FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE;
 
-  memset(&sec, 0, sizeof(sec));
   sec.nLength = sizeof(sec);
   sec.bInheritHandle = TRUE;
   if (flags & O_CLOEXEC) {
Index: watchman-4.9.0/tests/bser.cpp
===================================================================
--- watchman-4.9.0.orig/tests/bser.cpp
+++ watchman-4.9.0/tests/bser.cpp
@@ -155,7 +155,7 @@ static bool check_roundtrip(
   const char* end = dump_buf->data() + dump_buf->size();
   hexdump(dump_buf->data(), end);
 
-  memset(&jerr, 0, sizeof(jerr));
+  jerr = json_error_t();
   auto decoded = bunser(dump_buf->data(), end, &needed, &jerr);
   ok(decoded, "decoded something (err = %s)", jerr.text);
 
Index: watchman-4.9.0/watcher/eden.cpp
===================================================================
--- watchman-4.9.0.orig/watcher/eden.cpp
+++ watchman-4.9.0/watcher/eden.cpp
@@ -131,7 +131,7 @@ class EdenFileResult : public FileResult
       exists_ = true;
     } else {
       exists_ = false;
-      memset(&stat_, 0, sizeof(stat_));
+      stat_ = watchman::FileInformation();
     }
   }
 
Index: watchman-4.9.0/watcher/fsevents.cpp
===================================================================
--- watchman-4.9.0.orig/watcher/fsevents.cpp
+++ watchman-4.9.0/watcher/fsevents.cpp
@@ -275,7 +275,7 @@ static fse_stream* fse_stream_make(
     const std::shared_ptr<w_root_t>& root,
     FSEventStreamEventId since,
     w_string& failure_reason) {
-  FSEventStreamContext ctx;
+  FSEventStreamContext ctx = {};
   CFMutableArrayRef parray = nullptr;
   CFStringRef cpath = nullptr;
   double latency;
@@ -328,7 +328,6 @@ static fse_stream* fse_stream_make(
     }
   }
 
-  memset(&ctx, 0, sizeof(ctx));
   ctx.info = fse_stream;
 
   parray = CFArrayCreateMutable(nullptr, 0, &kCFTypeArrayCallBacks);
@@ -440,7 +439,7 @@ fail:
 
 void FSEventsWatcher::FSEventsThread(const std::shared_ptr<w_root_t>& root) {
   CFFileDescriptorRef fdref;
-  CFFileDescriptorContext fdctx;
+  CFFileDescriptorContext fdctx = {};
 
   w_set_thread_name("fsevents %s", root->root_path.c_str());
 
@@ -450,7 +449,6 @@ void FSEventsWatcher::FSEventsThread(con
 
     attempt_resync_on_drop = root->config.getBool("fsevents_try_resync", true);
 
-    memset(&fdctx, 0, sizeof(fdctx));
     fdctx.info = root.get();
 
     fdref = CFFileDescriptorCreate(
Index: watchman-4.9.0/watcher/kqueue.cpp
===================================================================
--- watchman-4.9.0.orig/watcher/kqueue.cpp
+++ watchman-4.9.0/watcher/kqueue.cpp
@@ -70,7 +70,7 @@ KQueueWatcher::KQueueWatcher(w_root_t* r
 }
 
 bool KQueueWatcher::startWatchFile(struct watchman_file* file) {
-  struct kevent k;
+  struct kevent k = {};
 
   auto full_name = w_dir_path_cat_str(file->parent, file->getName());
   {
@@ -98,7 +98,6 @@ bool KQueueWatcher::startWatchFile(struc
     return false;
   }
 
-  memset(&k, 0, sizeof(k));
   EV_SET(
       &k,
       rawFd,
@@ -140,7 +139,7 @@ std::unique_ptr<watchman_dir_handle> KQu
     struct timeval,
     const char* path) {
   struct stat st, osdirst;
-  struct kevent k;
+  struct kevent k = {};
 
   auto osdir = w_dir_open(path);
 
@@ -169,7 +168,6 @@ std::unique_ptr<watchman_dir_handle> KQu
         std::string("directory replaced between opendir and open: ") + path);
   }
 
-  memset(&k, 0, sizeof(k));
   auto dir_name = dir->getFullPath();
   EV_SET(
       &k,
@@ -256,7 +254,7 @@ bool KQueueWatcher::consumeNotify(
         fflags,
         flags_label);
     if ((fflags & (NOTE_DELETE|NOTE_RENAME|NOTE_REVOKE))) {
-      struct kevent k;
+      struct kevent k = {};
 
       if (w_string_equal(path, root->root_path)) {
         w_log(
@@ -269,7 +267,6 @@ bool KQueueWatcher::consumeNotify(
       }
 
       // Remove our watch bits
-      memset(&k, 0, sizeof(k));
       EV_SET(&k, fd, EVFILT_VNODE, EV_DELETE, 0, 0, nullptr);
       kevent(kq_fd.fd(), &k, 1, nullptr, 0, 0);
       wlock->name_to_fd.erase(path);
Index: watchman-4.9.0/watcher/win32.cpp
===================================================================
--- watchman-4.9.0.orig/watcher/win32.cpp
+++ watchman-4.9.0/watcher/win32.cpp
@@ -109,7 +109,7 @@ void WinWatcher::readChangesThread(const
   DWORD size = WATCHMAN_BATCH_LIMIT * (sizeof(FILE_NOTIFY_INFORMATION) + 512);
   std::vector<uint8_t> buf;
   DWORD err, filter;
-  OVERLAPPED olap;
+  OVERLAPPED olap = {};
   BOOL initiate_read = true;
   HANDLE handles[2] = {olapEvent, ping};
   DWORD bytes;
@@ -131,7 +131,6 @@ void WinWatcher::readChangesThread(const
         FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_SIZE |
         FILE_NOTIFY_CHANGE_LAST_WRITE;
 
-    memset(&olap, 0, sizeof(olap));
     olap.hEvent = olapEvent;
 
     buf.resize(size);
Index: watchman-4.9.0/winbuild/backtrace.cpp
===================================================================
--- watchman-4.9.0.orig/winbuild/backtrace.cpp
+++ watchman-4.9.0/winbuild/backtrace.cpp
@@ -40,7 +40,7 @@ char **backtrace_symbols(void **array, s
 
   std::call_once(sym_init_once, sym_init);
 
-  memset(&sym.info, 0, sizeof(sym.info));
+  sym.info = SYMBOL_INFO();
   sym.info.MaxNameLen = sizeof(sym) - sizeof(sym.info);
   sym.info.SizeOfStruct = sizeof(sym.info);
 
Index: watchman-4.9.0/winbuild/dir.cpp
===================================================================
--- watchman-4.9.0.orig/winbuild/dir.cpp
+++ watchman-4.9.0/winbuild/dir.cpp
@@ -41,7 +41,7 @@ class WinDirHandle : public watchman_dir
       win7_ = true;
     }
 
-    memset(&ent_, 0, sizeof(ent_));
+    ent_ = watchman_dir_ent();
     ent_.d_name = nameBuf_;
     ent_.has_stat = true;
     if (path[1] == ':') {
Index: watchman-4.9.0/winbuild/posix_spawn.cpp
===================================================================
--- watchman-4.9.0.orig/winbuild/posix_spawn.cpp
+++ watchman-4.9.0/winbuild/posix_spawn.cpp
@@ -37,7 +37,7 @@ pid_t waitpid(pid_t pid, int* status, in
 }
 
 int posix_spawnattr_init(posix_spawnattr_t *attrp) {
-  memset(attrp, 0, sizeof(*attrp));
+  *attrp = posix_spawnattr_t();
   return 0;
 }
 
@@ -72,7 +72,7 @@ int posix_spawnattr_destroy(posix_spawna
 }
 
 int posix_spawn_file_actions_init(posix_spawn_file_actions_t *actions) {
-  memset(actions, 0, sizeof(*actions));
+  *actions = posix_spawn_file_actions_t();
   return 0;
 }
 
@@ -242,9 +242,9 @@ static int posix_spawn_common(
     const posix_spawn_file_actions_t *file_actions,
     const posix_spawnattr_t *attrp,
     char *const argv[], char *const envp[]) {
-  STARTUPINFOEX sinfo;
-  SECURITY_ATTRIBUTES sec;
-  PROCESS_INFORMATION pinfo;
+  STARTUPINFOEX sinfo = {};
+  SECURITY_ATTRIBUTES sec = {};
+  PROCESS_INFORMATION pinfo = {};
   char *cmdbuf;
   char *env_block;
   DWORD create_flags = CREATE_NO_WINDOW|EXTENDED_STARTUPINFO_PRESENT;
@@ -263,17 +263,13 @@ static int posix_spawn_common(
     return ENOMEM;
   }
 
-  memset(&sinfo, 0, sizeof(sinfo));
   sinfo.StartupInfo.cb = sizeof(sinfo);
   sinfo.StartupInfo.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
   sinfo.StartupInfo.wShowWindow = SW_HIDE;
 
-  memset(&sec, 0, sizeof(sec));
   sec.nLength = sizeof(sec);
   sec.bInheritHandle = TRUE;
 
-  memset(&pinfo, 0, sizeof(pinfo));
-
   if (attrp->flags & POSIX_SPAWN_SETPGROUP) {
     create_flags |= CREATE_NEW_PROCESS_GROUP;
   }
++++++ 0002-Re-worked-replacement-of-memset-with-proper-init-to-.patch ++++++
>From a202311e948868ea2c81377a4a6889d8c97e8105 Mon Sep 17 00:00:00 2001
From: Sergey Zhupanov <[email protected]>
Date: Fri, 26 Jan 2018 19:25:32 -0800
Subject: [PATCH] Re-worked replacement of memset with proper init to make it
 gcc 4.8 compliant.

Summary: Closes https://github.com/facebook/watchman/pull/565

Reviewed By: wez

Differential Revision: D6827004

Pulled By: zhupanov

fbshipit-source-id: 9515eebd7aa48528a10245030e46b6cb37a6d7c2
---
 FileDescriptor.cpp       | 5 +++--
 Pipe.cpp                 | 2 +-
 listener.cpp             | 5 +++--
 log.cpp                  | 3 ++-
 main.cpp                 | 5 +++--
 stream_unix.cpp          | 3 ++-
 stream_win.cpp           | 2 +-
 watcher/fsevents.cpp     | 4 ++--
 watcher/kqueue.cpp       | 9 ++++++---
 watcher/win32.cpp        | 2 +-
 winbuild/posix_spawn.cpp | 6 +++---
 11 files changed, 27 insertions(+), 19 deletions(-)

Index: watchman-4.9.0/FileDescriptor.cpp
===================================================================
--- watchman-4.9.0.orig/FileDescriptor.cpp
+++ watchman-4.9.0/FileDescriptor.cpp
@@ -151,7 +151,7 @@ bool FileDescriptor::isNonBlock() const
  * If the case does not match, throws an exception. */
 static void checkCanonicalBaseName(const char *path) {
 #ifdef __APPLE__
-  struct attrlist attrlist = {};
+  struct attrlist attrlist;
   struct {
     uint32_t len;
     attrreference_t ref;
@@ -160,6 +160,7 @@ static void checkCanonicalBaseName(const
   w_string_piece pathPiece(path);
   auto base = pathPiece.baseName();
 
+  memset(&attrlist, 0, sizeof(attrlist));
   attrlist.bitmapcount = ATTR_BIT_MAP_COUNT;
   attrlist.commonattr = ATTR_CMN_NAME;
 
@@ -236,7 +237,7 @@ FileDescriptor openFileHandle(const char
 #else // _WIN32
   DWORD access = 0, share = 0, create = 0, attrs = 0;
   DWORD err;
-  SECURITY_ATTRIBUTES sec = {};
+  auto sec = SECURITY_ATTRIBUTES();
 
   if (!strcmp(path, "/dev/null")) {
     path = "NUL:";
Index: watchman-4.9.0/Pipe.cpp
===================================================================
--- watchman-4.9.0.orig/Pipe.cpp
+++ watchman-4.9.0/Pipe.cpp
@@ -11,7 +11,7 @@ Pipe::Pipe() {
 #ifdef _WIN32
   HANDLE readPipe;
   HANDLE writePipe;
-  SECURITY_ATTRIBUTES sec = {};
+  auto sec = SECURITY_ATTRIBUTES();
 
   sec.nLength = sizeof(sec);
   sec.bInheritHandle = FALSE; // O_CLOEXEC equivalent
Index: watchman-4.9.0/listener.cpp
===================================================================
--- watchman-4.9.0.orig/listener.cpp
+++ watchman-4.9.0/listener.cpp
@@ -442,7 +442,7 @@ static std::shared_ptr<watchman_client>
 #ifdef _WIN32
 static void named_pipe_accept_loop(const char *path) {
   HANDLE handles[2];
-  OVERLAPPED olap = {};
+  auto olap = OVERLAPPED();
   HANDLE connected_event = CreateEvent(NULL, FALSE, TRUE, NULL);
 
   if (!connected_event) {
@@ -573,7 +573,7 @@ static void accept_loop(FileDescriptor&&
 bool w_start_listener(const char *path)
 {
 #ifndef _WIN32
-  struct sigaction sa = {};
+  struct sigaction sa;
   sigset_t sigset;
 #endif
 
@@ -648,6 +648,7 @@ bool w_start_listener(const char *path)
 
   /* allow SIGUSR1 and SIGCHLD to wake up a blocked thread, without restarting
    * syscalls */
+  memset(&sa, 0, sizeof(sa));
   sa.sa_handler = wakeme;
   sa.sa_flags = 0;
   sigaction(SIGUSR1, &sa, NULL);
Index: watchman-4.9.0/log.cpp
===================================================================
--- watchman-4.9.0.orig/log.cpp
+++ watchman-4.9.0/log.cpp
@@ -298,8 +298,9 @@ static LONG WINAPI exception_filter(LPEX
 
 void w_setup_signal_handlers(void) {
 #ifndef _WIN32
-  struct sigaction sa = {};
+  struct sigaction sa;
 
+  memset(&sa, 0, sizeof(sa));
   sa.sa_sigaction = crash_handler;
   sa.sa_flags = SA_SIGINFO|SA_RESETHAND;
 
Index: watchman-4.9.0/main.cpp
===================================================================
--- watchman-4.9.0.orig/main.cpp
+++ watchman-4.9.0/main.cpp
@@ -49,7 +49,7 @@ static void compute_file_name(char **str
 
 static bool lock_pidfile(void) {
 #if !defined(USE_GIMLI) && !defined(_WIN32)
-  struct flock lock = {};
+  struct flock lock;
   pid_t mypid;
 
   // We defer computing this path until we're in the server context because
@@ -58,6 +58,7 @@ static bool lock_pidfile(void) {
   compute_file_name(&pid_file, compute_user_name(), "pid", "pidfile");
 
   mypid = getpid();
+  memset(&lock, 0, sizeof(lock));
   lock.l_type = F_WRLCK;
   lock.l_start = 0;
   lock.l_whence = SEEK_SET;
@@ -886,7 +887,7 @@ static json_ref build_command(int argc,
 
   // Read blob from stdin
   if (json_input_arg) {
-    json_error_t err = {};
+    auto err = json_error_t();
     w_jbuffer_t buf;
 
     auto cmd = buf.decodeNext(w_stm_stdin(), &err);
Index: watchman-4.9.0/stream_unix.cpp
===================================================================
--- watchman-4.9.0.orig/stream_unix.cpp
+++ watchman-4.9.0/stream_unix.cpp
@@ -222,7 +222,7 @@ std::unique_ptr<watchman_stream> w_stm_f
 std::unique_ptr<watchman_stream> w_stm_connect_unix(
     const char* path,
     int timeoutms) {
-  struct sockaddr_un un = {};
+  struct sockaddr_un un;
   int max_attempts = timeoutms / 10;
   int attempts = 0;
   int bufsize = WATCHMAN_IO_BUF_SIZE;
@@ -238,6 +238,7 @@ std::unique_ptr<watchman_stream> w_stm_c
     return nullptr;
   }
 
+  memset(&un, 0, sizeof(un));
   un.sun_family = PF_LOCAL;
   memcpy(un.sun_path, path, strlen(path));
 
Index: watchman-4.9.0/stream_win.cpp
===================================================================
--- watchman-4.9.0.orig/stream_win.cpp
+++ watchman-4.9.0/stream_win.cpp
@@ -715,7 +715,7 @@ int w_poll_events(struct watchman_event_
 FileDescriptor w_handle_open(const char* path, int flags) {
   DWORD access = 0, share = 0, create = 0, attrs = 0;
   DWORD err;
-  SECURITY_ATTRIBUTES sec = {};
+  auto sec = SECURITY_ATTRIBUTES();
 
   if (!strcmp(path, "/dev/null")) {
     path = "NUL:";
Index: watchman-4.9.0/watcher/fsevents.cpp
===================================================================
--- watchman-4.9.0.orig/watcher/fsevents.cpp
+++ watchman-4.9.0/watcher/fsevents.cpp
@@ -275,7 +275,7 @@ static fse_stream* fse_stream_make(
     const std::shared_ptr<w_root_t>& root,
     FSEventStreamEventId since,
     w_string& failure_reason) {
-  FSEventStreamContext ctx = {};
+  auto ctx = FSEventStreamContext();
   CFMutableArrayRef parray = nullptr;
   CFStringRef cpath = nullptr;
   double latency;
@@ -439,7 +439,7 @@ fail:
 
 void FSEventsWatcher::FSEventsThread(const std::shared_ptr<w_root_t>& root) {
   CFFileDescriptorRef fdref;
-  CFFileDescriptorContext fdctx = {};
+  auto fdctx = CFFileDescriptorContext();
 
   w_set_thread_name("fsevents %s", root->root_path.c_str());
 
Index: watchman-4.9.0/watcher/kqueue.cpp
===================================================================
--- watchman-4.9.0.orig/watcher/kqueue.cpp
+++ watchman-4.9.0/watcher/kqueue.cpp
@@ -70,7 +70,7 @@ KQueueWatcher::KQueueWatcher(w_root_t* r
 }
 
 bool KQueueWatcher::startWatchFile(struct watchman_file* file) {
-  struct kevent k = {};
+  struct kevent k;
 
   auto full_name = w_dir_path_cat_str(file->parent, file->getName());
   {
@@ -98,6 +98,7 @@ bool KQueueWatcher::startWatchFile(struc
     return false;
   }
 
+  memset(&k, 0, sizeof(k));
   EV_SET(
       &k,
       rawFd,
@@ -139,7 +140,7 @@ std::unique_ptr<watchman_dir_handle> KQu
     struct timeval,
     const char* path) {
   struct stat st, osdirst;
-  struct kevent k = {};
+  struct kevent k;
 
   auto osdir = w_dir_open(path);
 
@@ -168,6 +169,7 @@ std::unique_ptr<watchman_dir_handle> KQu
         std::string("directory replaced between opendir and open: ") + path);
   }
 
+  memset(&k, 0, sizeof(k));
   auto dir_name = dir->getFullPath();
   EV_SET(
       &k,
@@ -254,7 +256,7 @@ bool KQueueWatcher::consumeNotify(
         fflags,
         flags_label);
     if ((fflags & (NOTE_DELETE|NOTE_RENAME|NOTE_REVOKE))) {
-      struct kevent k = {};
+      struct kevent k;
 
       if (w_string_equal(path, root->root_path)) {
         w_log(
@@ -267,6 +269,7 @@ bool KQueueWatcher::consumeNotify(
       }
 
       // Remove our watch bits
+      memset(&k, 0, sizeof(k));
       EV_SET(&k, fd, EVFILT_VNODE, EV_DELETE, 0, 0, nullptr);
       kevent(kq_fd.fd(), &k, 1, nullptr, 0, 0);
       wlock->name_to_fd.erase(path);
Index: watchman-4.9.0/watcher/win32.cpp
===================================================================
--- watchman-4.9.0.orig/watcher/win32.cpp
+++ watchman-4.9.0/watcher/win32.cpp
@@ -109,7 +109,7 @@ void WinWatcher::readChangesThread(const
   DWORD size = WATCHMAN_BATCH_LIMIT * (sizeof(FILE_NOTIFY_INFORMATION) + 512);
   std::vector<uint8_t> buf;
   DWORD err, filter;
-  OVERLAPPED olap = {};
+  auto olap = OVERLAPPED();
   BOOL initiate_read = true;
   HANDLE handles[2] = {olapEvent, ping};
   DWORD bytes;
Index: watchman-4.9.0/winbuild/posix_spawn.cpp
===================================================================
--- watchman-4.9.0.orig/winbuild/posix_spawn.cpp
+++ watchman-4.9.0/winbuild/posix_spawn.cpp
@@ -242,9 +242,9 @@ static int posix_spawn_common(
     const posix_spawn_file_actions_t *file_actions,
     const posix_spawnattr_t *attrp,
     char *const argv[], char *const envp[]) {
-  STARTUPINFOEX sinfo = {};
-  SECURITY_ATTRIBUTES sec = {};
-  PROCESS_INFORMATION pinfo = {};
+  auto sinfo = STARTUPINFOEX();
+  auto sec = SECURITY_ATTRIBUTES();
+  auto pinfo = PROCESS_INFORMATION();
   char *cmdbuf;
   char *env_block;
   DWORD create_flags = CREATE_NO_WINDOW|EXTENDED_STARTUPINFO_PRESENT;
++++++ v4.7.0.tar.gz -> v4.9.0.tar.gz ++++++
++++ 88090 lines of diff (skipped)

++++++ watchman_4.7.0_makefile-am.diff ++++++
--- /var/tmp/diff_new_pack.Ew0TmU/_old  2018-06-29 22:29:42.726332935 +0200
+++ /var/tmp/diff_new_pack.Ew0TmU/_new  2018-06-29 22:29:42.726332935 +0200
@@ -2,7 +2,7 @@
 ===================================================================
 --- Makefile.am.orig
 +++ Makefile.am
-@@ -3,7 +3,6 @@ bin_PROGRAMS = watchman
+@@ -5,7 +5,6 @@ bin_PROGRAMS = watchman
  DESTDIR ?= /
  
  doc_DATA = README.markdown


Reply via email to