summary refs log tree commit diff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-11-19 15:01:00 +0100
committerMarius Bakke <mbakke@fastmail.com>2017-11-19 15:01:00 +0100
commit2dd12924cf4a30a96262b6d392fcde58c9f10d4b (patch)
tree3f74f5426ff214a02b8f6652f6516979657a7f98 /gnu/packages/patches
parent259b4f34ba2eaefeafdb7c9f9eb56ee77f16010c (diff)
parenta93447b89a5b132221072e729d13a3f17391b8c2 (diff)
downloadguix-2dd12924cf4a30a96262b6d392fcde58c9f10d4b.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/audacity-build-with-system-portaudio.patch64
-rw-r--r--gnu/packages/patches/gcc-4-compile-with-gcc-5.patch65
-rw-r--r--gnu/packages/patches/icecat-bug-1348660-pt5.patch727
-rw-r--r--gnu/packages/patches/icecat-bug-1415133.patch40
-rw-r--r--gnu/packages/patches/ktexteditor-5.39.0-autotests-dependencies.patch49
-rw-r--r--gnu/packages/patches/libetonyek-build-with-mdds-1.2.patch74
-rw-r--r--gnu/packages/patches/libvisio-fix-tests.patch35
-rw-r--r--gnu/packages/patches/mupdf-CVE-2017-15587.patch10
-rw-r--r--gnu/packages/patches/netsurf-system-utf8proc.patch51
-rw-r--r--gnu/packages/patches/owncloud-disable-updatecheck.patch49
-rw-r--r--gnu/packages/patches/psm-arch.patch13
-rw-r--r--gnu/packages/patches/psm-ldflags.patch13
-rw-r--r--gnu/packages/patches/psm-repro.patch14
-rw-r--r--gnu/packages/patches/python-networkx2-reproducible-build.patch29
-rw-r--r--gnu/packages/patches/qemu-CVE-2017-15038.patch51
-rw-r--r--gnu/packages/patches/qemu-CVE-2017-15268.patch62
-rw-r--r--gnu/packages/patches/qemu-CVE-2017-15289.patch66
17 files changed, 1267 insertions, 145 deletions
diff --git a/gnu/packages/patches/audacity-build-with-system-portaudio.patch b/gnu/packages/patches/audacity-build-with-system-portaudio.patch
new file mode 100644
index 0000000000..3b73a6c930
--- /dev/null
+++ b/gnu/packages/patches/audacity-build-with-system-portaudio.patch
@@ -0,0 +1,64 @@
+Downloaded from here:
+https://sourceforge.net/p/audacity/mailman/message/36106562/
+
+>From 5f9482a191359f2c477763a36d2c865c5f186602 Mon Sep 17 00:00:00 2001
+From: Antonio Ospite <ao2@ao2.it>
+Date: Tue, 7 Nov 2017 13:06:33 +0100
+Subject: [PATCH] Fix building against the system portaudio library
+
+Building against the system portaudio results in this error:
+
+./src/AudioIO.cpp:983: undefined reference to `PaUtil_GetTime'
+audacity-AudioIO.o: In function `audacityAudioCallback(void const*, void*,
+unsigned long, PaStreamCallbackTimeInfo const*, unsigned long, void*)':
+./src/AudioIO.cpp:4630: undefined reference to `PaUtil_GetTime'
+collect2: error: ld returned 1 exit status
+Makefile:2349: recipe for target 'audacity' failed
+make[3]: *** [audacity] Error 1
+
+This is because PaUtil_GetTime is declared as a C symbol in pa_util.h
+but is resolved as a C++ symbol at link time.
+
+Audacity fixes this in the local tree with this change:
+https://github.com/audacity/audacity/commit/38fd97b8e26060332ab3e9e000a8882326a70ba7
+
+However this is not general enough for the portaudio debian package.
+
+Since PaUtil_GetTime() is the only function causing problems, just copy
+over the code where it's used.
+---
+ src/AudioIO.cpp | 17 ++++++++++++++++-
+ 1 file changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp
+index a78bd1cab..d5481838d 100644
+--- a/src/AudioIO.cpp
++++ b/src/AudioIO.cpp
+@@ -452,8 +452,23 @@ writing audio.
+    #define ROUND(x) (int) ((x)+0.5)
+    //#include <string.h>
+    #include "../lib-src/portmidi/pm_common/portmidi.h"
+-   #include "../lib-src/portaudio-v19/src/common/pa_util.h"
+    #include "NoteTrack.h"
++
++PaTime PaUtil_GetTime( void )
++{
++#ifdef HAVE_MACH_ABSOLUTE_TIME
++    return mach_absolute_time() * machSecondsConversionScaler_;
++#elif defined(HAVE_CLOCK_GETTIME)
++    struct timespec tp;
++    clock_gettime(CLOCK_REALTIME, &tp);
++    return (PaTime)(tp.tv_sec + tp.tv_nsec * 1e-9);
++#else
++    struct timeval tv;
++    gettimeofday( &tv, NULL );
++    return (PaTime) tv.tv_usec * 1e-6 + tv.tv_sec;
++#endif
++}
++
+ #endif
+ 
+ #ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
+-- 
+2.15.0
+
diff --git a/gnu/packages/patches/gcc-4-compile-with-gcc-5.patch b/gnu/packages/patches/gcc-4-compile-with-gcc-5.patch
new file mode 100644
index 0000000000..861cd4857a
--- /dev/null
+++ b/gnu/packages/patches/gcc-4-compile-with-gcc-5.patch
@@ -0,0 +1,65 @@
+Taken from  https://gcc.gnu.org/cgi-bin/get-raw-msg?listname=gcc-patches&date=2016-01&msgid=1451802493-17406-1-git-send-email-vapier%40gentoo.org
+
+Since the 3.0.3 release of gperf (made in May 2007), the generated func
+has had the gnu_inline attribute applied to it.  The gcc source however
+has not been updated to include that which has lead to a mismatch.
+
+In practice, this hasn't been an issue for two reasons:
+(1) Before gcc-5, the default standard was (gnu) C89, and gcc does not
+warn or throw an error in this mode.
+(2) Starting with gcc-4.8, the compiler driver used to build gcc was
+changed to C++, and g++ does not warn or throw an error in this mode.
+
+This error does show up though when using gcc-5 to build gcc-4.7 or
+older as then the default is (gnu) C11 and the C compiler driver is
+used.  That failure looks like:
+In file included from .../gcc-4.7.4/gcc/cp/except.c:990:0:
+cfns.gperf: At top level:
+cfns.gperf:101:1: error: 'gnu_inline' attribute present on 'libc_name_p'
+cfns.gperf:26:14: error: but not here
+
+Whether the compiler should always emit this error regardless of the
+active standard or compiler driver is debatable (I think it should be
+consistent -- either always do it or never do it).
+
+2015-08-06  Mike Frysinger  <vapier@gentoo.org>
+
+	* cfns.gperf [__GNUC__, __GNUC_STDC_INLINE__]: Apply the
+	__gnu_inline__ attribute.
+	* cfns.h: Regenerated.
+---
+ gcc/cp/cfns.gperf | 3 +++
+ gcc/cp/cfns.h     | 3 +++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf
+index 68acd3d..953262f 100644
+--- a/gcc/cp/cfns.gperf
++++ b/gcc/cp/cfns.gperf
+@@ -22,6 +22,9 @@ __inline
+ static unsigned int hash (const char *, unsigned int);
+ #ifdef __GNUC__
+ __inline
++#ifdef __GNUC_STDC_INLINE__
++__attribute__ ((__gnu_inline__))
++#endif
+ #endif
+ const char * libc_name_p (const char *, unsigned int);
+ %}
+diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h
+index 1c6665d..6d00c0e 100644
+--- a/gcc/cp/cfns.h
++++ b/gcc/cp/cfns.h
+@@ -53,6 +53,9 @@ __inline
+ static unsigned int hash (const char *, unsigned int);
+ #ifdef __GNUC__
+ __inline
++#ifdef __GNUC_STDC_INLINE__
++__attribute__ ((__gnu_inline__))
++#endif
+ #endif
+ const char * libc_name_p (const char *, unsigned int);
+ /* maximum key range = 391, duplicates = 0 */
+-- 
+2.6.2
+
diff --git a/gnu/packages/patches/icecat-bug-1348660-pt5.patch b/gnu/packages/patches/icecat-bug-1348660-pt5.patch
new file mode 100644
index 0000000000..b0bede3b38
--- /dev/null
+++ b/gnu/packages/patches/icecat-bug-1348660-pt5.patch
@@ -0,0 +1,727 @@
+This is a subset of the following changeset from upstream:
+  https://hg.mozilla.org/releases/mozilla-esr52/raw-rev/5e07bd37ac61
+
+This excludes all test code from that changeset, including a GIT binary patch
+that is not supported by Guix's patch-and-repack mechanism.
+
+# HG changeset patch
+# User Jan Varga <jan.varga@gmail.com>
+# Date 1490181244 -3600
+# Node ID 5e07bd37ac6162f218dfe03ed83b5dcca9653b68
+# Parent  28934912eede9e14895baf4af7575ca9639f59ee
+Bug 1348660 - Part 5: Implement a method to retrieve usage data for all origins at once. r=btseng, a=lizzard
+
+diff --git a/dom/quota/ActorsChild.cpp b/dom/quota/ActorsChild.cpp
+--- a/dom/quota/ActorsChild.cpp
++++ b/dom/quota/ActorsChild.cpp
+@@ -137,16 +137,52 @@ QuotaUsageRequestChild::HandleResponse(n
+   AssertIsOnOwningThread();
+   MOZ_ASSERT(NS_FAILED(aResponse));
+   MOZ_ASSERT(mRequest);
+ 
+   mRequest->SetError(aResponse);
+ }
+ 
+ void
++QuotaUsageRequestChild::HandleResponse(const nsTArray<OriginUsage>& aResponse)
++{
++  AssertIsOnOwningThread();
++  MOZ_ASSERT(mRequest);
++
++  RefPtr<nsVariant> variant = new nsVariant();
++
++  if (aResponse.IsEmpty()) {
++    variant->SetAsEmptyArray();
++  } else {
++    nsTArray<RefPtr<UsageResult>> usageResults;
++
++    const uint32_t count = aResponse.Length();
++
++    usageResults.SetCapacity(count);
++
++    for (uint32_t index = 0; index < count; index++) {
++      auto& originUsage = aResponse[index];
++
++      RefPtr<UsageResult> usageResult = new UsageResult(originUsage.origin(),
++                                                        originUsage.persisted(),
++                                                        originUsage.usage());
++
++      usageResults.AppendElement(usageResult.forget());
++    }
++
++    variant->SetAsArray(nsIDataType::VTYPE_INTERFACE_IS,
++                        &NS_GET_IID(nsIQuotaUsageResult),
++                        usageResults.Length(),
++                        static_cast<void*>(usageResults.Elements()));
++  }
++
++  mRequest->SetResult(variant);
++}
++
++void
+ QuotaUsageRequestChild::HandleResponse(const OriginUsageResponse& aResponse)
+ {
+   AssertIsOnOwningThread();
+   MOZ_ASSERT(mRequest);
+ 
+   RefPtr<OriginUsageResult> result =
+     new OriginUsageResult(aResponse.usage(),
+                           aResponse.fileUsage(),
+@@ -177,16 +213,20 @@ QuotaUsageRequestChild::Recv__delete__(c
+   AssertIsOnOwningThread();
+   MOZ_ASSERT(mRequest);
+ 
+   switch (aResponse.type()) {
+     case UsageRequestResponse::Tnsresult:
+       HandleResponse(aResponse.get_nsresult());
+       break;
+ 
++    case UsageRequestResponse::TAllUsageResponse:
++      HandleResponse(aResponse.get_AllUsageResponse().originUsages());
++      break;
++
+     case UsageRequestResponse::TOriginUsageResponse:
+       HandleResponse(aResponse.get_OriginUsageResponse());
+       break;
+ 
+     default:
+       MOZ_CRASH("Unknown response type!");
+   }
+ 
+diff --git a/dom/quota/ActorsChild.h b/dom/quota/ActorsChild.h
+--- a/dom/quota/ActorsChild.h
++++ b/dom/quota/ActorsChild.h
+@@ -93,16 +93,19 @@ private:
+ 
+   // Only destroyed by QuotaChild.
+   ~QuotaUsageRequestChild();
+ 
+   void
+   HandleResponse(nsresult aResponse);
+ 
+   void
++  HandleResponse(const nsTArray<OriginUsage>& aResponse);
++
++  void
+   HandleResponse(const OriginUsageResponse& aResponse);
+ 
+   // IPDL methods are only called by IPDL.
+   virtual void
+   ActorDestroy(ActorDestroyReason aWhy) override;
+ 
+   virtual bool
+   Recv__delete__(const UsageRequestResponse& aResponse) override;
+diff --git a/dom/quota/ActorsParent.cpp b/dom/quota/ActorsParent.cpp
+--- a/dom/quota/ActorsParent.cpp
++++ b/dom/quota/ActorsParent.cpp
+@@ -1039,16 +1039,42 @@ private:
+   // IPDL methods.
+   void
+   ActorDestroy(ActorDestroyReason aWhy) override;
+ 
+   bool
+   RecvCancel() override;
+ };
+ 
++class GetUsageOp final
++  : public QuotaUsageRequestBase
++{
++  nsTArray<OriginUsage> mOriginUsages;
++  nsDataHashtable<nsCStringHashKey, uint32_t> mOriginUsagesIndex;
++
++  bool mGetAll;
++
++public:
++  explicit GetUsageOp(const UsageRequestParams& aParams);
++
++private:
++  ~GetUsageOp()
++  { }
++
++  nsresult
++  TraverseRepository(QuotaManager* aQuotaManager,
++                     PersistenceType aPersistenceType);
++
++  nsresult
++  DoDirectoryWork(QuotaManager* aQuotaManager) override;
++
++  void
++  GetResponse(UsageRequestResponse& aResponse) override;
++};
++
+ class GetOriginUsageOp final
+   : public QuotaUsageRequestBase
+ {
+   // If mGetGroupUsage is false, we use mUsageInfo to record the origin usage
+   // and the file usage. Otherwise, we use it to record the group usage and the
+   // limit.
+   UsageInfo mUsageInfo;
+ 
+@@ -5693,16 +5719,20 @@ PQuotaUsageRequestParent*
+ Quota::AllocPQuotaUsageRequestParent(const UsageRequestParams& aParams)
+ {
+   AssertIsOnBackgroundThread();
+   MOZ_ASSERT(aParams.type() != UsageRequestParams::T__None);
+ 
+   RefPtr<QuotaUsageRequestBase> actor;
+ 
+   switch (aParams.type()) {
++    case UsageRequestParams::TAllUsageParams:
++      actor = new GetUsageOp(aParams);
++      break;
++
+     case UsageRequestParams::TOriginUsageParams:
+       actor = new GetOriginUsageOp(aParams);
+       break;
+ 
+     default:
+       MOZ_CRASH("Should never get here!");
+   }
+ 
+@@ -6033,16 +6063,189 @@ QuotaUsageRequestBase::RecvCancel()
+   if (mCanceled.exchange(true)) {
+     NS_WARNING("Canceled more than once?!");
+     return false;
+   }
+ 
+   return true;
+ }
+ 
++GetUsageOp::GetUsageOp(const UsageRequestParams& aParams)
++  : mGetAll(aParams.get_AllUsageParams().getAll())
++{
++  AssertIsOnOwningThread();
++  MOZ_ASSERT(aParams.type() == UsageRequestParams::TAllUsageParams);
++}
++
++nsresult
++GetUsageOp::TraverseRepository(QuotaManager* aQuotaManager,
++                               PersistenceType aPersistenceType)
++{
++  AssertIsOnIOThread();
++  MOZ_ASSERT(aQuotaManager);
++
++  nsresult rv;
++
++  nsCOMPtr<nsIFile> directory =
++    do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
++  if (NS_WARN_IF(NS_FAILED(rv))) {
++    return rv;
++  }
++
++  rv = directory->InitWithPath(aQuotaManager->GetStoragePath(aPersistenceType));
++  if (NS_WARN_IF(NS_FAILED(rv))) {
++    return rv;
++  }
++
++  bool exists;
++  rv = directory->Exists(&exists);
++  if (NS_WARN_IF(NS_FAILED(rv))) {
++    return rv;
++  }
++
++  if (!exists) {
++    return NS_OK;
++  }
++
++  nsCOMPtr<nsISimpleEnumerator> entries;
++  rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
++  if (NS_WARN_IF(NS_FAILED(rv))) {
++    return rv;
++  }
++
++  bool persistent = aPersistenceType == PERSISTENCE_TYPE_PERSISTENT;
++
++  bool hasMore;
++  while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) &&
++         hasMore && !mCanceled) {
++    nsCOMPtr<nsISupports> entry;
++    rv = entries->GetNext(getter_AddRefs(entry));
++    if (NS_WARN_IF(NS_FAILED(rv))) {
++      return rv;
++    }
++
++    nsCOMPtr<nsIFile> originDir = do_QueryInterface(entry);
++    MOZ_ASSERT(originDir);
++
++    bool isDirectory;
++    rv = originDir->IsDirectory(&isDirectory);
++    if (NS_WARN_IF(NS_FAILED(rv))) {
++      return rv;
++    }
++
++    if (!isDirectory) {
++      nsString leafName;
++      rv = originDir->GetLeafName(leafName);
++      if (NS_WARN_IF(NS_FAILED(rv))) {
++        return rv;
++      }
++
++      if (!leafName.EqualsLiteral(DSSTORE_FILE_NAME)) {
++        QM_WARNING("Something (%s) in the repository that doesn't belong!",
++                   NS_ConvertUTF16toUTF8(leafName).get());
++      }
++      continue;
++    }
++
++    int64_t timestamp;
++    nsCString suffix;
++    nsCString group;
++    nsCString origin;
++    bool isApp;
++    rv = aQuotaManager->GetDirectoryMetadata2WithRestore(originDir,
++                                                         persistent,
++                                                         &timestamp,
++                                                         suffix,
++                                                         group,
++                                                         origin,
++                                                         &isApp);
++    if (NS_WARN_IF(NS_FAILED(rv))) {
++      return rv;
++    }
++
++    if (!mGetAll &&
++        aQuotaManager->IsOriginWhitelistedForPersistentStorage(origin)) {
++      continue;
++    }
++
++    OriginUsage* originUsage;
++
++    // We can't store pointers to OriginUsage objects in the hashtable
++    // since AppendElement() reallocates its internal array buffer as number
++    // of elements grows.
++    uint32_t index;
++    if (mOriginUsagesIndex.Get(origin, &index)) {
++      originUsage = &mOriginUsages[index];
++    } else {
++      index = mOriginUsages.Length();
++
++      originUsage = mOriginUsages.AppendElement();
++
++      originUsage->origin() = origin;
++      originUsage->persisted() = false;
++      originUsage->usage() = 0;
++
++      mOriginUsagesIndex.Put(origin, index);
++    }
++
++    UsageInfo usageInfo;
++    rv = GetUsageForOrigin(aQuotaManager,
++                           aPersistenceType,
++                           group,
++                           origin,
++                           isApp,
++                           &usageInfo);
++    if (NS_WARN_IF(NS_FAILED(rv))) {
++      return rv;
++    }
++
++    originUsage->usage() = originUsage->usage() + usageInfo.TotalUsage();
++  }
++  if (NS_WARN_IF(NS_FAILED(rv))) {
++    return rv;
++  }
++
++  return NS_OK;
++}
++
++nsresult
++GetUsageOp::DoDirectoryWork(QuotaManager* aQuotaManager)
++{
++  AssertIsOnIOThread();
++
++  PROFILER_LABEL("Quota", "GetUsageOp::DoDirectoryWork",
++                 js::ProfileEntry::Category::OTHER);
++
++  nsresult rv;
++
++  for (const PersistenceType type : kAllPersistenceTypes) {
++    rv = TraverseRepository(aQuotaManager, type);
++    if (NS_WARN_IF(NS_FAILED(rv))) {
++      return rv;
++    }
++  }
++
++  return NS_OK;
++}
++
++void
++GetUsageOp::GetResponse(UsageRequestResponse& aResponse)
++{
++  AssertIsOnOwningThread();
++
++  aResponse = AllUsageResponse();
++
++  if (!mOriginUsages.IsEmpty()) {
++    nsTArray<OriginUsage>& originUsages =
++      aResponse.get_AllUsageResponse().originUsages();
++
++    mOriginUsages.SwapElements(originUsages);
++  }
++}
++
+ GetOriginUsageOp::GetOriginUsageOp(const UsageRequestParams& aParams)
+   : mParams(aParams.get_OriginUsageParams())
+   , mGetGroupUsage(aParams.get_OriginUsageParams().getGroupUsage())
+ {
+   AssertIsOnOwningThread();
+   MOZ_ASSERT(aParams.type() == UsageRequestParams::TOriginUsageParams);
+ }
+ 
+diff --git a/dom/quota/PQuota.ipdl b/dom/quota/PQuota.ipdl
+--- a/dom/quota/PQuota.ipdl
++++ b/dom/quota/PQuota.ipdl
+@@ -12,24 +12,30 @@ include "mozilla/dom/quota/Serialization
+ 
+ using mozilla::dom::quota::PersistenceType
+   from "mozilla/dom/quota/PersistenceType.h";
+ 
+ namespace mozilla {
+ namespace dom {
+ namespace quota {
+ 
++struct AllUsageParams
++{
++  bool getAll;
++};
++
+ struct OriginUsageParams
+ {
+   PrincipalInfo principalInfo;
+   bool getGroupUsage;
+ };
+ 
+ union UsageRequestParams
+ {
++  AllUsageParams;
+   OriginUsageParams;
+ };
+ 
+ struct ClearOriginParams
+ {
+   PrincipalInfo principalInfo;
+   PersistenceType persistenceType;
+   bool persistenceTypeIsExplicit;
+diff --git a/dom/quota/PQuotaUsageRequest.ipdl b/dom/quota/PQuotaUsageRequest.ipdl
+--- a/dom/quota/PQuotaUsageRequest.ipdl
++++ b/dom/quota/PQuotaUsageRequest.ipdl
+@@ -3,26 +3,39 @@
+  * You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ include protocol PQuota;
+ 
+ namespace mozilla {
+ namespace dom {
+ namespace quota {
+ 
++struct OriginUsage
++{
++  nsCString origin;
++  bool persisted;
++  uint64_t usage;
++};
++
++struct AllUsageResponse
++{
++  OriginUsage[] originUsages;
++};
++
+ struct OriginUsageResponse
+ {
+   uint64_t usage;
+   uint64_t fileUsage;
+   uint64_t limit;
+ };
+ 
+ union UsageRequestResponse
+ {
+   nsresult;
++  AllUsageResponse;
+   OriginUsageResponse;
+ };
+ 
+ protocol PQuotaUsageRequest
+ {
+   manager PQuota;
+ 
+ parent:
+diff --git a/dom/quota/QuotaManagerService.cpp b/dom/quota/QuotaManagerService.cpp
+--- a/dom/quota/QuotaManagerService.cpp
++++ b/dom/quota/QuotaManagerService.cpp
+@@ -490,16 +490,41 @@ QuotaManagerService::RemoveIdleObserver(
+ 
+ NS_IMPL_ADDREF(QuotaManagerService)
+ NS_IMPL_RELEASE_WITH_DESTROY(QuotaManagerService, Destroy())
+ NS_IMPL_QUERY_INTERFACE(QuotaManagerService,
+                         nsIQuotaManagerService,
+                         nsIObserver)
+ 
+ NS_IMETHODIMP
++QuotaManagerService::GetUsage(nsIQuotaUsageCallback* aCallback,
++                              bool aGetAll,
++                              nsIQuotaUsageRequest** _retval)
++{
++  MOZ_ASSERT(NS_IsMainThread());
++  MOZ_ASSERT(aCallback);
++
++  RefPtr<UsageRequest> request = new UsageRequest(aCallback);
++
++  AllUsageParams params;
++
++  params.getAll() = aGetAll;
++
++  nsAutoPtr<PendingRequestInfo> info(new UsageRequestInfo(request, params));
++
++  nsresult rv = InitiateRequest(info);
++  if (NS_WARN_IF(NS_FAILED(rv))) {
++    return rv;
++  }
++
++  request.forget(_retval);
++  return NS_OK;
++}
++
++NS_IMETHODIMP
+ QuotaManagerService::GetUsageForPrincipal(nsIPrincipal* aPrincipal,
+                                           nsIQuotaUsageCallback* aCallback,
+                                           bool aGetGroupUsage,
+                                           nsIQuotaUsageRequest** _retval)
+ {
+   MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aPrincipal);
+   MOZ_ASSERT(aCallback);
+diff --git a/dom/quota/QuotaRequests.cpp b/dom/quota/QuotaRequests.cpp
+--- a/dom/quota/QuotaRequests.cpp
++++ b/dom/quota/QuotaRequests.cpp
+@@ -86,16 +86,25 @@ RequestBase::GetResultCode(nsresult* aRe
+   if (!mHaveResultOrErrorCode) {
+     return NS_ERROR_FAILURE;
+   }
+ 
+   *aResultCode = mResultCode;
+   return NS_OK;
+ }
+ 
++UsageRequest::UsageRequest(nsIQuotaUsageCallback* aCallback)
++  : mCallback(aCallback)
++  , mBackgroundActor(nullptr)
++  , mCanceled(false)
++{
++  AssertIsOnOwningThread();
++  MOZ_ASSERT(aCallback);
++}
++
+ UsageRequest::UsageRequest(nsIPrincipal* aPrincipal,
+                            nsIQuotaUsageCallback* aCallback)
+   : RequestBase(aPrincipal)
+   , mCallback(aCallback)
+   , mBackgroundActor(nullptr)
+   , mCanceled(false)
+ {
+   AssertIsOnOwningThread();
+diff --git a/dom/quota/QuotaRequests.h b/dom/quota/QuotaRequests.h
+--- a/dom/quota/QuotaRequests.h
++++ b/dom/quota/QuotaRequests.h
+@@ -73,16 +73,18 @@ class UsageRequest final
+ 
+   nsCOMPtr<nsIVariant> mResult;
+ 
+   QuotaUsageRequestChild* mBackgroundActor;
+ 
+   bool mCanceled;
+ 
+ public:
++  explicit UsageRequest(nsIQuotaUsageCallback* aCallback);
++
+   UsageRequest(nsIPrincipal* aPrincipal,
+                nsIQuotaUsageCallback* aCallback);
+ 
+   void
+   SetBackgroundActor(QuotaUsageRequestChild* aBackgroundActor);
+ 
+   void
+   ClearBackgroundActor()
+diff --git a/dom/quota/QuotaResults.cpp b/dom/quota/QuotaResults.cpp
+--- a/dom/quota/QuotaResults.cpp
++++ b/dom/quota/QuotaResults.cpp
+@@ -5,16 +5,53 @@
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "QuotaResults.h"
+ 
+ namespace mozilla {
+ namespace dom {
+ namespace quota {
+ 
++UsageResult::UsageResult(const nsACString& aOrigin,
++                         bool aPersisted,
++                         uint64_t aUsage)
++  : mOrigin(aOrigin)
++  , mUsage(aUsage)
++  , mPersisted(aPersisted)
++{
++}
++
++NS_IMPL_ISUPPORTS(UsageResult,
++                  nsIQuotaUsageResult)
++
++NS_IMETHODIMP
++UsageResult::GetOrigin(nsACString& aOrigin)
++{
++  aOrigin = mOrigin;
++  return NS_OK;
++}
++
++NS_IMETHODIMP
++UsageResult::GetPersisted(bool* aPersisted)
++{
++  MOZ_ASSERT(aPersisted);
++
++  *aPersisted = mPersisted;
++  return NS_OK;
++}
++
++NS_IMETHODIMP
++UsageResult::GetUsage(uint64_t* aUsage)
++{
++  MOZ_ASSERT(aUsage);
++
++  *aUsage = mUsage;
++  return NS_OK;
++}
++
+ OriginUsageResult::OriginUsageResult(uint64_t aUsage,
+                                      uint64_t aFileUsage,
+                                      uint64_t aLimit)
+   : mUsage(aUsage)
+   , mFileUsage(aFileUsage)
+   , mLimit(aLimit)
+ {
+ }
+diff --git a/dom/quota/QuotaResults.h b/dom/quota/QuotaResults.h
+--- a/dom/quota/QuotaResults.h
++++ b/dom/quota/QuotaResults.h
+@@ -8,16 +8,36 @@
+ #define mozilla_dom_quota_QuotaResults_h
+ 
+ #include "nsIQuotaResults.h"
+ 
+ namespace mozilla {
+ namespace dom {
+ namespace quota {
+ 
++class UsageResult
++  : public nsIQuotaUsageResult
++{
++  nsCString mOrigin;
++  uint64_t mUsage;
++  bool mPersisted;
++
++public:
++  UsageResult(const nsACString& aOrigin,
++              bool aPersisted,
++              uint64_t aUsage);
++
++private:
++  virtual ~UsageResult()
++  { }
++
++  NS_DECL_ISUPPORTS
++  NS_DECL_NSIQUOTAUSAGERESULT
++};
++
+ class OriginUsageResult
+   : public nsIQuotaOriginUsageResult
+ {
+   uint64_t mUsage;
+   uint64_t mFileUsage;
+   uint64_t mLimit;
+ 
+ public:
+diff --git a/dom/quota/nsIQuotaManagerService.idl b/dom/quota/nsIQuotaManagerService.idl
+--- a/dom/quota/nsIQuotaManagerService.idl
++++ b/dom/quota/nsIQuotaManagerService.idl
+@@ -10,16 +10,31 @@ interface nsIPrincipal;
+ interface nsIQuotaRequest;
+ interface nsIQuotaUsageCallback;
+ interface nsIQuotaUsageRequest;
+ 
+ [scriptable, builtinclass, uuid(1b3d0a38-8151-4cf9-89fa-4f92c2ef0e7e)]
+ interface nsIQuotaManagerService : nsISupports
+ {
+   /**
++   * Schedules an asynchronous callback that will inspect all origins and
++   * return the total amount of disk space being used by storages for each
++   * origin separately.
++   *
++   * @param aCallback
++   *        The callback that will be called when the usage is available.
++   * @param aGetAll
++   *        An optional boolean to indicate inspection of all origins,
++   *        including internal ones.
++   */
++  [must_use] nsIQuotaUsageRequest
++  getUsage(in nsIQuotaUsageCallback aCallback,
++           [optional] in boolean aGetAll);
++
++  /**
+    * Schedules an asynchronous callback that will return the total amount of
+    * disk space being used by storages for the given origin.
+    *
+    * @param aPrincipal
+    *        A principal for the origin whose usage is being queried.
+    * @param aCallback
+    *        The callback that will be called when the usage is available.
+    * @param aGetGroupUsage
+diff --git a/dom/quota/nsIQuotaRequests.idl b/dom/quota/nsIQuotaRequests.idl
+--- a/dom/quota/nsIQuotaRequests.idl
++++ b/dom/quota/nsIQuotaRequests.idl
+@@ -18,16 +18,17 @@ interface nsIQuotaRequestBase : nsISuppo
+ 
+   [must_use] readonly attribute nsresult resultCode;
+ };
+ 
+ [scriptable, uuid(166e28e6-cf6d-4927-a6d7-b51bca9d3469)]
+ interface nsIQuotaUsageRequest : nsIQuotaRequestBase
+ {
+   // The result can contain one of these types:
++  //   array of nsIQuotaUsageResult
+   //   nsIQuotaOriginUsageResult
+   [must_use] readonly attribute nsIVariant result;
+ 
+   attribute nsIQuotaUsageCallback callback;
+ 
+   [must_use] void
+   cancel();
+ };
+diff --git a/dom/quota/nsIQuotaResults.idl b/dom/quota/nsIQuotaResults.idl
+--- a/dom/quota/nsIQuotaResults.idl
++++ b/dom/quota/nsIQuotaResults.idl
+@@ -1,16 +1,26 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "nsISupports.idl"
+ 
++[scriptable, function, uuid(d8c9328b-9aa8-4f5d-90e6-482de4a6d5b8)]
++interface nsIQuotaUsageResult : nsISupports
++{
++  readonly attribute ACString origin;
++
++  readonly attribute boolean persisted;
++
++  readonly attribute unsigned long long usage;
++};
++
+ [scriptable, function, uuid(96df03d2-116a-493f-bb0b-118c212a6b32)]
+ interface nsIQuotaOriginUsageResult : nsISupports
+ {
+   readonly attribute unsigned long long usage;
+ 
+   readonly attribute unsigned long long fileUsage;
+ 
+   readonly attribute unsigned long long limit;
+
diff --git a/gnu/packages/patches/icecat-bug-1415133.patch b/gnu/packages/patches/icecat-bug-1415133.patch
new file mode 100644
index 0000000000..4e322d21fb
--- /dev/null
+++ b/gnu/packages/patches/icecat-bug-1415133.patch
@@ -0,0 +1,40 @@
+Based on:
+  https://hg.mozilla.org/releases/mozilla-esr52/raw-rev/22fe3ff3f923
+
+Adapted to apply cleanly to IceCat.
+
+# HG changeset patch
+# User Marco Bonardo <mbonardo@mozilla.com>
+# Date 1510052455 -3600
+# Node ID 22fe3ff3f92358596521f7155ddc512006022207
+# Parent  2909ba991f3134f9fbf4859cf08582f1c9845594
+Bug 1415133 - Downgrades from 55+ to ESR lose bookmarks. r=past a=lizzard
+
+MozReview-Commit-ID: 44Rw7m1FP4h
+
+diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp
+--- a/toolkit/components/places/Database.cpp
++++ b/toolkit/components/places/Database.cpp
+@@ -761,16 +761,21 @@ Database::InitSchema(bool* aDatabaseMigr
+     // 2. implement a method that performs upgrade to your version from the
+     //    previous one.
+     //
+     // NOTE: The downgrade process is pretty much complicated by the fact old
+     //       versions cannot know what a new version is going to implement.
+     //       The only thing we will do for downgrades is setting back the schema
+     //       version, so that next upgrades will run again the migration step.
+ 
++    if (currentSchemaVersion > 36) {
++      // These versions are not downgradable.
++      return NS_ERROR_FILE_CORRUPTED;
++    }
++
+     if (currentSchemaVersion < DATABASE_SCHEMA_VERSION) {
+       *aDatabaseMigrated = true;
+ 
+       if (currentSchemaVersion < 11) {
+         // These are versions older than IceCat 4 that are not supported
+         // anymore.  In this case it's safer to just replace the database.
+         return NS_ERROR_FILE_CORRUPTED;
+       }
+
diff --git a/gnu/packages/patches/ktexteditor-5.39.0-autotests-dependencies.patch b/gnu/packages/patches/ktexteditor-5.39.0-autotests-dependencies.patch
new file mode 100644
index 0000000000..01a0e572cc
--- /dev/null
+++ b/gnu/packages/patches/ktexteditor-5.39.0-autotests-dependencies.patch
@@ -0,0 +1,49 @@
+Add missing dependencies, see <https://phabricator.kde.org/D8577>.
+
+diff -r -U5 ktexteditor-5.39.0.orig/autotests/CMakeLists.txt ktexteditor-5.39.0/autotests/CMakeLists.txt
+--- ktexteditor-5.39.0.orig/autotests/CMakeLists.txt	2017-10-31 16:28:45.018163060 +0100
++++ ktexteditor-5.39.0/autotests/CMakeLists.txt	2017-10-31 16:28:16.439559888 +0100
+@@ -37,10 +37,11 @@
+ set (KTEXTEDITOR_TEST_LINK_LIBS KF5TextEditor
+   KF5::I18n
+   KF5::IconThemes
+   KF5::GuiAddons
+   Qt5::Qml
++  Qt5::Script
+ )
+ 
+ include(ECMMarkAsTest)
+ 
+ # test executable for encoding
+diff -r -U5 ktexteditor-5.39.0.orig/CMakeLists.txt ktexteditor-5.39.0/CMakeLists.txt
+--- ktexteditor-5.39.0.orig/CMakeLists.txt	2017-10-31 16:28:38.578252490 +0100
++++ ktexteditor-5.39.0/CMakeLists.txt	2017-10-31 16:30:24.656778737 +0100
+@@ -38,11 +38,12 @@
+ 
+ # Dependencies
+ set(REQUIRED_QT_VERSION 5.7.0)
+ 
+ # Required Qt5 components to build this framework
+-find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Core Widgets Qml PrintSupport Xml XmlPatterns)
++find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Core Widgets Qml
++  Script PrintSupport Xml XmlPatterns)
+ 
+ find_package(KF5Archive ${KF5_DEP_VERSION} REQUIRED)
+ find_package(KF5Config ${KF5_DEP_VERSION} REQUIRED)
+ find_package(KF5GuiAddons ${KF5_DEP_VERSION} REQUIRED)
+ find_package(KF5I18n ${KF5_DEP_VERSION} REQUIRED)
+diff -r -U5 ktexteditor-5.39.0/autotests/src/vimode/CMakeLists.txt ktexteditor-5.39.0.new/autotests/src/vimode/CMakeLists.txt
+--- ktexteditor-5.39.0/autotests/src/vimode/CMakeLists.txt	1970-01-01 01:00:00.000000000 +0100
++++ ktexteditor-5.39.0.new/autotests/src/vimode/CMakeLists.txt	2017-10-31 16:58:29.909003953 +0100
+@@ -4,10 +4,11 @@
+   ${CMAKE_SOURCE_DIR}/src/vimode
+ )
+ 
+ set (VIMODE_TEST_LINK_LIBS KF5TextEditor
+   KF5::I18n
++  Qt5::Qml
+   Qt5::Test
+ )
+ 
+ macro(vimode_unit_test)
+   ecm_add_test(${ARGN} TEST_NAME "vimode_${ARGV0}"
diff --git a/gnu/packages/patches/libetonyek-build-with-mdds-1.2.patch b/gnu/packages/patches/libetonyek-build-with-mdds-1.2.patch
deleted file mode 100644
index 1ede82ad39..0000000000
--- a/gnu/packages/patches/libetonyek-build-with-mdds-1.2.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-Allow building with mdds 1.2.
-
-Patch taken from upstream commit f6d14b3b510de5c50e45c98fe812a73ba00f3def
-see https://gerrit.libreoffice.org/gitweb?p=libetonyek.git;a=commitdiff;h=f6d14b3b510de5c50e45c98fe812a73ba00f3def
-
-diff --git a/configure.ac b/configure.ac
-index ca4bb07..bb946eb 100644 (file)
---- a/configure.ac
-+++ b/configure.ac
-@@ -24,7 +24,7 @@ AC_LANG([C++])
- # Configure options
- # =================
- AC_ARG_WITH([mdds],
--            AS_HELP_STRING([--with-mdds=1.0|0.x], [Specify which version of mdds to use (1.0 is the default)]),
-+            AS_HELP_STRING([--with-mdds=1.2|1.0|0.x], [Specify which version of mdds to use (1.0 is the default)]),
-             [], [with_mdds="1.0"])
- 
- # ===========================
-@@ -47,7 +47,7 @@ AC_PROG_SED
- 
- AM_MISSING_PROG([GPERF], [gperf])
- 
--AS_IF([test "$with_mdds" = "1.0"], [AX_CXX_COMPILE_STDCXX_11([noext])])
-+AS_IF([test "$with_mdds" = "1.0" -o "$with_mdds" = "1.2" ], [AX_CXX_COMPILE_STDCXX_11([noext])])
- 
- # ===============
- # Find librevenge
-@@ -138,25 +138,27 @@ AC_SUBST([GLM_CFLAGS])
- # =========
- # Find mdds
- # =========
--AS_IF([test "$with_mdds" = "1.0"], [
--    PKG_CHECK_MODULES([MDDS], [mdds-1.0])
--], [
--    PKG_CHECK_MODULES([MDDS], [mdds])
--    AC_MSG_CHECKING([checking if mdds::flat_segment_tree can store values of any type])
--    old_CPPFLAGS="$CPPFLAGS"
--    CPPFLAGS="$MDDS_CFLAGS $CPPFLAGS"
--    AC_COMPILE_IFELSE([AC_LANG_SOURCE([
--    #include <mdds/flat_segment_tree.hpp>
--    struct Value {};
--    mdds::flat_segment_tree<int, Value> tree(0, 4, Value());
--    ])], [
--        AC_MSG_RESULT([yes])
--    ], [
--        AC_MSG_RESULT([no])
--        AC_MSG_ERROR([please install mdds >= 0.12.1])
--    ])
--    CPPFLAGS="$old_CPPFLAGS"
--])
-+AS_CASE(["$with_mdds"],
-+    ["1.2"], [PKG_CHECK_MODULES([MDDS], [mdds-1.2])],
-+    ["1.0"], [PKG_CHECK_MODULES([MDDS], [mdds-1.0])],
-+    [
-+        PKG_CHECK_MODULES([MDDS], [mdds])
-+        AC_MSG_CHECKING([checking if mdds::flat_segment_tree can store values of any type])
-+        old_CPPFLAGS="$CPPFLAGS"
-+        CPPFLAGS="$MDDS_CFLAGS $CPPFLAGS"
-+        AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-+            #include <mdds/flat_segment_tree.hpp>
-+            struct Value {};
-+            mdds::flat_segment_tree<int, Value> tree(0, 4, Value());
-+        ])], [
-+            AC_MSG_RESULT([yes])
-+        ], [
-+            AC_MSG_RESULT([no])
-+            AC_MSG_ERROR([please install mdds >= 0.12.1])
-+        ])
-+        CPPFLAGS="$old_CPPFLAGS"
-+    ]
-+)
- 
- # =================================
- # Libtool/Version Makefile settings
diff --git a/gnu/packages/patches/libvisio-fix-tests.patch b/gnu/packages/patches/libvisio-fix-tests.patch
deleted file mode 100644
index 335f7c11a8..0000000000
--- a/gnu/packages/patches/libvisio-fix-tests.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-Tests assume a CET timezone, but do not respect the "TZ" variable.
-
-This patch is a "squashed" version of these upstream commits:
-<https://cgit.freedesktop.org/libreoffice/libvisio/commit/?id=a97d30ad693374deab404ec31fe00665882cc949>
-<https://cgit.freedesktop.org/libreoffice/libvisio/commit/?id=c933df45a873e566c6ce4e5de5f829e64eb892f5>
-
-diff --git a/src/test/Makefile.am b/src/test/Makefile.am
-index 59d3419..23049b5 100644
---- a/src/test/Makefile.am
-+++ b/src/test/Makefile.am
-@@ -29,4 +29,7 @@ EXTRA_DIST = \
- 	     data/dwg.vsdx \
- 	     $(test_SOURCES)
- 
-+# ImportTest::testVsdMetadataTitleUtf8 checks formatted date string
-+AM_TESTS_ENVIRONMENT = TZ=UTC; export TZ;
-+
- TESTS = test
-diff --git a/src/test/importtest.cpp b/src/test/importtest.cpp
-index e05b3c1..32fb185 100644
---- a/src/test/importtest.cpp
-+++ b/src/test/importtest.cpp
-@@ -242,8 +242,8 @@ void ImportTest::testVsdMetadataTitleUtf8()
-   // Test the case when the string is UTF-8 encoded already in the file.
-   assertXPath(m_doc, "/document/setDocumentMetaData", "title", "mytitle\xC3\xA9\xC3\xA1\xC5\x91\xC5\xB1");
-   // Test <dcterms:created> and <dcterms:modified>.
--  assertXPath(m_doc, "/document/setDocumentMetaData", "creation-date", "2014-11-26T09:24:56Z");
--  assertXPath(m_doc, "/document/setDocumentMetaData", "date", "2014-11-26T09:24:56Z");
-+  assertXPath(m_doc, "/document/setDocumentMetaData", "creation-date", "2014-11-26T08:24:56Z");
-+  assertXPath(m_doc, "/document/setDocumentMetaData", "date", "2014-11-26T08:24:56Z");
- }
- 
- void ImportTest::testVsdUserDefinedMetadata()
--- 
-2.1.4
diff --git a/gnu/packages/patches/mupdf-CVE-2017-15587.patch b/gnu/packages/patches/mupdf-CVE-2017-15587.patch
index 5da7737ea1..7d24666756 100644
--- a/gnu/packages/patches/mupdf-CVE-2017-15587.patch
+++ b/gnu/packages/patches/mupdf-CVE-2017-15587.patch
@@ -3,11 +3,12 @@ Fix CVE-2017-15587.
 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-15587
 https://nandynarwhals.org/CVE-2017-15587/
 
-Copied from upstream:
+This patch is these two upstream commits squashed together:
 <https://git.ghostscript.com/?p=mupdf.git;h=82df2631d7d0446b206ea6b434ea609b6c28b0e8>
+<https://git.ghostscript.com/?p=mupdf.git;h=d18bc728e46c5a5708f14d27c2b6c44e1d0c3232>
 
 diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
-index 66bd0ed..6292793 100644
+index 66bd0ed8..89499e61 100644
 --- a/source/pdf/pdf-xref.c
 +++ b/source/pdf/pdf-xref.c
 @@ -924,7 +924,7 @@ pdf_read_new_xref_section(fz_context *ctx, pdf_document *doc, fz_stream *stm, fz
@@ -15,7 +16,10 @@ index 66bd0ed..6292793 100644
  	int i, n;
  
 -	if (i0 < 0 || i1 < 0)
-+	if (i0 < 0 || i1 < 0 || (i0+i1) < 0)
++	if (i0 < 0 || i1 < 0 || i0 > INT_MAX - i1)
  		fz_throw(ctx, FZ_ERROR_GENERIC, "negative xref stream entry index");
  	//if (i0 + i1 > pdf_xref_len(ctx, doc))
  	//	fz_throw(ctx, FZ_ERROR_GENERIC, "xref stream has too many entries");
+-- 
+2.15.0
+
diff --git a/gnu/packages/patches/netsurf-system-utf8proc.patch b/gnu/packages/patches/netsurf-system-utf8proc.patch
index 254bf52c93..654d45d017 100644
--- a/gnu/packages/patches/netsurf-system-utf8proc.patch
+++ b/gnu/packages/patches/netsurf-system-utf8proc.patch
@@ -28,37 +28,22 @@ Work around upstream's lack of a pkg-config file and update API.
  
  #include "utils/errors.h"
  #include "utils/idna.h"
-@@ -250,7 +250,7 @@
- 		return NSERROR_NOMEM;
- 	}
- 
--	nfc_size = utf8proc_normalise(nfc_label, nfc_size,
-+	nfc_size = utf8proc_normalize_utf32(nfc_label, nfc_size,
- 		UTF8PROC_STABLE | UTF8PROC_COMPOSE);
- 	if (nfc_size < 0) {
- 		return NSERROR_NOMEM;
-@@ -565,7 +565,7 @@
- 	}
- 
- 	/* Perform NFC normalisation */
--	ucs4_len = utf8proc_normalise(ucs4, u_ucs4_len,
-+	ucs4_len = utf8proc_normalize_utf32(ucs4, u_ucs4_len,
- 		UTF8PROC_STABLE | UTF8PROC_COMPOSE);
- 	if (ucs4_len < 0) {
- 		free(ucs4);
---- netsurf-3.6/test/Makefile
-+++ netsurf-3.6/test/Makefile
-@@ -112,11 +112,11 @@
- 		-D_XOPEN_SOURCE=600 \
- 		-Itest -Iinclude -Icontent/handlers -Ifrontends -I. -I.. \
- 		-Dnsgtk \
--		$(shell pkg-config --cflags libcurl libparserutils libwapcaplet libdom libnsutils libutf8proc libidn) \
-+		$(shell pkg-config --cflags libcurl libparserutils libwapcaplet libdom libnsutils libidn) \
- 		$(LIB_CFLAGS) \
- 		$(COV_CFLAGS)
- 
--TESTLDFLAGS := $(shell pkg-config --libs libcurl libparserutils libwapcaplet libdom libnsutils libutf8proc libidn) -lz \
-+TESTLDFLAGS := $(shell pkg-config --libs libcurl libparserutils libwapcaplet libdom libnsutils libidn) -lz -lutf8proc \
- 		$(LIB_LDFLAGS)\
- 		$(COV_LDFLAGS)
+--- netsurf-3.7/test/Makefile	2017-10-15 08:39:24.000000000 -0500
++++ netsurf-3.7/test/Makefile	2017-11-05 11:14:46.219013218 -0600
+@@ -139,14 +139,14 @@
+ 	-D_XOPEN_SOURCE=600 \
+ 	-Itest -Iinclude -Icontent/handlers -Ifrontends -I. -I.. \
+ 	-Dnsgtk \
+-	$(shell pkg-config --cflags libcurl libparserutils libwapcaplet libdom libnsutils libutf8proc) \
++	$(shell pkg-config --cflags libcurl libparserutils libwapcaplet libdom libnsutils) \
+ 	$(LIB_CFLAGS)
+ TESTCFLAGS := $(BASE_TESTCFLAGS) \
+ 	$(COV_CFLAGS) \
+ 	$(COV_CPPFLAGS)
+ 
+ TESTLDFLAGS := -L$(TESTROOT) \
+-	$(shell pkg-config --libs libcurl libparserutils libwapcaplet libdom libnsutils libutf8proc) -lz \
++	$(shell pkg-config --libs libcurl libparserutils libwapcaplet libdom libnsutils) -lz -lutf8proc \
+ 	$(LIB_LDFLAGS)\
+ 	$(COV_LDFLAGS)
  
diff --git a/gnu/packages/patches/owncloud-disable-updatecheck.patch b/gnu/packages/patches/owncloud-disable-updatecheck.patch
new file mode 100644
index 0000000000..69a984a104
--- /dev/null
+++ b/gnu/packages/patches/owncloud-disable-updatecheck.patch
@@ -0,0 +1,49 @@
+This patch is taken from Debian and modified slightly
+
+Description: Phoning-home version checks should be disabled in Debian packages
+Author: Sandro Knauß <bugs@ssandroknauss.de>
+Origin: debian
+Bug-debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=721341
+Forwarded: not-needed
+Last-Update: 2014-02-17
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/src/libsync/configfile.cpp
++++ b/src/libsync/configfile.cpp
+@@ -417,11 +417,14 @@ bool ConfigFile::skipUpdateCheck( const
+     QString con( connection );
+     if( connection.isEmpty() ) con = defaultConnection();
+
+-    QVariant fallback = getValue(QLatin1String(skipUpdateCheckC), con, false);
++    QVariant fallback = getValue(QLatin1String(skipUpdateCheckC), con, true);
+     fallback = getValue(QLatin1String(skipUpdateCheckC), QString(), fallback);
+
+     QVariant value = getPolicySetting(QLatin1String(skipUpdateCheckC), fallback);
+-    return value.toBool();
++    if ( !value.toBool() )
++        qDebug() << "Guix has disabled the UpdateCheck mechanism.";
++
++    return true;
+ }
+
+ void ConfigFile::setSkipUpdateCheck( bool skip, const QString& connection )
+--- a/src/gui/generalsettings.cpp
++++ b/src/gui/generalsettings.cpp
+@@ -124,6 +124,7 @@ void GeneralSettings::loadMiscSettings()
+
+ void GeneralSettings::slotUpdateInfo()
+ {
++    /* Guix doesn't want an autoupdater
+     // Note: the sparkle-updater is not an OCUpdater
+     OCUpdater *updater = qobject_cast<OCUpdater*>(Updater::instance());
+     if (ConfigFile().skipUpdateCheck()) {
+@@ -140,6 +141,9 @@ void GeneralSettings::slotUpdateInfo()
+         // can't have those infos from sparkle currently
+         _ui->updatesGroupBox->setVisible(false);
+     }
++    */
++    //hide the update group box for Guix.
++    _ui->updatesGroupBox->setVisible(false);
+ }
+
+ void GeneralSettings::saveMiscSettings()
diff --git a/gnu/packages/patches/psm-arch.patch b/gnu/packages/patches/psm-arch.patch
new file mode 100644
index 0000000000..3d95c28595
--- /dev/null
+++ b/gnu/packages/patches/psm-arch.patch
@@ -0,0 +1,13 @@
+Use 'uname -m', which in practice returns the processor architecture.
+
+--- psm-3.3/buildflags.mak~	2014-08-20 21:00:18.000000000 +0100
++++ psm-3.3/buildflags.mak	2017-10-22 12:02:12.855291447 +0100
+@@ -38,7 +38,7 @@
+ endif
+ 
+ export os ?= $(shell uname -s | tr '[A-Z]' '[a-z]')
+-export arch := $(shell uname -p | sed -e 's,\(i[456]86\|athlon$$\),i386,')
++export arch := $(shell uname -m | sed -e 's,\(i[456]86\|athlon$$\),i386,')
+ 
+ CC ?= gcc
+ 
diff --git a/gnu/packages/patches/psm-ldflags.patch b/gnu/packages/patches/psm-ldflags.patch
new file mode 100644
index 0000000000..d761a3114a
--- /dev/null
+++ b/gnu/packages/patches/psm-ldflags.patch
@@ -0,0 +1,13 @@
+Add missing flags.
+
+--- psm-3.3/ipath/Makefile~	1970-01-01 01:00:00.000000000 +0100
++++ psm-3.3/ipath/Makefile	2017-10-22 15:10:10.269177711 +0100
+@@ -73,7 +73,7 @@
+ ${TARGLIB}.so.${MAJOR}.${MINOR}: ${${TARGLIB}-objs}
+ 	date +'static __attribute__ ((unused)) char __psc_infinipath_revision[] ="$$""Date: %F %R ${rpm_extra_description}InfiniPath $$";' > _revision.c
+ 	$(CC) -c $(BASECFLAGS) $(INCLUDES) _revision.c -o _revision.o
+-	$(CC) -o $@ -Wl,-soname=${TARGLIB}.so.${MAJOR} -shared \
++	$(CC) -o $@ -Wl,-soname=${TARGLIB}.so.${MAJOR} $(LDFLAGS) -shared \
+ 		-Wl,--unique='*fastpath*' \
+ 		${${TARGLIB}-objs} _revision.o $(LDFLAGS) $(if $(MIC:0=),$(SCIF_LINK_FLAGS))
+ 
diff --git a/gnu/packages/patches/psm-repro.patch b/gnu/packages/patches/psm-repro.patch
new file mode 100644
index 0000000000..772801260e
--- /dev/null
+++ b/gnu/packages/patches/psm-repro.patch
@@ -0,0 +1,14 @@
+Remove timestamp to support reproducible builds.
+
+--- psm-3.3/Makefile~	1970-01-01 01:00:00.000000000 +0100
++++ psm-3.3/Makefile	2017-10-22 15:32:11.736949002 +0100
+@@ -326,7 +326,7 @@
+ # file around.  Generate it such that the ident command can find it
+ # and strings -a | grep InfiniPath does a reasonable job as well.
+ ${TARGLIB}.so.${MAJOR}.${MINOR}: ${${TARGLIB}-objs}
+-	date +'char psmi_infinipath_revision[] ="$$""Date: %F %R ${rpm_extra_description}InfiniPath $$";' > ${lib_build_dir}/_revision.c
++	echo 'char psmi_infinipath_revision[] ="$$""Date: 1970-01-01 00:00 ${rpm_extra_description}InfiniPath $$";' > ${lib_build_dir}/_revision.c
+ 	$(CC) -c $(BASECFLAGS) $(INCLUDES) _revision.c -o _revision.o
+ 	$(CC) $(LDFLAGS) -o $@ -Wl,-soname=${TARGLIB}.so.${MAJOR} -shared -Wl,--unique='*fastpath*' \
+ 		${${TARGLIB}-objs} _revision.o -L$(build_dir)/ipath $(LDLIBS)
+
diff --git a/gnu/packages/patches/python-networkx2-reproducible-build.patch b/gnu/packages/patches/python-networkx2-reproducible-build.patch
new file mode 100644
index 0000000000..8274767ab8
--- /dev/null
+++ b/gnu/packages/patches/python-networkx2-reproducible-build.patch
@@ -0,0 +1,29 @@
+From c065b972ed294769a41936d6b9feb336473af5d1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= <boskovits@gmail.com>
+Date: Sat, 4 Nov 2017 15:28:47 +0100
+Subject: Fix SOURCE_DATE_EPOCH ignored bug (#2735)
+
+* Fix SOURCE_DATE_EPOCH ignored bug
+
+Fix a bug in networkx/release.py that makes build
+non-reproducible.
+---
+ networkx/release.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/networkx/release.py b/networkx/release.py
+index e81fc0c0..6322cf0d 100644
+--- a/networkx/release.py
++++ b/networkx/release.py
+@@ -135,7 +135,7 @@ def get_revision():
+ 
+ def get_info(dynamic=True):
+     # Date information
+-    date_info = datetime.datetime.now()
++    date_info = datetime.datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
+     date = time.asctime(date_info.timetuple())
+ 
+     revision, version, version_info, vcs_info = None, None, None, None
+-- 
+2.14.2
+
diff --git a/gnu/packages/patches/qemu-CVE-2017-15038.patch b/gnu/packages/patches/qemu-CVE-2017-15038.patch
new file mode 100644
index 0000000000..4791a186bf
--- /dev/null
+++ b/gnu/packages/patches/qemu-CVE-2017-15038.patch
@@ -0,0 +1,51 @@
+Fix CVE-2017-15038:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-15038
+
+Patch copied from upstream source repository:
+
+https://git.qemu.org/?p=qemu.git;a=commitdiff;h=7bd92756303f2158a68d5166264dc30139b813b6
+
+From 7bd92756303f2158a68d5166264dc30139b813b6 Mon Sep 17 00:00:00 2001
+From: Prasad J Pandit <pjp@fedoraproject.org>
+Date: Mon, 16 Oct 2017 14:21:59 +0200
+Subject: [PATCH] 9pfs: use g_malloc0 to allocate space for xattr
+
+9p back-end first queries the size of an extended attribute,
+allocates space for it via g_malloc() and then retrieves its
+value into allocated buffer. Race between querying attribute
+size and retrieving its could lead to memory bytes disclosure.
+Use g_malloc0() to avoid it.
+
+Reported-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
+Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
+Signed-off-by: Greg Kurz <groug@kaod.org>
+---
+ hw/9pfs/9p.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
+index 23ac7bb532..f8bbac251d 100644
+--- a/hw/9pfs/9p.c
++++ b/hw/9pfs/9p.c
+@@ -3234,7 +3234,7 @@ static void coroutine_fn v9fs_xattrwalk(void *opaque)
+         xattr_fidp->fid_type = P9_FID_XATTR;
+         xattr_fidp->fs.xattr.xattrwalk_fid = true;
+         if (size) {
+-            xattr_fidp->fs.xattr.value = g_malloc(size);
++            xattr_fidp->fs.xattr.value = g_malloc0(size);
+             err = v9fs_co_llistxattr(pdu, &xattr_fidp->path,
+                                      xattr_fidp->fs.xattr.value,
+                                      xattr_fidp->fs.xattr.len);
+@@ -3267,7 +3267,7 @@ static void coroutine_fn v9fs_xattrwalk(void *opaque)
+         xattr_fidp->fid_type = P9_FID_XATTR;
+         xattr_fidp->fs.xattr.xattrwalk_fid = true;
+         if (size) {
+-            xattr_fidp->fs.xattr.value = g_malloc(size);
++            xattr_fidp->fs.xattr.value = g_malloc0(size);
+             err = v9fs_co_lgetxattr(pdu, &xattr_fidp->path,
+                                     &name, xattr_fidp->fs.xattr.value,
+                                     xattr_fidp->fs.xattr.len);
+-- 
+2.15.0
+
diff --git a/gnu/packages/patches/qemu-CVE-2017-15268.patch b/gnu/packages/patches/qemu-CVE-2017-15268.patch
new file mode 100644
index 0000000000..8238c3059f
--- /dev/null
+++ b/gnu/packages/patches/qemu-CVE-2017-15268.patch
@@ -0,0 +1,62 @@
+Fix CVE-2017-15268:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-15268
+
+Patch copied from upstream source repository:
+
+https://git.qemu.org/?p=qemu.git;a=commitdiff;h=a7b20a8efa28e5f22c26c06cd06c2f12bc863493
+
+From a7b20a8efa28e5f22c26c06cd06c2f12bc863493 Mon Sep 17 00:00:00 2001
+From: "Daniel P. Berrange" <berrange@redhat.com>
+Date: Mon, 9 Oct 2017 14:43:42 +0100
+Subject: [PATCH] io: monitor encoutput buffer size from websocket GSource
+
+The websocket GSource is monitoring the size of the rawoutput
+buffer to determine if the channel can accepts more writes.
+The rawoutput buffer, however, is merely a temporary staging
+buffer before data is copied into the encoutput buffer. Thus
+its size will always be zero when the GSource runs.
+
+This flaw causes the encoutput buffer to grow without bound
+if the other end of the underlying data channel doesn't
+read data being sent. This can be seen with VNC if a client
+is on a slow WAN link and the guest OS is sending many screen
+updates. A malicious VNC client can act like it is on a slow
+link by playing a video in the guest and then reading data
+very slowly, causing QEMU host memory to expand arbitrarily.
+
+This issue is assigned CVE-2017-15268, publically reported in
+
+  https://bugs.launchpad.net/qemu/+bug/1718964
+
+Reviewed-by: Eric Blake <eblake@redhat.com>
+Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
+---
+ io/channel-websock.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/io/channel-websock.c b/io/channel-websock.c
+index d1d471f86e..04bcc059cd 100644
+--- a/io/channel-websock.c
++++ b/io/channel-websock.c
+@@ -28,7 +28,7 @@
+ #include <time.h>
+ 
+ 
+-/* Max amount to allow in rawinput/rawoutput buffers */
++/* Max amount to allow in rawinput/encoutput buffers */
+ #define QIO_CHANNEL_WEBSOCK_MAX_BUFFER 8192
+ 
+ #define QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN 24
+@@ -1208,7 +1208,7 @@ qio_channel_websock_source_check(GSource *source)
+     if (wsource->wioc->rawinput.offset || wsource->wioc->io_eof) {
+         cond |= G_IO_IN;
+     }
+-    if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
++    if (wsource->wioc->encoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
+         cond |= G_IO_OUT;
+     }
+ 
+-- 
+2.15.0
+
diff --git a/gnu/packages/patches/qemu-CVE-2017-15289.patch b/gnu/packages/patches/qemu-CVE-2017-15289.patch
new file mode 100644
index 0000000000..d4b536a405
--- /dev/null
+++ b/gnu/packages/patches/qemu-CVE-2017-15289.patch
@@ -0,0 +1,66 @@
+Fix CVE-2017-15289:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-15289
+
+Patch copied from upstream source repository:
+
+https://git.qemu.org/?p=qemu.git;a=commitdiff;h=eb38e1bc3740725ca29a535351de94107ec58d51 
+
+From eb38e1bc3740725ca29a535351de94107ec58d51 Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Wed, 11 Oct 2017 10:43:14 +0200
+Subject: [PATCH] cirrus: fix oob access in mode4and5 write functions
+
+Move dst calculation into the loop, so we apply the mask on each
+interation and will not overflow vga memory.
+
+Cc: Prasad J Pandit <pjp@fedoraproject.org>
+Reported-by: Niu Guoxiang <niuguoxiang@huawei.com>
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+Message-id: 20171011084314.21752-1-kraxel@redhat.com
+---
+ hw/display/cirrus_vga.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
+index b4d579857a..bc32bf1e39 100644
+--- a/hw/display/cirrus_vga.c
++++ b/hw/display/cirrus_vga.c
+@@ -2038,15 +2038,14 @@ static void cirrus_mem_writeb_mode4and5_8bpp(CirrusVGAState * s,
+     unsigned val = mem_value;
+     uint8_t *dst;
+ 
+-    dst = s->vga.vram_ptr + (offset &= s->cirrus_addr_mask);
+     for (x = 0; x < 8; x++) {
++        dst = s->vga.vram_ptr + ((offset + x) & s->cirrus_addr_mask);
+ 	if (val & 0x80) {
+ 	    *dst = s->cirrus_shadow_gr1;
+ 	} else if (mode == 5) {
+ 	    *dst = s->cirrus_shadow_gr0;
+ 	}
+ 	val <<= 1;
+-	dst++;
+     }
+     memory_region_set_dirty(&s->vga.vram, offset, 8);
+ }
+@@ -2060,8 +2059,8 @@ static void cirrus_mem_writeb_mode4and5_16bpp(CirrusVGAState * s,
+     unsigned val = mem_value;
+     uint8_t *dst;
+ 
+-    dst = s->vga.vram_ptr + (offset &= s->cirrus_addr_mask);
+     for (x = 0; x < 8; x++) {
++        dst = s->vga.vram_ptr + ((offset + 2 * x) & s->cirrus_addr_mask & ~1);
+ 	if (val & 0x80) {
+ 	    *dst = s->cirrus_shadow_gr1;
+ 	    *(dst + 1) = s->vga.gr[0x11];
+@@ -2070,7 +2069,6 @@ static void cirrus_mem_writeb_mode4and5_16bpp(CirrusVGAState * s,
+ 	    *(dst + 1) = s->vga.gr[0x10];
+ 	}
+ 	val <<= 1;
+-	dst += 2;
+     }
+     memory_region_set_dirty(&s->vga.vram, offset, 16);
+ }
+-- 
+2.15.0
+