code:
Patch for version 3.01, taken from upstream at
https://sourceforge.net/projects/cdrtools/files/cdrtools-3.01-fix-20151126-mkisofs-isoinfo.patch

--- cdrtools-3.01.orig/mkisofs/diag/isoinfo.c	2015-07-22 20:36:45.000000000 +0000
+++ cdrtools-3.01/mkisofs/diag/isoinfo.c	2015-11-17 19:35:40.000000000 +0000
@@ -1,8 +1,8 @@
-/* @(#)isoinfo.c	1.95 15/07/22 joerg */
+/* @(#)isoinfo.c	1.100 15/11/17 joerg */
 #include <schily/mconfig.h>
 #ifndef	lint
 static	UConst char sccsid[] =
-	"@(#)isoinfo.c	1.95 15/07/22 joerg";
+	"@(#)isoinfo.c	1.100 15/11/17 joerg";
 #endif
 /*
  * File isodump.c - dump iso9660 directory information.
@@ -148,8 +148,10 @@ LOCAL char	er_id[256];
 LOCAL int	su_version = 0;
 LOCAL int	rr_version = 0;
 LOCAL int	aa_version = 0;
+LOCAL int	cl_extent = 0;
 LOCAL int	ucs_level = 0;
 LOCAL BOOL	iso9660_inodes = FALSE;
+LOCAL uid_t	myuid;

 #ifdef	USE_FIND
 LOCAL findn_t	*find_node;		/* syntaxtree from find_parse()	*/
@@ -208,6 +210,9 @@ LOCAL	void	extract		__PR((char *rootname
 LOCAL	void	extract_file	__PR((int f,
 					struct iso_directory_record * idr,
 					char *fname));
+LOCAL	void	parse_cl_dir	__PR((struct iso_directory_record *idr,
+					int extent));
+LOCAL	BOOL	parse_de	__PR((struct iso_directory_record *idr));
 LOCAL	void	parse_dir	__PR((char * rootname, int extent, int len));
 LOCAL	void	usage		__PR((int excode));
 EXPORT	int	main		__PR((int argc, char *argv[]));
@@ -459,7 +464,6 @@ parse_rr(pnt, len, cont_flag)
 	int slen;
 	int xlen;
 	int ncount;
-	int cl_extent;
 	int pl_extent;
 	int cont_extent, cont_offset, cont_size;
 	int flag1, flag2;
@@ -469,7 +473,7 @@ parse_rr(pnt, len, cont_flag)

 	symlinkname[0] = 0;

-	cont_extent = cont_offset = cont_size = 0;
+	cl_extent = cont_extent = cont_offset = cont_size = 0;

 	ncount = 0;
 	flag1 = -1;
@@ -714,6 +718,7 @@ struct todo
 };

 LOCAL struct todo	*todo_idr = NULL;
+LOCAL struct todo	**todo_pp = &todo_idr;

 LOCAL char		*months[12] = {"Jan", "Feb", "Mar", "Apr",
 				"May", "Jun", "Jul",
@@ -962,8 +967,14 @@ static	BOOL		isfirst = TRUE;
 	close(f);
 	return;
 setmode:
-	fchmodat(AT_FDCWD, fname, fstat_buf.st_mode, AT_SYMLINK_NOFOLLOW);
 	fchownat(AT_FDCWD, fname, fstat_buf.st_uid, fstat_buf.st_gid, AT_SYMLINK_NOFOLLOW);
+	if (myuid != 0 && S_ISDIR(fstat_buf.st_mode)) {
+		/*
+		 * Temporary hack until we have a dirstack like star.
+		 */
+		fstat_buf.st_mode |= S_IWUSR;
+	}
+	fchmodat(AT_FDCWD, fname, fstat_buf.st_mode, AT_SYMLINK_NOFOLLOW);
 	times[0].tv_sec = fstat_buf.st_atime;
 	times[0].tv_nsec = stat_ansecs(&fstat_buf);
 	times[1].tv_sec = fstat_buf.st_mtime;
@@ -1001,6 +1012,143 @@ extract_file(f, idr, fname)
 	}
 }

+
+LOCAL void
+parse_cl_dir(idr, extent)
+	struct iso_directory_record	*idr;
+	int				extent;
+{
+	char				cl_name_buf[256*3];
+
+	strlcpy(cl_name_buf, name_buf, sizeof (cl_name_buf));
+#ifdef	USE_SCG
+	readsecs(extent - sector_offset, idr, 1);
+#else
+	lseek(fileno(infile), ((off_t)(extent - sector_offset)) << 11, SEEK_SET);
+	read(fileno(infile), idr, 2048);
+#endif
+
+	if (parse_de(idr) && use_rock)
+		dump_rr(idr);
+	strlcpy(name_buf, cl_name_buf, sizeof (name_buf));
+}
+
+LOCAL BOOL
+parse_de(idr)
+	struct iso_directory_record	*idr;
+{
+	unsigned char	uc;
+
+	if (idr->length[0] == 0)
+		return (FALSE);
+	memset(&fstat_buf, 0, sizeof (fstat_buf));
+	found_rr = 0;
+	name_buf[0] = xname[0] = 0;
+	fstat_buf.st_size = (off_t)(unsigned)isonum_733((unsigned char *)idr->size);
+	if (idr->flags[0] & 2)
+		fstat_buf.st_mode |= S_IFDIR;
+	else
+		fstat_buf.st_mode |= S_IFREG;
+	if (idr->name_len[0] == 1 && idr->name[0] == 0)
+		strcpy(name_buf, ".");
+	else if (idr->name_len[0] == 1 && idr->name[0] == 1)
+		strcpy(name_buf, "..");
+	else {
+		switch (ucs_level) {
+		case 3:
+		case 2:
+		case 1:
+			/*
+			 * Unicode name.  Convert as best we can.
+			 */
+			{
+			int	j;
+				name_buf[0] = '\0';
+#ifdef	USE_ICONV
+			if (use_iconv(unls)) {
+				int	u;
+				char	*to = name_buf;
+
+				for (j = 0, u = 0; j < (int)idr->name_len[0] / 2; j++) {
+					char	*ibuf = (char *)&idr->name[j*2];
+					size_t	isize = 2;		/* UCS-2 character size */
+					size_t	osize = 4;
+
+					if (iconv(unls->sic_uni2cd, (__IC_CONST char **)&ibuf, &isize,
+							(char **)&to, &osize) == -1) {
+						int	err = geterrno();
+
+						if ((err == EINVAL || err == EILSEQ) &&
+						    osize == 4) {
+							*to = '_';
+							u += 1;
+							to++;
+						}
+					} else {
+						u += 4 - osize;
+						to = &name_buf[u];
+					}
+				}
+				j = u;
+			} else
+#endif
+			for (j = 0; j < (int)idr->name_len[0] / 2; j++) {
+				UInt16_t	unichar;
+
+				unichar = (idr->name[j*2] & 0xFF) * 256 +
+					    (idr->name[j*2+1] & 0xFF);
+
+				/*
+				 * Get the backconverted char
+				 */
+				if (unls)
+					uc = sic_uni2c(unls, unichar);
+				else
+					uc = unichar > 255 ? '_' : unichar;
+
+				name_buf[j] = uc ? uc : '_';
+			}
+			name_buf[j] = '\0';
+			}
+			break;
+		case 0:
+			/*
+			 * Normal non-Unicode name.
+			 */
+			strncpy(name_buf, idr->name, idr->name_len[0]);
+			name_buf[idr->name_len[0]] = 0;
+			break;
+		default:
+			/*
+			 * Don't know how to do these yet.  Maybe they are the same
+			 * as one of the above.
+			 */
+			exit(1);
+		}
+	}
+	memcpy(date_buf, idr->date, 9);
+	/*
+	 * Always first set up time stamps and file modes from
+	 * ISO-9660. This is used as a fallback in case that
+	 * there is no related Rock Ridge based data.
+	 */
+	fstat_buf.st_atime =
+	fstat_buf.st_mtime =
+	fstat_buf.st_ctime = iso9660_time(date_buf, NULL, FALSE);
+	fstat_buf.st_mode |= S_IRUSR|S_IXUSR |
+		    S_IRGRP|S_IXGRP |
+		    S_IROTH|S_IXOTH;
+	fstat_buf.st_nlink = 1;
+	fstat_buf.st_ino = 0;
+	fstat_buf.st_uid = 0;
+	fstat_buf.st_gid = 0;
+	if (iso9660_inodes) {
+		fstat_buf.st_ino = (unsigned long)
+		    isonum_733((unsigned char *)idr->extent);
+	}
+	return (TRUE);
+}
+
 LOCAL void
 parse_dir(rootname, extent, len)
 	char	*rootname;
@@ -1012,12 +1160,13 @@ parse_dir(rootname, extent, len)
 	struct iso_directory_record * idr;
 	struct iso_directory_record	didr;
 	struct stat			dstat;
-	unsigned char	uc;
+	unsigned char	cl_buffer[2048];
 	unsigned char	flags = 0;
 	Llong		size = 0;
 	int		sextent = 0;
 	int	rlen;
 	int	blen;
+	int	rr_flags = 0;
 static	char	*n = 0;
 static	int	nlen = 0;

@@ -1039,115 +1188,23 @@ static	int	nlen = 0;
 		i = 0;
 		while (1 == 1) {
 			idr = (struct iso_directory_record *) &buffer[i];
-			if (idr->length[0] == 0) break;
-			memset(&fstat_buf, 0, sizeof (fstat_buf));
-			found_rr = 0;
-			name_buf[0] = xname[0] = 0;
-			fstat_buf.st_size = (off_t)(unsigned)isonum_733((unsigned char *)idr->size);
-			if (idr->flags[0] & 2)
-				fstat_buf.st_mode |= S_IFDIR;
-			else
-				fstat_buf.st_mode |= S_IFREG;
-			if (idr->name_len[0] == 1 && idr->name[0] == 0)
-				strcpy(name_buf, ".");
-			else if (idr->name_len[0] == 1 && idr->name[0] == 1)
-				strcpy(name_buf, "..");
-			else {
-				switch (ucs_level) {
-				case 3:
-				case 2:
-				case 1:
-					/*
-					 * Unicode name.  Convert as best we can.
-					 */
-					{
-					int	j;
-
-					name_buf[0] = '\0';
-#ifdef	USE_ICONV
-					if (use_iconv(unls)) {
-						int	u;
-						char	*to = name_buf;
-
-						for (j = 0, u = 0; j < (int)idr->name_len[0] / 2; j++) {
-							char	*ibuf = (char *)&idr->name[j*2];
-							size_t	isize = 2;		/* UCS-2 character size */
-							size_t	osize = 4;
-
-							if (iconv(unls->sic_uni2cd, (__IC_CONST char **)&ibuf, &isize,
-									(char **)&to, &osize) == -1) {
-								int	err = geterrno();
-
-								if ((err == EINVAL || err == EILSEQ) &&
-								    osize == 4) {
-									*to = '_';
-									u += 1;
-									to++;
-								}
-							} else {
-								u += 4 - osize;
-								to = &name_buf[u];
-							}
-						}
-						j = u;
-					} else
-#endif
-					for (j = 0; j < (int)idr->name_len[0] / 2; j++) {
-						UInt16_t	unichar;
-
-						unichar = (idr->name[j*2] & 0xFF) * 256 +
-							    (idr->name[j*2+1] & 0xFF);
-
-						/*
-						 * Get the backconverted char
-						 */
-						if (unls)
-							uc = sic_uni2c(unls, unichar);
-						else
-							uc = unichar > 255 ? '_' : unichar;
+			if (idr->length[0] == 0)
+				break;
+			parse_de(idr);
+			if (use_rock) {
+				rr_flags = dump_rr(idr);

-						name_buf[j] = uc ? uc : '_';
-					}
-					name_buf[j] = '\0';
-					}
-					break;
-				case 0:
+				if (rr_flags & RR_FLAG_CL) {
 					/*
-					 * Normal non-Unicode name.
+					 * Need to reparse the child link
+					 * but note that we parse "CL/."
+					 * so we get no usable file name.
 					 */
-					strncpy(name_buf, idr->name, idr->name_len[0]);
-					name_buf[idr->name_len[0]] = 0;
-					break;
-				default:
-					/*
-					 * Don't know how to do these yet.  Maybe they are the same
-					 * as one of the above.
-					 */
-					exit(1);
-				}
+					idr = (struct iso_directory_record *) cl_buffer;
+					parse_cl_dir(idr, cl_extent);
+				} else if (rr_flags & RR_FLAG_RE)
+					goto cont;	/* skip rr_moved */
 			}
-			memcpy(date_buf, idr->date, 9);
-			/*
-			 * Always first set up time stamps and file modes from
-			 * ISO-9660. This is used as a fallback in case that
-			 * there is no related Rock Ridge based data.
-			 */
-			fstat_buf.st_atime =
-			fstat_buf.st_mtime =
-			fstat_buf.st_ctime = iso9660_time(date_buf, NULL, FALSE);
-			fstat_buf.st_mode |= S_IRUSR|S_IXUSR |
-				    S_IRGRP|S_IXGRP |
-				    S_IROTH|S_IXOTH;
-			fstat_buf.st_nlink = 1;
-			fstat_buf.st_ino = 0;
-			fstat_buf.st_uid = 0;
-			fstat_buf.st_gid = 0;
-			if (iso9660_inodes) {
-				fstat_buf.st_ino = (unsigned long)
-				    isonum_733((unsigned char *)idr->extent);
-			}
-			if (use_rock)
-				dump_rr(idr);
 			if (Xtract &&
 			    (idr->flags[0] & 2) != 0 &&
 			    idr->name_len[0] == 1 &&
@@ -1170,30 +1227,30 @@ static	int	nlen = 0;
 				n[rlen] = '\0';

 			if ((idr->flags[0] & 2) != 0 &&
-			    (idr->name_len[0] != 1 ||
+			    ((rr_flags & RR_FLAG_CL) ||
+			    idr->name_len[0] != 1 ||
 			    (idr->name[0] != 0 && idr->name[0] != 1))) {
 				/*
 				 * This is a plain directory (neither "xxx/."
 				 * nor "xxx/..").
 				 * Add this directory to the todo list.
 				 */
-				td = todo_idr;
-				if (td != NULL) {
-					while (td->next != NULL)
-						td = td->next;
-					td->next = (struct todo *) malloc(sizeof (*td));
-					td = td->next;
-				} else {
-					todo_idr = td = (struct todo *) malloc(sizeof (*td));
-				}
+				td = (struct todo *) malloc(sizeof (*td));
+				if (td == NULL)
+					comerr(_("No memory.\n"));
 				td->next = NULL;
 				td->extent = isonum_733((unsigned char *)idr->extent);
 				td->length = isonum_733((unsigned char *)idr->size);
 				td->name = (char *) malloc(strlen(rootname)
 								+ strlen(name_buf) + 2);
+				if (td->name == NULL)
+					comerr(_("No memory.\n"));
 				strcpy(td->name, rootname);
 				strcat(td->name, name_buf);
 				strcat(td->name, "/");
+
+				*todo_pp = td;
+				todo_pp = &td->next;
 			} else {
 				if (xtract && strcmp(xtract, n) == 0) {
 					extract_file(STDOUT_FILENO, idr, "stdout");
@@ -1253,6 +1310,7 @@ static	int	nlen = 0;
 				if ((idr->flags[0] & ISO_MULTIEXTENT) == 0)
 					size = 0;
 			}
+		cont:
 			i += buffer[i];
 			if (i > 2048 - offsetof(struct iso_directory_record, name[0])) break;
 		}
@@ -1381,12 +1439,13 @@ main(argc, argv)
 		usage(0);
 	if (prvers) {
 		printf(_("isoinfo %s (%s-%s-%s) Copyright (C) 1993-1999 %s (C) 1999-2015 %s\n"),
-					VERSION,
+					"3.02a02",
 					HOST_CPU, HOST_VENDOR, HOST_OS,
 					_("Eric Youngdale"),
 					_("Joerg Schilling"));
 		exit(0);
 	}
+	myuid = getuid();
 #ifdef	USE_FIND
 	if (do_find) {
 		finda_t	fa;
--- cdrtools-3.01.orig/mkisofs/udf.c	2013-04-24 20:45:18.000000000 +0000
+++ cdrtools-3.01/mkisofs/udf.c	2015-11-25 22:07:30.000000000 +0000
@@ -1,15 +1,15 @@
-/* @(#)udf.c	1.42 13/04/24 Copyright 2001-2013 J. Schilling */
+/* @(#)udf.c	1.43 15/11/25 Copyright 2001-2015 J. Schilling */
 #include <schily/mconfig.h>
 #ifndef lint
 static	UConst char sccsid[] =
-	"@(#)udf.c	1.42 13/04/24 Copyright 2001-2013 J. Schilling";
+	"@(#)udf.c	1.43 15/11/25 Copyright 2001-2015 J. Schilling";
 #endif
 /*
  * udf.c - UDF support for mkisofs
  *
  * Written by Ben Rudiak-Gould (2001).
  *
- * Copyright 2001-2013 J. Schilling.
+ * Copyright 2001-2015 J. Schilling.
  */
 /*
  * This program is free software; you can redistribute it and/or modify
@@ -98,7 +98,7 @@ static	UConst char sccsid[] =
 extern	int	use_sparcboot;

 extern struct directory *root;
-extern time_t		begun;
+extern struct timeval	tv_begun;

 static unsigned lba_main_seq;
 static unsigned lba_main_seq_copy;
@@ -110,7 +110,7 @@ static unsigned lba_end_anchor_vol_desc;
 static unsigned num_udf_files;
 static unsigned num_udf_directories;

-static unsigned volume_set_id[2];
+static unsigned volume_set_id[2] = { 0, 0 };

 #define	UDF_MAIN_SEQ_LENGTH (16)
 #define	UDF_INTEG_SEQ_LENGTH (2)
@@ -723,7 +723,7 @@ set_primary_vol_desc(buf, lba)
 	/*pvd->volume_abstract;*/
 	/*pvd->volume_copyright_notice;*/
 	/*pvd->application_ident;*/
-	set_timestamp_from_time_t(&pvd->recording_date_and_time, begun);
+	set_timestamp_from_time_t(&pvd->recording_date_and_time, tv_begun.tv_sec);
 	set_impl_ident(&pvd->impl_ident);
 	set_tag(&pvd->desc_tag, UDF_TAGID_PRIMARY_VOLUME_DESC, lba, 512);
 }
@@ -831,7 +831,7 @@ set_logical_vol_integrity_desc(buf, lba)
 	udf_logical_volume_integrity_desc *lvid =
 				(udf_logical_volume_integrity_desc *)buf;

-	set_timestamp_from_time_t(&lvid->recording_date, begun);
+	set_timestamp_from_time_t(&lvid->recording_date, tv_begun.tv_sec);
 	set32(&lvid->integrity_type, UDF_INTEGRITY_TYPE_CLOSE);
 	/*lvid->next_integrity_extent;*/
 	set64(&lvid->logical_volume_contents_use.unique_id,
@@ -859,7 +859,7 @@ set_file_set_desc(buf, rba)
 {
 	udf_file_set_desc *fsd = (udf_file_set_desc *)buf;

-	set_timestamp_from_time_t(&fsd->recording_date_and_time, begun);
+	set_timestamp_from_time_t(&fsd->recording_date_and_time, tv_begun.tv_sec);
 	set16(&fsd->interchange_level, 3);
 	set16(&fsd->maximum_interchange_level, 3);
 	set32(&fsd->character_set_list, 1);
@@ -1986,8 +1986,10 @@ udf_main_seq_write(out)
 	 * volume_set_id needs to be set to a (64-bit) "unique" number.
 	 * This will have to do for now.
 	 */
-	volume_set_id[0] = begun;
-	volume_set_id[1] = (unsigned)clock();	/* XXX Maybe non-portable */
+	if (volume_set_id[0] == 0) {
+		volume_set_id[0] = tv_begun.tv_sec;
+		volume_set_id[1] = (unsigned)tv_begun.tv_usec;
+	}

 	memset(buf, 0, sizeof (buf));
 	set_primary_vol_desc(buf, last_extent_written++);
--- cdrtools-3.01.orig/mkisofs/mkisofs.c	2015-01-01 14:19:51.000000000 +0000
+++ cdrtools-3.01/mkisofs/mkisofs.c
@@ -69 +69 @@ int		path_ind;
-char	version_string[] = VERSION;
+char	version_string[] = "3.01-fix-20151126";


code:
Disable CPU optimizations not supported by all x86_64 systems.

--- a/cmake/modules/SIMDExt.cmake	2017-03-23 22:22:58.254071694 +0100
+++ b/cmake/modules/SIMDExt.cmake	2017-03-23 22:23:22.446848845 +0100
@@ -5,11 +5,6 @@
 # HAVE_ARM_NEON
 # HAVE_INTEL_SSE
 # HAVE_INTEL_SSE2
-# HAVE_INTEL_SSE3
-# HAVE_INTEL_SSSE3
-# HAVE_INTEL_PCLMUL
-# HAVE_INTEL_SSE4_1
-# HAVE_INTEL_SSE4_2
 #
 # SIMD_COMPILE_FLAGS
 #
@@ -85,26 +80,6 @@
       if(HAVE_INTEL_SSE2)
         set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse2")
       endif()
-      CHECK_C_COMPILER_FLAG(-msse3 HAVE_INTEL_SSE3)
-      if(HAVE_INTEL_SSE3)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse3")
-      endif()
-      CHECK_C_COMPILER_FLAG(-mssse3 HAVE_INTEL_SSSE3)
-      if(HAVE_INTEL_SSSE3)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mssse3")
-      endif()
-      CHECK_C_COMPILER_FLAG(-mpclmul HAVE_INTEL_PCLMUL)
-      if(HAVE_INTEL_PCLMUL)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mpclmul")
-      endif()
-      CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_INTEL_SSE4_1)
-      if(HAVE_INTEL_SSE4_1)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.1")
-      endif()
-      CHECK_C_COMPILER_FLAG(-msse4.2 HAVE_INTEL_SSE4_2)
-      if(HAVE_INTEL_SSE4_2)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.2")
-      endif()
     endif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
   endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686|amd64|x86_64|AMD64")
 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64le")

license: mit


code:
Fix compatibility with newer versions of RocksDB.

Adapted from this upstream patch, with some additional changes for 12.2:
https://github.com/ceph/ceph/commit/9d73a7121fdb1ae87cb1aa6f7d9d7a13f329ae68

diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc
index 8660afe1886d..bc0de79e23cb 100644
--- a/src/kv/RocksDBStore.cc
+++ b/src/kv/RocksDBStore.cc
@@ -505,7 +505,7 @@
   // considering performance overhead, default is disabled
   if (g_conf->rocksdb_perf) {
     rocksdb::SetPerfLevel(rocksdb::PerfLevel::kEnableTimeExceptForMutex);
-    rocksdb::perf_context.Reset();
+    rocksdb::get_perf_context()->Reset();
   }

   RocksDBTransactionImpl * _t =
@@ -532,13 +532,13 @@
     utime_t write_wal_time;
     utime_t write_pre_and_post_process_time;
     write_wal_time.set_from_double(
-	static_cast<double>(rocksdb::perf_context.write_wal_time)/1000000000);
+	static_cast<double>(rocksdb::get_perf_context()->write_wal_time)/1000000000);
     write_memtable_time.set_from_double(
-	static_cast<double>(rocksdb::perf_context.write_memtable_time)/1000000000);
+	static_cast<double>(rocksdb::get_perf_context()->write_memtable_time)/1000000000);
     write_delay_time.set_from_double(
-	static_cast<double>(rocksdb::perf_context.write_delay_time)/1000000000);
+	static_cast<double>(rocksdb::get_perf_context()->write_delay_time)/1000000000);
     write_pre_and_post_process_time.set_from_double(
-	static_cast<double>(rocksdb::perf_context.write_pre_and_post_process_time)/1000000000);
+	static_cast<double>(rocksdb::get_perf_context()->write_pre_and_post_process_time)/1000000000);
     logger->tinc(l_rocksdb_write_memtable_time, write_memtable_time);
     logger->tinc(l_rocksdb_write_delay_time, write_delay_time);
     logger->tinc(l_rocksdb_write_wal_time, write_wal_time);
@@ -558,7 +558,7 @@
   // considering performance overhead, default is disabled
   if (g_conf->rocksdb_perf) {
     rocksdb::SetPerfLevel(rocksdb::PerfLevel::kEnableTimeExceptForMutex);
-    rocksdb::perf_context.Reset();
+    rocksdb::get_perf_context()->Reset();
   }

   RocksDBTransactionImpl * _t =
@@ -586,13 +586,13 @@
     utime_t write_wal_time;
     utime_t write_pre_and_post_process_time;
     write_wal_time.set_from_double(
-	static_cast<double>(rocksdb::perf_context.write_wal_time)/1000000000);
+	static_cast<double>(rocksdb::get_perf_context()->write_wal_time)/1000000000);
     write_memtable_time.set_from_double(
-	static_cast<double>(rocksdb::perf_context.write_memtable_time)/1000000000);
+	static_cast<double>(rocksdb::get_perf_context()->write_memtable_time)/1000000000);
     write_delay_time.set_from_double(
-	static_cast<double>(rocksdb::perf_context.write_delay_time)/1000000000);
+	static_cast<double>(rocksdb::get_perf_context()->write_delay_time)/1000000000);
     write_pre_and_post_process_time.set_from_double(
-	static_cast<double>(rocksdb::perf_context.write_pre_and_post_process_time)/1000000000);
+	static_cast<double>(rocksdb::get_perf_context()->write_pre_and_post_process_time)/1000000000);
     logger->tinc(l_rocksdb_write_memtable_time, write_memtable_time);
     logger->tinc(l_rocksdb_write_delay_time, write_delay_time);
     logger->tinc(l_rocksdb_write_wal_time, write_wal_time);


code:
This test fails because /etc/os-release is not available.

diff --git a/src/test/common/test_util.cc b/src/test/common/test_util.cc
index 64eace923c..6daf4aa514 100644
--- a/src/test/common/test_util.cc
+++ b/src/test/common/test_util.cc
@@ -32,17 +32,3 @@ TEST(util, unit_to_bytesize)
   ASSERT_EQ(65536ll, unit_to_bytesize(" 64K", &cerr));
 }

-#if defined(__linux__)
-TEST(util, collect_sys_info)
-{
-  map<string, string> sys_info;
-
-  CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_CLIENT))->get();
-  collect_sys_info(&sys_info, cct);
-
-  ASSERT_TRUE(sys_info.find("distro") != sys_info.end());
-  ASSERT_TRUE(sys_info.find("distro_description") != sys_info.end());
-
-  cct->put();
-}
-#endif


code:
This test tries to walk a sysfs path and hits a null pointer exception.

/tmp/guix-build-ceph-12.0.0.drv-0/ceph-12.0.0/src/test/common/test_blkdev.cc:32: Failure
Expected: (dir) != (nullptr), actual: NULL vs 8-byte object <00-00 00-00 00-00 00-00>

diff --git a/src/test/common/CMakeLists.txt b/src/test/common/CMakeLists.txt
index 5172663898..ac84085eaa 100644
--- a/src/test/common/CMakeLists.txt
+++ b/src/test/common/CMakeLists.txt
@@ -12,15 +12,6 @@ target_link_libraries(get_command_descriptions
   ${CMAKE_DL_LIBS}
   )

-if(HAVE_BLKID)
-# unittest_blkdev
-add_executable(unittest_blkdev
-  test_blkdev.cc
-  )
-add_ceph_unittest(unittest_blkdev ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_blkdev)
-target_link_libraries(unittest_blkdev global ${BLKID_LIBRARIES})
-endif(HAVE_BLKID)
-
 # unittest_bloom_filter
 add_executable(unittest_bloom_filter
   test_bloom_filter.cc
--
2.11.1


code:
Taken from Debian, necessary for compilation on mips.

Patch to fix integer types problem by Goswin von Brederlow
<brederlo@informatik.uni-tuebingen.de> (#258444)
--- chmlib-0.39.orig/src/chm_lib.c
+++ chmlib-0.39/src/chm_lib.c
@@ -56,6 +56,7 @@

 #include "lzx.h"

+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #ifdef CHM_DEBUG
@@ -149,22 +150,9 @@
 typedef __int64                 Int64;
 typedef unsigned __int64        UInt64;

-/* I386, 32-bit, non-Windows */
-/* Sparc        */
-/* MIPS         */
-/* PPC          */
-#elif __i386__ || __sun || __sgi || __ppc__
-typedef unsigned char           UChar;
-typedef short                   Int16;
-typedef unsigned short          UInt16;
-typedef long                    Int32;
-typedef unsigned long           UInt32;
-typedef long long               Int64;
-typedef unsigned long long      UInt64;
-
 /* x86-64 */
 /* Note that these may be appropriate for other 64-bit machines. */
-#elif __x86_64__ || __ia64__
+#elif defined(__LP64__)
 typedef unsigned char           UChar;
 typedef short                   Int16;
 typedef unsigned short          UInt16;
@@ -173,10 +161,18 @@
 typedef long                    Int64;
 typedef unsigned long           UInt64;

+/* I386, 32-bit, non-Windows */
+/* Sparc        */
+/* MIPS         */
+/* PPC          */
 #else
-
-/* yielding an error is preferable to yielding incorrect behavior */
-#error "Please define the sized types for your platform in chm_lib.c"
+typedef unsigned char           UChar;
+typedef short                   Int16;
+typedef unsigned short          UInt16;
+typedef long                    Int32;
+typedef unsigned long           UInt32;
+typedef long long               Int64;
+typedef unsigned long long      UInt64;
 #endif

 /* GCC */


code:
Clang attempts to guess file names based on the OS and distro (yes!),
but unfortunately, that doesn't work for us.

This patch makes it easy to insert libc's $libdir so that Clang passes the
correct absolute file name of crt1.o etc. to 'ld'.  It also disables all
the distro-specific stuff and removes the hard-coded FHS directory names
to make sure Clang also works on non-GuixSD systems.

--- cfe-3.6.0.src/lib/Driver/ToolChains.cpp	2015-02-18 22:03:07.000000000 +0100
+++ cfe-3.6.0.src/lib/Driver/ToolChains.cpp	2015-06-19 16:37:20.459701044 +0200
@@ -2931,6 +2931,9 @@ Linux::Linux(const Driver &D, const llvm

   Linker = GetLinkerPath();

+  // Comment out the distro-specific tweaks so that they don't bite when
+  // using Guix on a foreign distro.
+#if 0
   Distro Distro = DetectDistro(Arch);

   if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) {
@@ -2973,6 +2976,7 @@ Linux::Linux(const Driver &D, const llvm

   if (IsOpenSUSE(Distro))
     ExtraOpts.push_back("--enable-new-dtags");
+#endif

   // The selection of paths to try here is designed to match the patterns which
   // the GCC driver itself uses, as this is part of the GCC-compatible driver.
@@ -3043,14 +3047,12 @@ Linux::Linux(const Driver &D, const llvm
     addPathIfExists(D.Dir + "/../" + OSLibDir, Paths);
   }

-  addPathIfExists(SysRoot + "/lib/" + MultiarchTriple, Paths);
-  addPathIfExists(SysRoot + "/lib/../" + OSLibDir, Paths);
-  addPathIfExists(SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
-  addPathIfExists(SysRoot + "/usr/lib/../" + OSLibDir, Paths);
-
   // Try walking via the GCC triple path in case of biarch or multiarch GCC
   // installations with strange symlinks.
   if (GCCInstallation.isValid()) {
+    // The following code would end up adding things like
+    // "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
+#if 0
     addPathIfExists(SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
                     "/../../" + OSLibDir, Paths);

@@ -3060,6 +3062,7 @@ Linux::Linux(const Driver &D, const llvm
       addPathIfExists(GCCInstallation.getInstallPath() +
                       BiarchSibling.gccSuffix(), Paths);
     }
+#endif

     // See comments above on the multilib variant for details of why this is
     // included even from outside the sysroot.
@@ -3083,8 +3086,9 @@ Linux::Linux(const Driver &D, const llvm
   if (StringRef(D.Dir).startswith(SysRoot))
     addPathIfExists(D.Dir + "/../lib", Paths);

-  addPathIfExists(SysRoot + "/lib", Paths);
-  addPathIfExists(SysRoot + "/usr/lib", Paths);
+  // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
+  // and friends can be found.
+  addPathIfExists("@GLIBC_LIBDIR@", Paths);
 }

 bool Linux::HasNativeLLVMSupport() const {


code:
Clang attempts to guess file names based on the OS and distro (yes!),
but unfortunately, that doesn't work for us.

This patch makes it easy to insert libc's $libdir so that Clang passes the
correct absolute file name of crt1.o etc. to 'ld'.  It also disables all
the distro-specific stuff and removes the hard-coded FHS directory names
to make sure Clang also works on non-GuixSD systems.

This patch makes slight adjustments over "clang-libc-search-path.patch" for
changes in clang 3.8.

--- cfe-3.8.0.src/lib/Driver/ToolChains.cpp
+++ cfe-3.8.0.src/lib/Driver/ToolChains.cpp
@@ -3661,6 +3661,9 @@
                          GCCInstallation.getTriple().str() + "/bin")
                        .str());

+  // Comment out the distro-specific tweaks so that they don't bite when
+  // using Guix on a foreign distro.
+#if 0
   Distro Distro = DetectDistro(D, Arch);

   if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) {
@@ -3702,6 +3705,7 @@

   if (IsOpenSUSE(Distro))
     ExtraOpts.push_back("--enable-new-dtags");
+#endif

   // The selection of paths to try here is designed to match the patterns which
   // the GCC driver itself uses, as this is part of the GCC-compatible driver.
@@ -3771,14 +3775,12 @@
     addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);
   }

-  addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
-  addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
-
   // Try walking via the GCC triple path in case of biarch or multiarch GCC
   // installations with strange symlinks.
   if (GCCInstallation.isValid()) {
+    // The following code would end up adding things like
+    // "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
+#if 0
     addPathIfExists(D,
                     SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
                         "/../../" + OSLibDir,
@@ -3791,6 +3793,7 @@
                              BiarchSibling.gccSuffix(),
                       Paths);
     }
+#endif

     // See comments above on the multilib variant for details of why this is
     // included even from outside the sysroot.
@@ -3815,8 +3818,9 @@
   if (StringRef(D.Dir).startswith(SysRoot))
     addPathIfExists(D, D.Dir + "/../lib", Paths);

-  addPathIfExists(D, SysRoot + "/lib", Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib", Paths);
+  // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
+  // and friends can be found.
+  addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
 }

 bool Linux::HasNativeLLVMSupport() const { return true; }


code:
Clang attempts to guess file names based on the OS and distro (yes!),
but unfortunately, that doesn't work for us.

This patch makes it easy to insert libc's $libdir so that Clang passes the
correct absolute file name of crt1.o etc. to 'ld'.  It also disables all
the distro-specific stuff and removes the hard-coded FHS directory names
to make sure Clang also works on non-GuixSD systems.

--- cfe-6.0.0.src/lib/Driver/ToolChains/Linux.cpp
+++ cfe-6.0.0.src/lib/Driver/ToolChains/Linux.cpp
@@ -207,7 +207,9 @@
   PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" +
                          GCCInstallation.getTriple().str() + "/bin")
                        .str());
-
+  // Comment out the distro-specific tweaks so that they don't bite when
+  // using Guix on a foreign distro.
+#if 0
   Distro Distro(D.getVFS());

   if (Distro.IsAlpineLinux()) {
@@ -255,6 +257,7 @@

   if (IsAndroid || Distro.IsOpenSUSE())
     ExtraOpts.push_back("--enable-new-dtags");
+#endif

   // The selection of paths to try here is designed to match the patterns which
   // the GCC driver itself uses, as this is part of the GCC-compatible driver.
@@ -329,14 +332,12 @@
     addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);
   }

-  addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
-  addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
-
   // Try walking via the GCC triple path in case of biarch or multiarch GCC
   // installations with strange symlinks.
   if (GCCInstallation.isValid()) {
+    // The following code would end up adding things like
+    // "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
+#if 0
     addPathIfExists(D,
                     SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
                         "/../../" + OSLibDir,
@@ -349,6 +350,7 @@
                              BiarchSibling.gccSuffix(),
                       Paths);
     }
+#endif

     // See comments above on the multilib variant for details of why this is
     // included even from outside the sysroot.
@@ -373,8 +375,9 @@
   if (StringRef(D.Dir).startswith(SysRoot))
     addPathIfExists(D, D.Dir + "/../lib", Paths);

-  addPathIfExists(D, SysRoot + "/lib", Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib", Paths);
+  // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
+  // and friends can be found.
+  addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
 }

 bool Linux::HasNativeLLVMSupport() const { return true; }


code:
This patch works around build issues in libsanitizer.  Note that we carry the
same patches for GCC since it includes the same libsanitizer.

Work around this build error on glibc 2.26:

  /tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/asan/asan_linux.cc: In function 'bool __asan::AsanInterceptsSignal(int)':
  /tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/asan/asan_linux.cc:224:20: error: 'SIGSEGV' was not declared in this scope

diff --git a/libsanitizer/asan/asan_linux.cc b/libsanitizer/asan/asan_linux.cc
index c504168..59087b9 100644
--- a/lib/asan/asan_linux.cc
+++ b/lib/asan/asan_linux.cc
@@ -29,6 +29,7 @@
 #include <dlfcn.h>
 #include <fcntl.h>
 #include <pthread.h>
+#include <signal.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <unwind.h>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now, work around this other error:

  /tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: In function 'int __sanitizer::TracerThread(void*)':
  /tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:239:22: error: aggregate 'sigaltstack handler_stack' has incomplete type and cannot be defined

diff --git a/lib/sanitizer_common/sanitizer_linux.cc b/lib/sanitizer_common/sanitizer_linux.cc
index 2cefa20..223d9c6 100644
--- a/lib/sanitizer_common/sanitizer_linux.cc
+++ b/lib/sanitizer_common/sanitizer_linux.cc
@@ -546,8 +546,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
 }
 #endif

-uptr internal_sigaltstack(const struct sigaltstack *ss,
-                         struct sigaltstack *oss) {
+uptr internal_sigaltstack(const void *ss, void *oss) {
   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
 }

diff --git a/lib/sanitizer_common/sanitizer_linux.h b/lib/sanitizer_common/sanitizer_linux.h
index 4497702..1594058 100644
--- a/lib/sanitizer_common/sanitizer_linux.h
+++ b/lib/sanitizer_common/sanitizer_linux.h
@@ -19,7 +19,6 @@
 #include "sanitizer_platform_limits_posix.h"

 struct link_map;  // Opaque type returned by dlopen().
-struct sigaltstack;

 namespace __sanitizer {
 // Dirent structure for getdents(). Note that this structure is different from
@@ -28,8 +27,7 @@ struct linux_dirent;

 // Syscall wrappers.
 uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
-uptr internal_sigaltstack(const struct sigaltstack* ss,
-                          struct sigaltstack* oss);
+uptr internal_sigaltstack(const void* ss, void* oss);
 uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
     __sanitizer_sigset_t *oldset);
 void internal_sigfillset(__sanitizer_sigset_t *set);
diff --git a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
index c919e4f..014162af 100644
--- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -267,7 +267,7 @@ static int TracerThread(void* argument) {

   // Alternate stack for signal handling.
   InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
-  struct sigaltstack handler_stack;
+  stack_t handler_stack;
   internal_memset(&handler_stack, 0, sizeof(handler_stack));
   handler_stack.ss_sp = handler_stack_memory.data();
   handler_stack.ss_size = kHandlerStackSize;
diff --git a/lib/tsan/tsan_platform_linux.cc b/lib/tsan/tsan_platform_linux.cc
index 09cec5f..908f4fe 100644
--- a/lib/tsan/rtl/tsan_platform_linux.cc
+++ b/lib/tsan/rtl/tsan_platform_linux.cc
@@ -291,7 +291,7 @@ bool IsGlobalVar(uptr addr) {
 int ExtractResolvFDs(void *state, int *fds, int nfd) {
 #if SANITIZER_LINUX
   int cnt = 0;
-  __res_state *statp = (__res_state*)state;
+  struct __res_state *statp = (struct __res_state*)state;
   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
     if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
       fds[cnt++] = statp->_u._ext.nssocks[i];
--
2.9.3


code:
Fix esan compilation against glibc 2.26:

  /tmp/guix-build-clang-runtime-3.9.1.drv-0/compiler-rt-3.9.1.src/lib/esan/esan_sideline_linux.cpp: In static member function ‘static int __esan::SidelineThread::runSideline(void*)’:
  /tmp/guix-build-clang-runtime-3.9.1.drv-0/compiler-rt-3.9.1.src/lib/esan/esan_sideline_linux.cpp:73:22: error: aggregate ‘__esan::SidelineThread::runSideline(void*)::sigaltstack SigAltStack’ has incomplete type and cannot be defined

Patch from <https://github.com/google/sanitizers/issues/822>.

index d04f5909d..bc272dfe4 100644
--- a/lib/esan/esan_sideline_linux.cpp
+++ b/lib/esan/esan_sideline_linux.cpp
@@ -70,7 +70,7 @@ int SidelineThread::runSideline(void *Arg) {

   // Set up a signal handler on an alternate stack for safety.
   InternalScopedBuffer<char> StackMap(SigAltStackSize);
-  struct sigaltstack SigAltStack;
+  stack_t SigAltStack;
   SigAltStack.ss_sp = StackMap.data();
   SigAltStack.ss_size = SigAltStackSize;
   SigAltStack.ss_flags = 0;


code:
This is modeled after the ia64 support. Aarch64 can be either big endian
or little endian, so we add the case for both.

---
 native/fdlibm/ieeefp.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/native/fdlibm/ieeefp.h b/native/fdlibm/ieeefp.h
index 1a9740f..73455c0 100644
--- a/native/fdlibm/ieeefp.h
+++ b/native/fdlibm/ieeefp.h
@@ -27,6 +27,14 @@
 #endif
 #endif

+#ifdef __aarch64__
+#ifdef __BIG_ENDIAN__
+#define __IEEE_BIG_ENDIAN
+#else
+#define __IEEE_LITTLE_ENDIAN
+#endif
+#endif
+
 #ifdef __hppa__
 #define __IEEE_BIG_ENDIAN
 #endif
--
2.16.3


code:
Patch downloaded from https://github.com/clementine-player/Clementine/pull/5669 .

diff -ruN clementine-1.3.1.565.gd20c2244a.orig/src/core/database.cpp clementine-1.3.1.565.gd20c2244a/src/core/database.cpp
--- clementine-1.3.1.565.gd20c2244a.orig/src/core/database.cpp	2018-07-07 23:59:24.018540126 +0200
+++ clementine-1.3.1.565.gd20c2244a/src/core/database.cpp	2018-07-08 00:04:47.991551728 +0200
@@ -265,6 +265,17 @@
   StaticInit();

   {
+
+#ifdef SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
+    // In case sqlite>=3.12 is compiled without -DSQLITE_ENABLE_FTS3_TOKENIZER
+    // (generally a good idea  due to security reasons) the fts3 support should be enabled explicitly.
+    QVariant v = db.driver()->handle();
+    if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0) {
+      sqlite3 *handle = *static_cast<sqlite3**>(v.data());
+      if (handle) sqlite3_db_config(handle, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, NULL);
+    }
+#endif
+
     QSqlQuery set_fts_tokenizer(db);
     set_fts_tokenizer.prepare("SELECT fts3_tokenizer(:name, :pointer)");
     set_fts_tokenizer.bindValue(":name", "unicode");


code:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3202b8b..473ecb9 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -279,14 +279,6 @@ optional_component(LIBPULSE ON "Pulse audio integration"

 optional_component(VISUALISATIONS ON "Visualisations")

-if(NOT HAVE_SPOTIFY_BLOB AND NOT CRYPTOPP_FOUND)
-  message(FATAL_ERROR "Either crypto++ must be available or the non-GPL Spotify "
-          "code must be compiled in")
-elseif(CRYPTOPP_FOUND)
-  set(HAVE_CRYPTOPP ON)
-  set(HAVE_SPOTIFY_DOWNLOADER ON)
-endif()
-
 # Find DBus if it's enabled
 if (HAVE_DBUS)
   find_package(Qt5 COMPONENTS DBus)


code:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4022c383b..3202b8b69 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,6 +83,7 @@ pkg_check_modules(LIBPULSE libpulse)
 pkg_check_modules(LIBXML libxml-2.0)
 pkg_check_modules(SPOTIFY libspotify>=12.1.45)
 pkg_check_modules(TAGLIB REQUIRED taglib>=1.6)
+pkg_check_modules(OPENSSL REQUIRED openssl)

 if (WIN32)
   find_package(ZLIB REQUIRED)
@@ -381,20 +382,6 @@ if(GMOCK_INCLUDE_DIRS)
   endif(GTEST_INCLUDE_DIRS)
 endif(GMOCK_INCLUDE_DIRS)

-# Use the system's sha2 if it's available.
-find_path(SHA2_INCLUDE_DIRS sha2.h)
-find_library(SHA2_LIBRARIES sha2)
-if(SHA2_LIBRARIES AND SHA2_INCLUDE_DIRS)
-  message(STATUS "Using system sha2 library")
-  set(USE_SYSTEM_SHA2 ON)
-else()
-  message(STATUS "Using builtin sha2 library")
-  set(USE_SYSTEM_SHA2 OFF)
-  add_subdirectory(3rdparty/sha2)
-  set(SHA2_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/sha2)
-  set(SHA2_LIBRARIES sha2)
-endif()
-
 # Use the system libmygpo-qt5 if a recent enough version was found
 if(LIBMYGPO_QT5_FOUND)
   set(MYGPOQT5_LIBRARIES ${LIBMYGPO_QT5_LIBRARIES})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6e24c9726..104d044d9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -29,7 +29,6 @@ include_directories(${LIBPROJECTM_INCLUDE_DIRS})
 include_directories(${QTSINGLEAPPLICATION_INCLUDE_DIRS})
 include_directories(${QTIOCOMPRESSOR_INCLUDE_DIRS})
 include_directories(${QXT_INCLUDE_DIRS})
-include_directories(${SHA2_INCLUDE_DIRS})
 include_directories(${CHROMAPRINT_INCLUDE_DIRS})
 include_directories(${MYGPOQT5_INCLUDE_DIRS})

@@ -1223,7 +1222,7 @@ target_link_libraries(clementine_lib
   libclementine-common
   libclementine-tagreader
   libclementine-remote
-  ${SHA2_LIBRARIES}
+  ${OPENSSL_LIBRARIES}
   ${TAGLIB_LIBRARIES}
   ${MYGPOQT5_LIBRARIES}
   ${CHROMAPRINT_LIBRARIES}
diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp
index ce76f22da..80bf623fb 100644
--- a/src/core/utilities.cpp
+++ b/src/core/utilities.cpp
@@ -52,7 +52,7 @@
 #include "config.h"
 #include "timeconstants.h"

-#include "sha2.h"
+#include <openssl/sha.h>

 #if defined(Q_OS_UNIX)
 #include <sys/statvfs.h>


code:
This test doesn't ever complete or timeout

---
 tests/socket.tst | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/tests/socket.tst b/tests/socket.tst
index 93c6310..1d976ff 100644
--- a/tests/socket.tst
+++ b/tests/socket.tst
@@ -551,30 +551,6 @@ T
           interfaces))
 ("0.0.0.0" "127.0.0.1" "0.0.0.0" "127.0.0.1")

-(multiple-value-bind (run args) (cmd-args)
-  (let ((se (socket:socket-server)))
-    (ext:run-program run :arguments (append args (list "-q" "-q" "-x" (format nil "(close (socket:socket-connect ~D))" (socket:socket-server-port se))))
-                     :wait nil :input nil :output nil)
-    (unwind-protect
-         (with-open-stream (so (socket:socket-accept se))
-           (list
-            (socket:socket-status so)
-            (write-line "foo" so)
-            (socket:socket-status so)
-            #+macos (handler-case (read-char so)
-                      (end-of-file (c)
-                        (princ 'read-char) (princ-error c) t))
-            #-macos (check-os-error (read-char so) (:ECONNRESET 104))
-            (null (member (socket:socket-status so) '(:EOF :APPEND)))
-            #+macos (string= (write-line "bar" so) "bar")
-            #-macos (check-os-error (write-line "bar" so) (:EPIPE 32))
-            (null (member (socket:socket-status so) '(:EOF :APPEND)))
-            (handler-case (read-char so)
-              (end-of-file (c)
-                (princ 'read-char) (princ-error c) 'end-of-file))))
-      (socket:socket-server-close se))))
-(:OUTPUT "foo" :OUTPUT T NIL T NIL END-OF-FILE)
-
 ;; https://sourceforge.net/p/clisp/feature-requests/46/
 (check-os-error (socket:socket-connect 0)
   #-(or win32 macos) (:ECONNREFUSED 111)
--


code:
# Source: http://sourceforge.net/p/clucene/bugs/200/
diff -NaurpBb clucene-core-2.3.3.4/CMakeLists.txt clucene-core-2.3.3.4-mod/CMakeLists.txt
--- clucene-core-2.3.3.4/CMakeLists.txt	2011-03-17 03:21:07.000000000 +0300
+++ clucene-core-2.3.3.4-mod/CMakeLists.txt	2011-08-16 16:56:55.968268152 +0400
@@ -163,7 +163,7 @@ IF ( BUILD_CONTRIBS )
   SET(BUILD_CONTRIBS_LIB 1)
 ENDIF ( BUILD_CONTRIBS )
 IF ( BUILD_CONTRIBS_LIB )
-  ADD_SUBDIRECTORY (src/contribs-lib EXCLUDE_FROM_ALL)
+  ADD_SUBDIRECTORY (src/contribs-lib)
 ENDIF ( BUILD_CONTRIBS_LIB )

diff -NaurpBb clucene-core-2.3.3.4/src/contribs-lib/CMakeLists.txt clucene-core-2.3.3.4-mod/src/contribs-lib/CMakeLists.txt
--- clucene-core-2.3.3.4/src/contribs-lib/CMakeLists.txt	2011-03-17 03:21:07.000000000 +0300
+++ clucene-core-2.3.3.4-mod/src/contribs-lib/CMakeLists.txt	2011-08-16 17:14:13.499275499 +0400
@@ -106,9 +106,26 @@ add_library(clucene-contribs-lib SHARED
 )
 TARGET_LINK_LIBRARIES(clucene-contribs-lib ${clucene_contrib_extra_libs})

+#install public headers.
+FOREACH(file ${HEADERS})
+	get_filename_component(apath ${file} PATH)
+	get_filename_component(aname ${file} NAME)
+	file(RELATIVE_PATH relpath ${CMAKE_SOURCE_DIR}/src/contribs-lib ${apath})
+	IF ( NOT aname MATCHES "^_.*" )
+		install(FILES ${file}
+		        DESTINATION include/${relpath}
+		        COMPONENT development)
+	ENDIF ( NOT aname MATCHES "^_.*" )
+ENDFOREACH(file)
+
 #set properties on the libraries
 SET_TARGET_PROPERTIES(clucene-contribs-lib PROPERTIES
     VERSION ${CLUCENE_VERSION}
     SOVERSION ${CLUCENE_SOVERSION}
     COMPILE_DEFINITIONS_DEBUG _DEBUG
 )
+
+#and install library
+install(TARGETS clucene-contribs-lib
+        DESTINATION ${LIB_DESTINATION}
+        COMPONENT runtime )


code:
Taken from the Debian package.

From 7be4a19b76d98260cf95040a47935f854a4ba7a4 Mon Sep 17 00:00:00 2001
From: Valentin Rusu <kde@rusu.info>
Date: Sat, 17 Dec 2011 13:47:58 +0100
Subject: [PATCH] Fix .pc file by adding clucene-shared library

---
 src/core/libclucene-core.pc.cmake |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/src/core/libclucene-core.pc.cmake
+++ b/src/core/libclucene-core.pc.cmake
@@ -6,6 +6,6 @@ includedir=${prefix}/include:${prefix}/i
 Name: libclucene
 Description: CLucene - a C++ search engine, ported from the popular Apache Lucene
 Version: @CLUCENE_VERSION_MAJOR@.@CLUCENE_VERSION_MINOR@.@CLUCENE_VERSION_REVISION@.@CLUCENE_VERSION_PATCH@
-Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core
+Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core -lclucene-shared
 Cflags: -I${prefix}/include -I${prefix}/include/CLucene/ext
 ~


code:
--- a/clx.asd	2016-02-16 00:06:48.161596976 -0500
+++ b/clx.asd	2016-02-16 00:06:54.793774658 -0500
@@ -79,24 +79,6 @@
                (:file "xtest")
                (:file "screensaver")
                (:file "xinerama")))
-     (:module demo
-	      :default-component-class example-source-file
-	      :components
-	      ((:file "bezier")
-	       ;; KLUDGE: this requires "bezier" for proper operation,
-	       ;; but we don't declare that dependency here, because
-	       ;; asdf doesn't load example files anyway.
-	       (:file "beziertest")
-	       (:file "clclock")
-               (:file "clipboard")
-	       (:file "clx-demos")
-	       (:file "gl-test")
-	       ;; FIXME: compiling this generates 30-odd spurious code
-	       ;; deletion notes.  Find out why, and either fix or
-	       ;; workaround the problem.
-	       (:file "mandel")
-	       (:file "menu")
-	       (:file "zoid")))
      (:module test
 	      :default-component-class example-source-file
 	      :components


code:
Remove dependencies on bundled zlib, pcre and expat.

diff --git a/Makefile.in b/Makefile.in
index 4360a26..80f9f59 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -210,8 +210,7 @@ coda_matlab_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
 @BUILD_MATLAB_TRUE@@SUBPACKAGE_MODE_FALSE@	-rpath \
 @BUILD_MATLAB_TRUE@@SUBPACKAGE_MODE_FALSE@	$(matlabmexexecdir)
 am__DEPENDENCIES_1 =
-libcoda_la_DEPENDENCIES = @LTLIBOBJS@ libexpat_internal.la \
-	libpcre_internal.la libz_internal.la $(am__DEPENDENCIES_1) \
+libcoda_la_DEPENDENCIES = @LTLIBOBJS@ $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
 am__libcoda_la_SOURCES_DIST = libcoda/coda-ascbin-cursor.c \
 	libcoda/coda-ascbin.h libcoda/coda-ascii-cursor.c \
@@ -306,8 +305,7 @@ libcoda_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(libcoda_la_LDFLAGS) $(LDFLAGS) -o $@
 @SUBPACKAGE_MODE_FALSE@am_libcoda_la_rpath = -rpath $(libdir)
-am__DEPENDENCIES_2 = @LTLIBOBJS@ libexpat_internal.la \
-	libpcre_internal.la libz_internal.la $(am__DEPENDENCIES_1) \
+am__DEPENDENCIES_2 = @LTLIBOBJS@ $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
 libcoda_internal_la_DEPENDENCIES = $(am__DEPENDENCIES_2)
 am__libcoda_internal_la_SOURCES_DIST = libcoda/coda-ascbin-cursor.c \
@@ -898,8 +896,8 @@ INSTALL_DATA_HOOK_TARGETS = $(am__append_1)
 UNINSTALL_HOOK_TARGETS =
 CLEAN_LOCAL_TARGETS = $(am__append_11)
 ALL_LOCAL_TARGETS =
-@SUBPACKAGE_MODE_FALSE@noinst_LTLIBRARIES = libcoda_internal.la libexpat_internal.la libpcre_internal.la libz_internal.la
-@SUBPACKAGE_MODE_TRUE@noinst_LTLIBRARIES = libcoda_internal.la libexpat_internal.la libpcre_internal.la libz_internal.la
+@SUBPACKAGE_MODE_FALSE@noinst_LTLIBRARIES = libcoda_internal.la
+@SUBPACKAGE_MODE_TRUE@noinst_LTLIBRARIES = libcoda_internal.la

 # libraries (+ related files)
 @SUBPACKAGE_MODE_FALSE@lib_LTLIBRARIES = libcoda.la
@@ -1048,7 +1046,7 @@ libcoda_hdf5_files = \

 libcoda_la_CPPFLAGS = -Ilibcoda/expat -I$(srcdir)/libcoda/expat -Ilibcoda/pcre -I$(srcdir)/libcoda/pcre -Ilibcoda/zlib -I$(srcdir)/libcoda/zlib $(AM_CPPFLAGS)
 libcoda_la_LDFLAGS = -no-undefined -version-info $(LIBCODA_CURRENT):$(LIBCODA_REVISION):$(LIBCODA_AGE)
-libcoda_la_LIBADD = @LTLIBOBJS@ libexpat_internal.la libpcre_internal.la libz_internal.la $(HDF4LIBS) $(HDF5LIBS)
+libcoda_la_LIBADD = @LTLIBOBJS@ $(HDF4LIBS) $(HDF5LIBS)
 libcoda_internal_la_SOURCES = libcoda/coda-ascbin-cursor.c \
 	libcoda/coda-ascbin.h libcoda/coda-ascii-cursor.c \
 	libcoda/coda-ascii-internal.h libcoda/coda-ascii.c \


code:
From 126a97d1f22f7d784d392b2b7d5aadf0a4e18c0d Mon Sep 17 00:00:00 2001
From: Petter <petter@mykolab.ch>
Date: Thu, 27 Apr 2017 20:28:02 +0200
Subject: [PATCH] Avoid checking uninitialized member + simplify condition

---
 qmltermwidget/lib/TerminalDisplay.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qmltermwidget/lib/TerminalDisplay.cpp b/qmltermwidget/lib/TerminalDisplay.cpp
index 189a609..36d2cd2 100644
--- a/qmltermwidget/lib/TerminalDisplay.cpp
+++ b/qmltermwidget/lib/TerminalDisplay.cpp
@@ -325,6 +325,7 @@ TerminalDisplay::TerminalDisplay(QQuickItem *parent)
 ,_terminalSizeHint(false)
 ,_terminalSizeStartup(true)
 ,_bidiEnabled(false)
+,_mouseMarks(false)
 ,_actSel(0)
 ,_wordSelectionMode(false)
 ,_lineSelectionMode(false)
@@ -1846,7 +1847,7 @@ void TerminalDisplay::mousePressEvent(QMouseEvent* ev)
   }
   else if ( ev->button() == Qt::MidButton )
   {
-    if ( _mouseMarks || (!_mouseMarks && (ev->modifiers() & Qt::ShiftModifier)) )
+    if ( _mouseMarks || (ev->modifiers() & Qt::ShiftModifier) )
       emitSelection(true,ev->modifiers() & Qt::ControlModifier);
     else
       emit mouseSignal( 1, charColumn +1, charLine +1 +_scrollBar->value() -_scrollBar->maximum() , 0);
--
2.12.2


code:
From c91d7ae5dbb00c8392a9f93283dc56c3e296cccd Mon Sep 17 00:00:00 2001
From: Petter <petter@mykolab.ch>
Date: Thu, 27 Apr 2017 20:19:21 +0200
Subject: [PATCH] Fix size of the array passed to memset()

---
 qmltermwidget/lib/History.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qmltermwidget/lib/History.cpp b/qmltermwidget/lib/History.cpp
index 0f9c13f..ab6f7be 100644
--- a/qmltermwidget/lib/History.cpp
+++ b/qmltermwidget/lib/History.cpp
@@ -515,7 +515,7 @@ void HistoryScrollBlockArray::addCells(const Character a[], int count)
   // put cells in block's data
   assert((count * sizeof(Character)) < ENTRIES);

-  memset(b->data, 0, ENTRIES);
+  memset(b->data, 0, sizeof(b->data));

   memcpy(b->data, a, count * sizeof(Character));
   b->size = count * sizeof(Character);
--
2.12.2


code:
From 08628fda19128b75248548357e416bc373f14f91 Mon Sep 17 00:00:00 2001
From: Yen Chi Hsuan <yan12125@gmail.com>
Date: Sat, 18 Mar 2017 02:50:34 +0800
Subject: [PATCH] Fix memory leak in hotspot (URLs & emails) detection

---
 qmltermwidget/lib/Filter.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/qmltermwidget/lib/Filter.cpp b/qmltermwidget/lib/Filter.cpp
index 5ca7bee..2e8d2fb 100644
--- a/qmltermwidget/lib/Filter.cpp
+++ b/qmltermwidget/lib/Filter.cpp
@@ -26,6 +26,7 @@
 // Qt
 #include <QAction>
 #include <QApplication>
+#include <QtAlgorithms>
 #include <QClipboard>
 #include <QString>
 #include <QTextStream>
@@ -194,6 +195,7 @@ Filter::~Filter()
 }
 void Filter::reset()
 {
+    qDeleteAll(_hotspotList);
     _hotspots.clear();
     _hotspotList.clear();
 }
--
2.12.2


code:
Fix CVE-2016-2037 (out of bounds write in process_copy_in()).

Copied from upstream mailing list:
https://lists.gnu.org/archive/html/bug-cpio/2016-01/msg00005.html

---

 Other calls to cpio_safer_name_suffix seem to be safe.
 .
 * src/copyin.c (process_copy_in):  Make sure that file_hdr.c_name
 has at least two bytes allocated.
 * src/util.c (cpio_safer_name_suffix): Document that use of this
 function requires to be careful.
Author: Pavel Raiskup <praiskup@redhat.com>

---
 src/copyin.c | 2 ++
 src/util.c   | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

Index: cpio-2.11+dfsg/src/copyin.c
===================================================================
--- cpio-2.11+dfsg.orig/src/copyin.c
+++ cpio-2.11+dfsg/src/copyin.c
@@ -1433,6 +1433,8 @@ process_copy_in ()
 	  break;
 	}

+      if (file_hdr.c_namesize <= 1)
+        file_hdr.c_name = xrealloc(file_hdr.c_name, 2);
       cpio_safer_name_suffix (file_hdr.c_name, false, !no_abs_paths_flag,
 			      false);

Index: cpio-2.11+dfsg/src/util.c
===================================================================
--- cpio-2.11+dfsg.orig/src/util.c
+++ cpio-2.11+dfsg/src/util.c
@@ -1374,7 +1374,10 @@ set_file_times (int fd,
 }

 /* Do we have to ignore absolute paths, and if so, does the filename
-   have an absolute path?  */
+   have an absolute path?
+   Before calling this function make sure that the allocated NAME buffer has
+   capacity at least 2 bytes to allow us to store the "." string inside.  */
+
 void
 cpio_safer_name_suffix (char *name, bool link_target, bool absolute_names,
 			bool strip_leading_dots)


code:
Add an extra layer of quoting to ltmain.sh sanity check.

--- a/configure	2005-05-07 14:19:31.000000000 +0200
+++ b/configure	2015-02-10 11:16:32.456146934 +0100
@@ -6266,7 +6266,7 @@
   exit 1
 fi
 gentoo_lt_version="1.5.16"
-gentoo_ltmain_version=`grep '^[:space:]*VERSION=' $ltmain | sed -e 's|^[:space:]*VERSION=||'`
+gentoo_ltmain_version=`grep '^[[:space:]]*VERSION=' $ltmain | sed -e 's|^[[:space:]]*VERSION=||'`
 if test "$gentoo_lt_version" != "$gentoo_ltmain_version"; then
   echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
--- a/aclocal.m4	2005-05-07 14:19:25.000000000 +0200
+++ b/aclocal.m4	2015-02-10 11:16:15.352030318 +0100
@@ -246,7 +246,7 @@
   exit 1
 fi
 gentoo_lt_version="1.5.16"
-gentoo_ltmain_version=`grep '^[[:space:]]*VERSION=' $ltmain | sed -e 's|^[[:space:]]*VERSION=||'`
+gentoo_ltmain_version=`[grep '^[[:space:]]*VERSION=' $ltmain | sed -e 's|^[[:space:]]*VERSION=||']`
 if test "$gentoo_lt_version" != "$gentoo_ltmain_version"; then
   AC_MSG_RESULT(no)
   echo
--- a/libcpufreq/configure	2005-05-07 14:19:31.000000000 +0200
+++ b/libcpufreq/configure	2015-02-10 11:16:32.456146934 +0100
@@ -6266,7 +6266,7 @@
   exit 1
 fi
 gentoo_lt_version="1.5.16"
-gentoo_ltmain_version=`grep '^[:space:]*VERSION=' $ltmain | sed -e 's|^[:space:]*VERSION=||'`
+gentoo_ltmain_version=`grep '^[[:space:]]*VERSION=' $ltmain | sed -e 's|^[[:space:]]*VERSION=||'`
 if test "$gentoo_lt_version" != "$gentoo_ltmain_version"; then
   echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
--- a/libcpufreq/aclocal.m4	2005-05-07 14:19:25.000000000 +0200
+++ b/libcpufreq/aclocal.m4	2015-02-10 11:16:15.352030318 +0100
@@ -246,7 +246,7 @@
   exit 1
 fi
 gentoo_lt_version="1.5.16"
-gentoo_ltmain_version=`grep '^[[:space:]]*VERSION=' $ltmain | sed -e 's|^[[:space:]]*VERSION=||'`
+gentoo_ltmain_version=`[grep '^[[:space:]]*VERSION=' $ltmain | sed -e 's|^[[:space:]]*VERSION=||']`
 if test "$gentoo_lt_version" != "$gentoo_ltmain_version"; then
   AC_MSG_RESULT(no)
   echo


code:
Fix CVE-2016-6318.

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6318

Patch copied from Red Hat:

https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2016-6318
https://bugzilla.redhat.com/attachment.cgi?id=1188599&action=diff

It is not safe to pass words longer than STRINGSIZE further to cracklib
so the longbuffer cannot be longer than STRINGSIZE.
diff -up cracklib-2.9.0/lib/fascist.c.longgecos cracklib-2.9.0/lib/fascist.c
--- cracklib-2.9.0/lib/fascist.c.longgecos	2014-02-06 16:03:59.000000000 +0100
+++ cracklib-2.9.0/lib/fascist.c	2016-08-08 12:05:40.279235815 +0200
@@ -515,7 +515,7 @@ FascistGecosUser(char *password, const c
     char gbuffer[STRINGSIZE];
     char tbuffer[STRINGSIZE];
     char *uwords[STRINGSIZE];
-    char longbuffer[STRINGSIZE * 2];
+    char longbuffer[STRINGSIZE];

     if (gecos == NULL)
 	gecos = "";
@@ -596,38 +596,47 @@ FascistGecosUser(char *password, const c
     {
 	for (i = 0; i < j; i++)
 	{
-	    strcpy(longbuffer, uwords[i]);
-	    strcat(longbuffer, uwords[j]);
-
-	    if (GTry(longbuffer, password))
+	    if (strlen(uwords[i]) + strlen(uwords[j]) < STRINGSIZE)
 	    {
-		return _("it is derived from your password entry");
-	    }
-
-	    strcpy(longbuffer, uwords[j]);
-	    strcat(longbuffer, uwords[i]);
+		strcpy(longbuffer, uwords[i]);
+		strcat(longbuffer, uwords[j]);

-	    if (GTry(longbuffer, password))
-	    {
-		return _("it's derived from your password entry");
+		if (GTry(longbuffer, password))
+		{
+		    return _("it is derived from your password entry");
+		}
+
+		strcpy(longbuffer, uwords[j]);
+		strcat(longbuffer, uwords[i]);
+
+		if (GTry(longbuffer, password))
+		{
+		   return _("it's derived from your password entry");
+		}
 	    }

-	    longbuffer[0] = uwords[i][0];
-	    longbuffer[1] = '\0';
-	    strcat(longbuffer, uwords[j]);
-
-	    if (GTry(longbuffer, password))
+	    if (strlen(uwords[j]) < STRINGSIZE - 1)
 	    {
-		return _("it is derivable from your password entry");
+		longbuffer[0] = uwords[i][0];
+		longbuffer[1] = '\0';
+		strcat(longbuffer, uwords[j]);
+
+		if (GTry(longbuffer, password))
+		{
+		    return _("it is derivable from your password entry");
+		}
 	    }

-	    longbuffer[0] = uwords[j][0];
-	    longbuffer[1] = '\0';
-	    strcat(longbuffer, uwords[i]);
-
-	    if (GTry(longbuffer, password))
+	    if (strlen(uwords[i]) < STRINGSIZE - 1)
 	    {
-		return _("it's derivable from your password entry");
+		longbuffer[0] = uwords[j][0];
+		longbuffer[1] = '\0';
+		strcat(longbuffer, uwords[i]);
+
+		if (GTry(longbuffer, password))
+		{
+		    return _("it's derivable from your password entry");
+		}
 	    }
 	}
     }


code:
Fix buffer overflow processing long words in Mangle().

Patch adpated from upstream commit, omitting changes to 'NEWS':

https://github.com/cracklib/cracklib/commit/33d7fa4585247cd2247a1ffa032ad245836c6edb

From 33d7fa4585247cd2247a1ffa032ad245836c6edb Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Thu, 25 Aug 2016 17:17:53 +0200
Subject: [PATCH] Fix a buffer overflow processing long words

A buffer overflow processing long words has been discovered. This commit
applies the patch from
https://build.opensuse.org/package/view_file/Base:System/cracklib/0004-overflow-processing-long-words.patch
by Howard Guo.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835386 and
http://www.openwall.com/lists/oss-security/2016/08/23/8
---
 src/NEWS        | 1 +
 src/lib/rules.c | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lib/rules.c b/src/lib/rules.c
index d193cc0..3a2aa46 100644
--- a/lib/rules.c
+++ b/lib/rules.c
@@ -434,9 +434,8 @@ Mangle(input, control)		/* returns a pointer to a controlled Mangle */
 {
     int limit;
     register char *ptr;
-    static char area[STRINGSIZE];
-    char area2[STRINGSIZE];
-    area[0] = '\0';
+    static char area[STRINGSIZE * 2] = {0};
+    char area2[STRINGSIZE * 2] = {0};
     strcpy(area, input);

     for (ptr = control; *ptr; ptr++)


code:
Store the crawl version in the textdatabases in SAVEDIR and
upgrade the databases when the crawl version changes.

By default crawl checks for a mtime difference on files in DATADIR to see if an
upgrade is required, but guix nulls all file dates,
and crawl would never upgrade saves.

diff -ur a/source/database.cc b/source/database.cc
--- a/source/database.cc	2018-08-09 21:49:26.000000000 -0400
+++ b/source/database.cc	2018-10-07 18:06:41.022445789 -0400
@@ -25,6 +25,7 @@
 #include "syscalls.h"
 #include "threads.h"
 #include "unicode.h"
+#include "version.h"

 // TextDB handles dependency checking the db vs text files, creating the
 // db, loading, and destroying the DB.
@@ -55,6 +56,7 @@
     vector<string> _input_files;
     DBM* _db;
     string timestamp;
+    string version;
     TextDB *_parent;
     const char* lang() { return _parent ? Options.lang_name : 0; }
 public:
@@ -163,7 +165,7 @@

 TextDB::TextDB(const char* db_name, const char* dir, vector<string> files)
     : _db_name(db_name), _directory(dir), _input_files(files),
-      _db(nullptr), timestamp(""), _parent(0), translation(0)
+      _db(nullptr), timestamp(""), version(""),  _parent(0), translation(0)
 {
 }

@@ -171,7 +173,7 @@
     : _db_name(parent->_db_name),
       _directory(parent->_directory + Options.lang_name + "/"),
       _input_files(parent->_input_files), // FIXME: pointless copy
-      _db(nullptr), timestamp(""), _parent(parent), translation(nullptr)
+      _db(nullptr), timestamp(""), version(""), _parent(parent), translation(nullptr)
 {
 }

@@ -186,6 +188,9 @@
         return false;

     timestamp = _query_database(*this, "TIMESTAMP", false, false, true);
+    version = _query_database(*this, "VERSION", false, false, true);
+    if (version.empty())
+        return false;
     if (timestamp.empty())
         return false;

@@ -229,6 +234,9 @@
     string ts;
     bool no_files = true;

+    if (string(Version::Long) != version)
+        return true;
+
     for (const string &file : _input_files)
     {
         string full_input_path = _directory + file;
@@ -245,7 +253,7 @@
         ts += buf;
     }

-    if (no_files && timestamp.empty())
+    if (no_files && timestamp.empty() && version.empty())
     {
         // No point in empty databases, although for simplicity keep ones
         // for disappeared translations for now.
@@ -313,7 +321,10 @@
             _store_text_db(full_input_path, _db);
         }
     }
+
+    string current_version = string(Version::Long);
     _add_entry(_db, "TIMESTAMP", ts);
+    _add_entry(_db, "VERSION", current_version);

     dbm_close(_db);
     _db = 0;


code:
This patch allows us to make the libgcrypt dependency optional (which it
is, if you look at the code), which in turns allows us to build CRDA
without the signature-checking capability on 'regulatory.bin'.

--- crda/Makefile	2015-07-17 11:33:33.546712893 +0200
+++ crda/Makefile	2015-07-17 11:34:05.210994373 +0200
@@ -45,12 +45,14 @@ LDLIBS += `pkg-config --libs openssl`
 $(LIBREG): keys-ssl.c

 else
+ifeq ($(USE_GCRYPT),1)
 CFLAGS += -DUSE_GCRYPT
 LDLIBS += -lgcrypt

 $(LIBREG): keys-gcrypt.c

 endif
+endif
 MKDIR ?= mkdir -p
 INSTALL ?= install


code:
This patch modifies the build process such that the bundled copy of pysam does
not need to be built if CROSSMAP_USE_SYSTEM_PYSAM is set and the pysam module
can be imported.

Upstream has agreed to apply the patch in the next maintenance release of
crossmap.  The patch has already been uploaded to
http://sourceforge.net/projects/crossmap/files/patch/.

diff --git a/setup.py b/setup.py
--- a/setup.py	2015-02-26 15:28:49.771189185 +0100
+++ b/setup.py	2015-02-26 15:55:03.440327752 +0100
@@ -19,6 +19,15 @@
 except:
 	have_numpy = False

+try:
+	import pysam
+	if os.environ['CROSSMAP_USE_SYSTEM_PYSAM']:
+		have_pysam = True
+	else:
+		have_pysam = False
+except ImportError:
+	have_pysam = False
+
 if platform.system()=='Windows':
 	print >> sys.stderr, "Sorry, Windows platform is not supported!"
 	sys.exit()
@@ -165,49 +174,50 @@

 	#================= pysam samtools ====================
-	extensions.append(Extension(
-    	"pysam.csamtools",
-		csamtools_sources + [ "lib/pysam/%s" % x for x in ("pysam_util.c", )] +\
-		glob.glob( os.path.join( "lib/samtools", "*.pysam.c" )) +\
-		os_c_files + \
-		glob.glob( os.path.join( "lib/samtools", "*", "*.pysam.c" ) ),
-		library_dirs=[],
-		include_dirs=[ "lib/samtools", "lib/pysam" ] + include_os,
-		libraries=[ "z", ],
-		language="c",
-		define_macros = [('_FILE_OFFSET_BITS','64'),('_USE_KNETFILE','')],
-    ))
-
-	extensions.append(Extension(
-		"pysam.ctabix",
-		tabix_sources + [ "lib/pysam/%s" % x for x in ( "tabix_util.c", )] +\
-		os_c_files + \
-		glob.glob( os.path.join( "lib/tabix", "*.pysam.c" ) ),
-		library_dirs=[],
-		include_dirs=[ "lib/tabix", "lib/pysam" ] + include_os,
-		libraries=[ "z", ],
-		language="c",
-		define_macros = [('_FILE_OFFSET_BITS','64'),
-                     ('_USE_KNETFILE','')],
-    ))
-
-	extensions.append(Extension(
-		"pysam.TabProxies",
-		tabproxies_sources + os_c_files,
-		library_dirs=[],
-		include_dirs= include_os,
-		libraries=[ "z", ],
-		language="c",
-    ))
-
-	extensions.append(Extension(
-		"pysam.cvcf",
-		cvcf_sources + os_c_files,
-		library_dirs=[],
-		include_dirs= ["lib/tabix",] + include_os,
-		libraries=[ "z", ],
-		language="c",
-    ))
+        if not have_pysam:
+                extensions.append(Extension(
+                        "pysam.csamtools",
+                        csamtools_sources + [ "lib/pysam/%s" % x for x in ("pysam_util.c", )] +\
+                        glob.glob( os.path.join( "lib/samtools", "*.pysam.c" )) +\
+                        os_c_files + \
+                        glob.glob( os.path.join( "lib/samtools", "*", "*.pysam.c" ) ),
+                        library_dirs=[],
+                        include_dirs=[ "lib/samtools", "lib/pysam" ] + include_os,
+                        libraries=[ "z", ],
+                        language="c",
+                        define_macros = [('_FILE_OFFSET_BITS','64'),('_USE_KNETFILE','')],
+                ))
+
+                extensions.append(Extension(
+                        "pysam.ctabix",
+                        tabix_sources + [ "lib/pysam/%s" % x for x in ( "tabix_util.c", )] +\
+                        os_c_files + \
+                        glob.glob( os.path.join( "lib/tabix", "*.pysam.c" ) ),
+                        library_dirs=[],
+                        include_dirs=[ "lib/tabix", "lib/pysam" ] + include_os,
+                        libraries=[ "z", ],
+                        language="c",
+                        define_macros = [('_FILE_OFFSET_BITS','64'),
+                                         ('_USE_KNETFILE','')],
+                ))
+
+                extensions.append(Extension(
+                        "pysam.TabProxies",
+                        tabproxies_sources + os_c_files,
+                        library_dirs=[],
+                        include_dirs= include_os,
+                        libraries=[ "z", ],
+                        language="c",
+                ))
+
+                extensions.append(Extension(
+                        "pysam.cvcf",
+                        cvcf_sources + os_c_files,
+                        library_dirs=[],
+                        include_dirs= ["lib/tabix",] + include_os,
+                        libraries=[ "z", ],
+                        language="c",
+                ))

 	return extensions


code:
Unconditionally disable network check for new versions (from Fedora).

diff -u /home/dlove/rpmbuild/BUILD/cube-4.3.4/src/GUI-qt/display/VersionCheckWidget.cpp\~ /home/dlove/rpmbuild/BUILD/cube-4.3.4/src/GUI-qt/display/VersionCheckWidget.cpp
--- cube-4.3.4/src/GUI-qt/display/VersionCheckWidget.cpp~	2016-04-03 00:05:37.942066948 +0100
+++ cube-4.3.4/src/GUI-qt/display/VersionCheckWidget.cpp	2016-05-06 17:16:31.648143908 +0100
@@ -52,7 +52,8 @@
     url              = QUrl( UPDATE_CHECK_URL );
     download         = NULL;
     update_Available = false;
-    bool no_http = env_str2bool( getenv( "CUBE_DISABLE_HTTP_DOCS" ) );
+    // bool no_http = env_str2bool( getenv( "CUBE_DISABLE_HTTP_DOCS" ) );
+    bool no_http = true;
     if ( !no_http )
     {
         updateDescription =   tr( "Check for update is not performed yet." );


code:
Related to https://github.com/mtytel/cursynth/issues/9

--- a/mopo/src/wave.h	2014-06-25 14:10:57.827369578 -0500
+++ b/mopo/src/wave.h	2014-06-25 14:08:15.795376354 -0500
@@ -19,6 +19,7 @@
 #define WAVE_H

 #include "mopo.h"
+#include <cstdlib>
 #include <cmath>

 #define LOOKUP_SIZE 2048


code:
Fix CVE-2017-12836:

http://cve.mitre.org/cgi-bin/cvename.cgi?name=2017-12836
https://security-tracker.debian.org/tracker/CVE-2017-12836

Patch adpated from Debian (comments and changelog annotations removed):

https://anonscm.debian.org/cgit/collab-maint/cvs.git/commit/?h=stretch&id=41e077396e35efb6c879951f44c62dd8a1d0f094

From 41e077396e35efb6c879951f44c62dd8a1d0f094 Mon Sep 17 00:00:00 2001
From: mirabilos <m@mirbsd.org>
Date: Sat, 12 Aug 2017 03:17:18 +0200
Subject: Fix CVE-2017-12836 (Closes: #871810) for stretch

---
 debian/changelog |  6 ++++++
 src/rsh-client.c | 10 ++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/rsh-client.c b/src/rsh-client.c
index fe0cfc4..1fc860d 100644
--- a/src/rsh-client.c
+++ b/src/rsh-client.c
@@ -105,6 +106,9 @@ start_rsh_server (cvsroot_t *root, struct buffer **to_server_p,
 	rsh_argv[i++] = argvport;
     }

+    /* Only non-option arguments from here. (CVE-2017-12836) */
+    rsh_argv[i++] = "--";
+
     rsh_argv[i++] = root->hostname;
     rsh_argv[i++] = cvs_server;
     if (readonlyfs)
@@ -189,6 +193,8 @@ start_rsh_server (cvsroot_t *root, struct buffer **to_server_p,
 		*p++ = argvport;
 	}

+	*p++ = "--";
+
 	*p++ = root->hostname;
 	*p++ = command;
 	*p++ = NULL;
--
cgit v0.12


code:
Fix CVE-2013-4122.

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-4122

Patch copied from upstream source repository:
https://github.com/cyrusimap/cyrus-sasl/commit/dedad73e5e7a75d01a5f3d5a6702ab8ccd2ff40d

From dedad73e5e7a75d01a5f3d5a6702ab8ccd2ff40d Mon Sep 17 00:00:00 2001
From: mancha <mancha1@hush.com>
Date: Thu, 11 Jul 2013 10:08:07 +0100
Subject: Handle NULL returns from glibc 2.17+ crypt()

Starting with glibc 2.17 (eglibc 2.17), crypt() fails with EINVAL
(w/ NULL return) if the salt violates specifications. Additionally,
on FIPS-140 enabled Linux systems, DES/MD5-encrypted passwords
passed to crypt() fail with EPERM (w/ NULL return).

When using glibc's crypt(), check return value to avoid a possible
NULL pointer dereference.

Patch by mancha1@hush.com.
---
 pwcheck/pwcheck_getpwnam.c | 3 ++-
 pwcheck/pwcheck_getspnam.c | 4 +++-
 saslauthd/auth_getpwent.c  | 4 +++-
 saslauthd/auth_shadow.c    | 8 +++-----
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/pwcheck/pwcheck_getpwnam.c b/pwcheck/pwcheck_getpwnam.c
index 4b34222..400289c 100644
--- a/pwcheck/pwcheck_getpwnam.c
+++ b/pwcheck/pwcheck_getpwnam.c
@@ -32,6 +32,7 @@ char *userid;
 char *password;
 {
     char* r;
+    char* crpt_passwd;
     struct passwd *pwd;

     pwd = getpwnam(userid);
@@ -41,7 +42,7 @@ char *password;
     else if (pwd->pw_passwd[0] == '*') {
 	r = "Account disabled";
     }
-    else if (strcmp(pwd->pw_passwd, crypt(password, pwd->pw_passwd)) != 0) {
+    else if (!(crpt_passwd = crypt(password, pwd->pw_passwd)) || strcmp(pwd->pw_passwd, (const char *)crpt_passwd) != 0) {
 	r = "Incorrect password";
     }
     else {
diff --git a/pwcheck/pwcheck_getspnam.c b/pwcheck/pwcheck_getspnam.c
index 2b11286..6d607bb 100644
--- a/pwcheck/pwcheck_getspnam.c
+++ b/pwcheck/pwcheck_getspnam.c
@@ -32,13 +32,15 @@ char *userid;
 char *password;
 {
     struct spwd *pwd;
+    char *crpt_passwd;

     pwd = getspnam(userid);
     if (!pwd) {
 	return "Userid not found";
     }

-    if (strcmp(pwd->sp_pwdp, crypt(password, pwd->sp_pwdp)) != 0) {
+    crpt_passwd = crypt(password, pwd->sp_pwdp);
+    if (!crpt_passwd || strcmp(pwd->sp_pwdp, (const char *)crpt_passwd) != 0) {
 	return "Incorrect password";
     }
     else {
diff --git a/saslauthd/auth_getpwent.c b/saslauthd/auth_getpwent.c
index fc8029d..d4ebe54 100644
--- a/saslauthd/auth_getpwent.c
+++ b/saslauthd/auth_getpwent.c
@@ -77,6 +77,7 @@ auth_getpwent (
 {
     /* VARIABLES */
     struct passwd *pw;			/* pointer to passwd file entry */
+    char *crpt_passwd;			/* encrypted password */
     int errnum;
     /* END VARIABLES */

@@ -105,7 +106,8 @@ auth_getpwent (
 	}
     }

-    if (strcmp(pw->pw_passwd, (const char *)crypt(password, pw->pw_passwd))) {
+    crpt_passwd = crypt(password, pw->pw_passwd);
+    if (!crpt_passwd || strcmp(pw->pw_passwd, (const char *)crpt_passwd)) {
 	if (flags & VERBOSE) {
 	    syslog(LOG_DEBUG, "DEBUG: auth_getpwent: %s: invalid password", login);
 	}
diff --git a/saslauthd/auth_shadow.c b/saslauthd/auth_shadow.c
index 677131b..1988afd 100644
--- a/saslauthd/auth_shadow.c
+++ b/saslauthd/auth_shadow.c
@@ -210,8 +210,8 @@ auth_shadow (
 	RETURN("NO Insufficient permission to access NIS authentication database (saslauthd)");
     }

-    cpw = strdup((const char *)crypt(password, sp->sp_pwdp));
-    if (strcmp(sp->sp_pwdp, cpw)) {
+    cpw = crypt(password, sp->sp_pwdp);
+    if (!cpw || strcmp(sp->sp_pwdp, (const char *)cpw)) {
 	if (flags & VERBOSE) {
 	    /*
 	     * This _should_ reveal the SHADOW_PW_LOCKED prefix to an
@@ -221,10 +221,8 @@ auth_shadow (
 	    syslog(LOG_DEBUG, "DEBUG: auth_shadow: pw mismatch: '%s' != '%s'",
 		   sp->sp_pwdp, cpw);
 	}
-	free(cpw);
 	RETURN("NO Incorrect password");
     }
-    free(cpw);

     /*
      * The following fields will be set to -1 if:
@@ -286,7 +284,7 @@ auth_shadow (
 	RETURN("NO Invalid username");
     }

-    if (strcmp(upw->upw_passwd, crypt(password, upw->upw_passwd)) != 0) {
+    if (!(cpw = crypt(password, upw->upw_passwd)) || (strcmp(upw->upw_passwd, (const char *)cpw) != 0)) {
 	if (flags & VERBOSE) {
 	    syslog(LOG_DEBUG, "auth_shadow: pw mismatch: %s != %s",
 		   password, upw->upw_passwd);
--
cgit v0.12


code:
See https://lists.gnu.org/archive/html/bug-datamash/2018-03/msg00003.html and
https://lists.gnu.org/archive/html/bug-datamash/2018-03/txt4DmvR7p6J9.txt

From d446dba317aa067440d6312d955d523129949327 Mon Sep 17 00:00:00 2001
From: Assaf Gordon <address@hidden>
Date: Thu, 22 Mar 2018 11:00:34 -0600
Subject: [PATCH 1/2] tests: fix --format='%4000f' expected output

Can be 1.000009... or 1.000008999, depending on representation.

* tests/datamash-output-format.pl: Check only the first 5 digits.
---
 tests/datamash-output-format.pl | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/datamash-output-format.pl b/tests/datamash-output-format.pl
index 52c68a2..ca99bb0 100755
--- a/tests/datamash-output-format.pl
+++ b/tests/datamash-output-format.pl
@@ -98,12 +98,13 @@ my @Tests =
    {OUT => "0" x 3999 . "1\n"}],

   # due to binary floating representation, some decimal point digits won't be
-  # zero (e.g. 1.0000090000000000000000000000000523453254320000000...).
-  # The OUT_SUBST replaces exactly 3994 digits (as expected from the format)
+  # zero (e.g. 1.0000090000000000000000000000000523453254320000000... or
+  # 1.000008999999...).
+  # The OUT_SUBST replaces exactly 3995 digits (as expected from the format)
   # with an "X".
   ['m2', '--format "%.4000f"   sum 1',  {IN_PIPE=>$in1},
-   {OUT => "1.000009X\n"},
-   {OUT_SUBST => 's/^(1\.000009)([0-9]{3994})$/\1X/'}],
+   {OUT => "1.00000X\n"},
+   {OUT_SUBST => 's/^(1\.00000)([0-9]{3995})$/\1X/'}],

 );

--
2.7.4

From f4871963974a96d6e69cb80b9c2fac7ff0c1d472 Mon Sep 17 00:00:00 2001
From: Assaf Gordon <address@hidden>
Date: Thu, 22 Mar 2018 11:18:13 -0600
Subject: [PATCH 2/2] tests: disable --format="%a" test

Valid output can differ (e.g. 0x8.000p-3 vs 0x1.000p+0).

* tests/datamash-output-format.pl: Disable 'a1' test.
---
 tests/datamash-output-format.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/datamash-output-format.pl b/tests/datamash-output-format.pl
index ca99bb0..5e90ae0 100755
--- a/tests/datamash-output-format.pl
+++ b/tests/datamash-output-format.pl
@@ -90,7 +90,9 @@ my @Tests =
   ['e2', '--format "%.3e"  sum 1', {IN_PIPE=>$in1}, {OUT=>"1.000e+00\n"}],

   # Test Custom formats: %a
-  ['a1', '--format "%0.3a" sum 1', {IN_PIPE=>$in1}, {OUT=>"0x8.000p-3\n"}],
+  # Disable the test for now. Valid output can differ (e.g. 0x8.000p-3 and
+  # 0x1.000p0 ).
+  # ['a1', '--format "%0.3a" sum 1', {IN_PIPE=>$in1}, {OUT=>"0x8.000p-3\n"}],

   # Custom formats can use lots of memory
--
2.7.4


code:
The setuid helper of D-Bus is responsible for "service activation".
It looks for '.service' files in fixed locations, but the default locations
make no sense (see below), so replace them with /etc/dbus-1/system-services.

--- dbus-1.10.0/dbus/dbus-sysdeps-util-unix.c	2015-10-22 00:07:03.829251854 +0200
+++ dbus-1.10.0/dbus/dbus-sysdeps-util-unix.c	2015-10-22 00:07:14.893445175 +0200
@@ -1410,10 +1410,7 @@ _dbus_get_standard_system_servicedirs (D
    * be available.
    */
   static const char standard_search_path[] =
-    "/usr/local/share:"
-    "/usr/share:"
-    DBUS_DATADIR ":"
-    "/lib";
+    "/etc";
   DBusString servicedir_path;

   _dbus_string_init_const (&servicedir_path, standard_search_path);


code:
From 5676766be5e845ccb6cdf46cfa8722497f151752 Mon Sep 17 00:00:00 2001
From: Jeremy Bicha <jbicha@ubuntu.com>
Date: Fri, 16 Jun 2017 15:11:37 -0400
Subject: Use 'ref' keyword for iter, requires vala 0.36

diff --git a/deja-dup/widgets/ConfigList.vala b/deja-dup/widgets/ConfigList.vala
index 15de2d6..02cd81a 100644
--- a/deja-dup/widgets/ConfigList.vala
+++ b/deja-dup/widgets/ConfigList.vala
@@ -333,7 +333,7 @@ public class ConfigList : ConfigWidget

     model.row_deleted.disconnect(write_to_config);
     foreach (Gtk.TreeIter iter in iters) {
-      (model as Gtk.ListStore).remove(iter);
+      (model as Gtk.ListStore).remove(ref iter);
     }
     model.row_deleted.connect(write_to_config);

diff --git a/deja-dup/widgets/ConfigLocation.vala b/deja-dup/widgets/ConfigLocation.vala
index 869e2a8..d21c556 100644
--- a/deja-dup/widgets/ConfigLocation.vala
+++ b/deja-dup/widgets/ConfigLocation.vala
@@ -397,12 +397,12 @@ public class ConfigLocation : ConfigWidget
     if (uuid == saved_uuid)
       return;

-    store.remove(iter);
+    store.remove(ref iter);

     if (--num_volumes == 0) {
       Gtk.TreeIter sep_iter;
       if (store.get_iter_from_string(out sep_iter, index_vol_sep.to_string())) {
-        store.remove(sep_iter);
+        store.remove(ref sep_iter);
         index_vol_sep = -2;
       }
     }
--
cgit v0.10.2


code:
--- a/Makefile	2017-04-09 12:48:15.000000000 +0200
+++ b/Makefile	2017-06-21 14:26:02.749282787 +0200
@@ -9,8 +9,8 @@

 # Flags
 CXX=g++
-CXXFLAGS += -isystem ${SEQTK_ROOT} -isystem ${BOOST_ROOT} -pedantic -W -Wall -Wno-unknown-pragmas -D__STDC_LIMIT_MACROS -fno-strict-aliasing
-LDFLAGS += -L${SEQTK_ROOT} -L${BOOST_ROOT}/stage/lib -lboost_iostreams -lboost_filesystem -lboost_system -lboost_program_options -lboost_date_time
+CXXFLAGS += -pedantic -W -Wall -Wno-unknown-pragmas -D__STDC_LIMIT_MACROS -fno-strict-aliasing
+LDFLAGS += -lboost_iostreams -lboost_filesystem -lboost_system -lboost_program_options -lboost_date_time

 # Additional flags for release/debug
 ifeq (${PARALLEL}, 1)
@@ -23,7 +23,7 @@
 ifeq (${STATIC}, 1)
 	LDFLAGS += -static -static-libgcc -pthread -lhts -lz
 else
-	LDFLAGS += -lhts -lz -Wl,-rpath,${SEQTK_ROOT},-rpath,${BOOST_ROOT}/stage/lib
+	LDFLAGS += -lhts -lz
 endif
 ifeq (${DEBUG}, 1)
 	CXXFLAGS += -g -O0 -fno-inline -DDEBUG
@@ -41,29 +41,17 @@
 DELLYSOURCES = $(wildcard src/*.h) $(wildcard src/*.cpp)

 # Targets
-TARGETS = .htslib .bcftools .boost src/delly src/cov src/dpe
+TARGETS = src/delly src/cov src/dpe

 all:   	$(TARGETS)

-.htslib: $(HTSLIBSOURCES)
-	cd src/htslib && make && make lib-static && cd ../../ && touch .htslib
-
-.bcftools: $(HTSLIBSOURCES)
-	cd src/bcftools && make && cd ../../ && touch .bcftools
-
-.boost: $(BOOSTSOURCES)
-	cd src/modular-boost && ./bootstrap.sh --prefix=${PWD}/src/modular-boost --without-icu --with-libraries=iostreams,filesystem,system,program_options,date_time && ./b2 && ./b2 headers && cd ../../ && touch .boost
-
-src/delly: .htslib .bcftools .boost $(DELLYSOURCES)
-	$(CXX) $(CXXFLAGS) $@.cpp -o $@ $(LDFLAGS)
-
-src/cov: .htslib .bcftools .boost $(DELLYSOURCES)
+src/cov: $(DELLYSOURCES)
 	$(CXX) $(CXXFLAGS) $@.cpp -o $@ $(LDFLAGS)

-src/dpe: .htslib .bcftools .boost $(DELLYSOURCES)
+src/dpe: $(DELLYSOURCES)
 	$(CXX) $(CXXFLAGS) $@.cpp -o $@ $(LDFLAGS)

 clean:
 	cd src/htslib && make clean
 	cd src/modular-boost && ./b2 --clean-all
-	rm -f $(TARGETS) $(TARGETS:=.o) .htslib .boost .bcftools
+	rm -f $(TARGETS) $(TARGETS:=.o)


code:
Dfu-programmer cannot cannot find libusb. This patch fixes that.

diff --git a/src/dfu-device.h b/src/dfu-device.h
index bbdfa99..31af0e8 100644
--- a/src/dfu-device.h
+++ b/src/dfu-device.h
@@ -6,7 +6,7 @@
 #endif
 #include <stdint.h>
 #ifdef HAVE_LIBUSB_1_0
-#include <libusb.h>
+#include <libusb-1.0/libusb.h>
 #else
 #include <usb.h>
 #endif

diff --git a/src/main.c b/src/main.c
index ef2aa16..dcc3636 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,7 +24,7 @@
 #include <stdio.h>
 #include <string.h>
 #ifdef HAVE_LIBUSB_1_0
-#include <libusb.h>
+#include <libusb-1.0/libusb.h>
 #else
 #include <usb.h>
 #endif

diff --git a/src/dfu.c b/src/dfu.c
index 7dbcc57..952e896 100644
--- a/src/dfu.c
+++ b/src/dfu.c
@@ -27,7 +27,7 @@
 #include <stdlib.h>
 #include <stddef.h>
 #ifdef HAVE_LIBUSB_1_0
-#include <libusb.h>
+#include <libusb-1.0/libusb.h>
 #else
 #include <usb.h>
 #endif

diff --git a/src/dfu.h b/src/dfu.h
index 2a159e8..63510f2 100644
--- a/src/dfu.h
+++ b/src/dfu.h
@@ -25,7 +25,7 @@
 # include <config.h>
 #endif
 #ifdef HAVE_LIBUSB_1_0
-#include <libusb.h>
+#include <libusb-1.0/libusb.h>
 #else
 #include <usb.h>
 #endif


code:
commit e3461d1c21a99bcef1b8826f710434e0ffb5adea
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Sun Jun 11 15:53:09 2017 -0700

    getopt-posix: port to glibc 2.25.90

    Problem reported by Daniel P. Berrange in:
    http://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00003.html
    * lib/getopt-pfx-core.h (_GETOPT_CORE_H):
    * lib/getopt-pfx-ext.h (_GETOPT_EXT_H):
    #undef if __GETOPT_PREFIX is defined.

diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h
index 155c11612..6ad0da683 100644
--- a/lib/getopt-pfx-core.h
+++ b/lib/getopt-pfx-core.h
@@ -47,6 +47,11 @@
 # define opterr __GETOPT_ID (opterr)
 # define optind __GETOPT_ID (optind)
 # define optopt __GETOPT_ID (optopt)
+
+/* The system's getopt.h may have already included getopt-core.h to
+   declare the unprefixed identifiers.  Undef _GETOPT_CORE_H so that
+   getopt-core.h declares them with prefixes.  */
+# undef _GETOPT_CORE_H
 #endif

 #include <getopt-core.h>
diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h
index d960bb34e..c5ac52202 100644
--- a/lib/getopt-pfx-ext.h
+++ b/lib/getopt-pfx-ext.h
@@ -45,6 +45,11 @@
 # define getopt_long_only __GETOPT_ID (getopt_long_only)
 # define option __GETOPT_ID (option)
 # define _getopt_internal __GETOPT_ID (getopt_internal)
+
+/* The system's getopt.h may have already included getopt-ext.h to
+   declare the unprefixed identifiers.  Undef _GETOPT_EXT_H so that
+   getopt-ext.h declares them with prefixes.  */
+# undef _GETOPT_EXT_H
 #endif

 /* Standalone applications get correct prototypes for getopt_long and


code:
This patch is needed to allow builds with newer versions of
the GNU libc (2.16+).

commit 66712c23388e93e5c518ebc8515140fa0c807348
Author: Eric Blake <eblake@redhat.com>
Date:   Thu Mar 29 13:30:41 2012 -0600

    stdio: don't assume gets any more

    Gnulib intentionally does not have a gets module, and now that C11
    and glibc have dropped it, we should be more proactive about warning
    any user on a platform that still has a declaration of this dangerous
    interface.

    * m4/stdio_h.m4 (gl_STDIO_H, gl_STDIO_H_DEFAULTS): Drop gets
    support.
    * modules/stdio (Makefile.am): Likewise.
    * lib/stdio-read.c (gets): Likewise.
    * tests/test-stdio-c++.cc: Likewise.
    * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Fix comment.
    * lib/stdio.in.h (gets): Make warning occur in more places.
    * doc/posix-functions/gets.texi (gets): Update documentation.
    Reported by Christer Solskogen.

    Signed-off-by: Eric Blake <eblake@redhat.com>

diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index aa7b599..c377b6e 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -698,22 +698,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
 # endif
 #endif

-#if @GNULIB_GETS@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef gets
-#   define gets rpl_gets
-#  endif
-_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (gets, char *, (char *s));
-# else
-_GL_CXXALIAS_SYS (gets, char *, (char *s));
-#  undef gets
-# endif
-_GL_CXXALIASWARN (gets);
 /* It is very rare that the developer ever has full control of stdin,
-   so any use of gets warrants an unconditional warning.  Assume it is
-   always declared, since it is required by C89.  */
+   so any use of gets warrants an unconditional warning; besides, C11
+   removed it.  */
+#undef gets
+#if HAVE_RAW_DECL_GETS
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
 #endif

@@ -1053,9 +1042,9 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
 # endif
 #endif

-/* Some people would argue that sprintf should be handled like gets
-   (for example, OpenBSD issues a link warning for both functions),
-   since both can cause security holes due to buffer overruns.
+/* Some people would argue that all sprintf uses should be warned about
+   (for example, OpenBSD issues a link warning for it),
+   since it can cause security holes due to buffer overruns.
    However, we believe that sprintf can be used safely, and is more
    efficient than snprintf in those safe cases; and as proof of our
    belief, we use sprintf in several gnulib modules.  So this header


code:
Adapted from https://sourceforge.net/p/docpp/patches/1/

--- doc++-3.4.10/src/comment.ll	2000-06-24 18:50:23.000000000 +0200
+++ doc++-3.4.10/src/comment.ll	2012-09-17 11:14:50.744922841 +0200
@@ -24,7 +24,7 @@

 #include <assert.h>
 #include <ctype.h>
-#include <iostream.h>
+#include <iostream>
 #include <stdarg.h>
 #include <stdio.h>

--- doc++-3.4.10/src/cpp.ll	2002-05-09 08:11:14.000000000 +0200
+++ doc++-3.4.10/src/cpp.ll	2012-09-17 11:15:21.184333236 +0200
@@ -26,7 +26,7 @@

 #include <assert.h>
 #include <ctype.h>
-#include <iostream.h>
+#include <iostream>
 #include <stdarg.h>
 #include <stdio.h>

--- doc++-3.4.10/src/datahashtable.h	2000-08-27 21:44:34.000000000 +0200
+++ doc++-3.4.10/src/datahashtable.h	2012-09-17 11:22:59.442589960 +0200
@@ -26,11 +26,13 @@
 #define _DATAHASHTABLE_H

 #include <assert.h>
-#include <iostream.h>
+#include <iostream>
 #include <stdlib.h>

 #include "McDArray.h"

+using namespace std;
+
 /* This should be a private subclass of #DataHashTable#. However, since cfront
    is not able to compile this constrution, we had move the class to global
    scope.
--- doc++-3.4.10/src/doc2dbsgml.ll	2002-05-09 08:11:14.000000000 +0200
+++ doc++-3.4.10/src/doc2dbsgml.ll	2012-09-17 11:20:49.077259414 +0200
@@ -22,8 +22,8 @@

 %{
 #include <assert.h>
-#include <fstream.h>
-#include <iostream.h>
+#include <fstream>
+#include <iostream>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -36,6 +36,8 @@
 #undef	YY_INPUT
 #define	YY_INPUT(buf, result, max_size) result = yyread(buf, max_size);

+using namespace std;
+
 static Entry*	current;
 static int	inPos;
 static int	lastContext;
--- doc++-3.4.10/src/doc2dbxml.ll	2002-05-09 08:11:14.000000000 +0200
+++ doc++-3.4.10/src/doc2dbxml.ll	2012-09-17 11:20:22.264831159 +0200
@@ -25,8 +25,8 @@

 %{
 #include <assert.h>
-#include <fstream.h>
-#include <iostream.h>
+#include <fstream>
+#include <iostream>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -39,6 +39,8 @@
 #undef	YY_INPUT
 #define	YY_INPUT(buf, result, max_size) result = yyread(buf, max_size);

+using namespace std;
+
 static Entry*	current;
 static int	inPos;
 static int	lastContext;
--- doc++-3.4.10/src/doc2html.ll	2000-07-17 23:17:24.000000000 +0200
+++ doc++-3.4.10/src/doc2html.ll	2012-09-17 11:22:40.354469631 +0200
@@ -29,6 +29,8 @@
 #include "doc.h"
 #include "nametable.h"

+using namespace std;
+
 extern NameTable	gifs;

 #define YY_DECL int yylex()
--- doc++-3.4.10/src/doc2tex.ll	2000-11-05 17:21:16.000000000 +0100
+++ doc++-3.4.10/src/doc2tex.ll	2012-09-17 11:23:22.210701715 +0200
@@ -23,8 +23,8 @@

 %{
 #include <assert.h>
-#include <fstream.h>
-#include <iostream.h>
+#include <fstream>
+#include <iostream>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -38,6 +38,8 @@
 #undef	YY_INPUT
 #define	YY_INPUT(buf, result, max_size) result = yyread(buf, max_size);

+using namespace std;
+
 static Entry*	current;
 static int	inPos;
 static int	lastContext;
--- doc++-3.4.10/src/doc.ll	2000-09-17 21:41:17.000000000 +0200
+++ doc++-3.4.10/src/doc.ll	2012-09-17 11:15:37.068009454 +0200
@@ -23,8 +23,8 @@

 %{
 #include <assert.h>
-#include <fstream.h>
-#include <iostream.h>
+#include <fstream>
+#include <iostream>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
--- doc++-3.4.10/src/equate.cc	2002-05-02 21:13:10.000000000 +0200
+++ doc++-3.4.10/src/equate.cc	2012-09-17 11:25:42.850669366 +0200
@@ -23,9 +23,9 @@

 #include "config.h"

-#include <fstream.h>
+#include <fstream>
 #include <getopt.h>
-#include <iostream.h>
+#include <iostream>
 #include <stdio.h>
 #include <string.h>

--- doc++-3.4.10/src/html.cc	2001-02-17 07:34:49.000000000 +0100
+++ doc++-3.4.10/src/html.cc	2012-09-17 11:24:07.978824681 +0200
@@ -31,7 +31,7 @@
 #include <direct.h>
 #endif
 #include <errno.h>
-#include <iostream.h>
+#include <iostream>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
--- doc++-3.4.10/src/java.ll	2001-11-25 18:04:12.000000000 +0100
+++ doc++-3.4.10/src/java.ll	2012-09-17 11:24:19.138834603 +0200
@@ -26,7 +26,7 @@

 #include <assert.h>
 #include <ctype.h>
-#include <iostream.h>
+#include <iostream>
 #include <stdio.h>

 #include "doc.h"
--- doc++-3.4.10/src/main.cc	2002-05-09 08:11:14.000000000 +0200
+++ doc++-3.4.10/src/main.cc	2012-09-17 11:25:30.650719070 +0200
@@ -25,7 +25,7 @@
 #include "config.h"

 #include <assert.h>
-#include <fstream.h>
+#include <fstream>
 #include <getopt.h>
 #include <locale.h>
 #include <stdio.h>
--- doc++-3.4.10/src/nametable.cc	2000-04-08 23:11:54.000000000 +0200
+++ doc++-3.4.10/src/nametable.cc	2012-09-17 11:25:58.894591128 +0200
@@ -22,7 +22,7 @@
 */

 #include <assert.h>
-#include <iostream.h>
+#include <iostream>
 #include <stdlib.h>
 #include <string.h>

--- doc++-3.4.10/src/nametable.h	2000-04-08 23:11:56.000000000 +0200
+++ doc++-3.4.10/src/nametable.h	2012-09-17 11:22:07.826207198 +0200
@@ -25,7 +25,7 @@
 #define	_NAME_TABLE_H

 #include <assert.h>
-#include <iostream.h>
+#include <iostream>

 #include "datahashtable.h"

--- doc++-3.4.10/src/php.ll	2001-02-16 23:34:47.000000000 +0100
+++ doc++-3.4.10/src/php.ll	2012-09-17 11:25:18.582759801 +0200
@@ -23,7 +23,7 @@
 %{
 #include <assert.h>
 #include <ctype.h>
-#include <iostream.h>
+#include <iostream>
 #include <stdio.h>

 #include "doc.h"
--- doc++-3.4.10/src/tex2gif.cc	2001-08-07 20:55:40.000000000 +0200
+++ doc++-3.4.10/src/tex2gif.cc	2012-09-17 11:26:06.698547836 +0200
@@ -21,8 +21,8 @@
   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

-#include <iostream.h>
-#include <fstream.h>
+#include <iostream>
+#include <fstream>
 #include <stdio.h>
 #include <string.h>


code:
Adapted from https://sources.debian.net/data/main/d/doc%2B%2B/3.4.10-3.4/debian/patches/segfault_fix.patch

--- doc++-3.4.10/src/McDArray.h	2000-07-30 12:40:48.000000000 +0200
+++ doc++-3.4.10/src/McDArray.h	2005-05-10 15:02:06.000000000 +0200
@@ -80,9 +80,14 @@
     McDArray(const McDArray& old) : memFactor(old.memFactor),
 	thesize(old.thesize), themax(old.themax)
 	{
-	data = (T*)malloc(themax * sizeof(T));
-	if(thesize)
-	    memcpy(data, old.data, thesize * sizeof(T));
+	if (themax)
+	    {
+	    data = (T*)malloc(themax * sizeof(T));
+	    if(thesize)
+		memcpy(data, old.data, thesize * sizeof(T));
+	    }
+	else
+	    data = 0;
 	assert(isConsistent());
 	}

--- doc++-3.4.10/src/McDirectory.cc	2000-03-14 22:17:36.000000000 +0100
+++ doc++-3.4.10/src/McDirectory.cc	2005-05-10 15:02:18.000000000 +0200
@@ -23,12 +23,13 @@
 */

 #include "McDirectory.h"
-#include "McSorter.h"
 #include "McString.h"
 #include "doc.h"

 #include <stdio.h>

+#include <algorithm>
+
 #ifdef WIN32
 #include <windows.h>
 #ifdef __BORLANDC__
@@ -62,7 +63,7 @@
     FindClose(searchHandle);
     StringCompare comp;
     if(list.size())
-	sort((char **)list, list.size(), comp, 0);
+	std::sort((char **)list, (char **)list + list.size(), comp);
     return 0;
 }

@@ -107,7 +108,7 @@
     closedir(dir);
     StringCompare comp;
     if(list.size())
-	sort((char **)list, list.size(), comp, 0);
+	std::sort((char **)list, (char **)list + list.size(), comp);
     return list.size();
 }

--- doc++-3.4.10/src/McDirectory.h	2000-06-28 21:54:58.000000000 +0200
+++ doc++-3.4.10/src/McDirectory.h	2005-05-10 15:02:18.000000000 +0200
@@ -59,9 +59,9 @@
     class StringCompare
 	{
 	public:
-	    int operator()(const char *t1, const char *t2)
+	    bool operator()(const char *t1, const char *t2)
 		{
-		return strcmp(t1, t2);
+		return strcmp(t1, t2) < 0;
 		}
 	};
 };
--- doc++-3.4.10/src/html.cc	2001-02-17 07:34:49.000000000 +0100
+++ doc++-3.4.10/src/html.cc	2005-05-10 15:02:18.000000000 +0200
@@ -38,9 +38,10 @@
 #include <sys/stat.h>
 #include <sys/types.h>

+#include <algorithm>
+
 #include "McDirectory.h"
 #include "McHashTable.h"
-#include "McSorter.h"
 #include "classgraph.h"
 #include "doc.h"
 #include "gifs.h"
@@ -314,9 +315,11 @@
 	virtual void writeMember(Entry *e, bool links, bool withSub = true);
 	class EntryCompare {
 	    public:
-		int operator()(const MemberWriterListEntry& l1, const MemberWriterListEntry& l2)
+		bool operator()(const MemberWriterListEntry& l1, const MemberWriterListEntry& l2)
 		    {
-		    return strcmp(l1.entry->fullName.c_str(), l2.entry->fullName.c_str());
+		    const char *s1 = l1.entry->fullName.c_str();
+		    const char *s2 = l2.entry->fullName.c_str();
+		    return strcmp(s1, s2) < 0;
 		    }
 	};
     public:
@@ -324,7 +327,7 @@
 	    {
 	    EntryCompare comp;
 	    if(list.size())
-		::sort((MemberWriterListEntry *)list, list.size(), comp, 0);
+		std::sort((MemberWriterListEntry *)list, (MemberWriterListEntry *)list + list.size(), comp);
 	    }
 	virtual void startList(FILE *f, char *heading, bool withLinks);
 	virtual void addMember(Entry *e, bool links, bool withSub = true)
@@ -376,7 +379,7 @@
 	    int lp;

 	    if(list.size() > 1)
-		::sort((TOCListEntry *)list, list.size(), comp, 0);
+		std::sort((TOCListEntry *)list, (TOCListEntry *)list + list.size(), comp);

 	    // Sort subsections
 	    for(lp = 0; lp < list.size(); lp++)
@@ -385,9 +388,9 @@
 	    }
 	class EntryCompare {
 	    public:
-		int operator()(TOCListEntry& l1, TOCListEntry& l2)
+		bool operator()(const TOCListEntry& l1, const TOCListEntry& l2)
 		    {
-		    return strcmp(l1.name, l2.name);
+		    return strcmp(l1.name, l2.name) < 0;
 		    }
 	};
 	void addEntry(Entry *entry, TOClist *tl);
@@ -487,7 +490,7 @@

     for(i = 0; i < list.size(); i++)
 	if(list[i].tl)
-	    free(list[i].tl);
+	    delete list[i].tl;
 }

 class HIERlist;
@@ -509,7 +512,7 @@
 	    int i;

 	    if(list.size() > 1)
-		::sort((HIERListEntry *)list, list.size(), comp, 0);
+		std::sort((HIERListEntry *)list, (HIERListEntry *)list + list.size(), comp);

 	    // Sort subentries
 	    for(i = 0; i < list.size(); i++)
@@ -519,9 +522,9 @@
 	class EntryCompare
 	    {
 	    public:
-		int operator()(HIERListEntry& l1, HIERListEntry& l2)
+		bool operator()(const HIERListEntry& l1, const HIERListEntry& l2)
 		    {
-		    return strcmp(l1.name, l2.name);
+		    return strcmp(l1.name, l2.name) < 0;
 		    }
 	    };
 	void addEntry(Entry *entry, HIERlist *hl);
--- doc++-3.4.10/src/readfiles.ll	2001-11-25 18:04:48.000000000 +0100
+++ doc++-3.4.10/src/readfiles.ll	2005-05-10 15:02:18.000000000 +0200
@@ -28,7 +28,6 @@
 #include <sys/types.h>

 #include "McDirectory.h"
-#include "McSorter.h"
 #include "McString.h"
 #include "doc.h"
 #include "nametable.h"


code:
Use a non-recursive replace function when the parser supports it.

https://bugs.gnu.org/29782
https://bugzilla.samba.org/show_bug.cgi?id=9515
https://bugzilla.gnome.org/show_bug.cgi?id=736077 (for xsltproc)

Patch copied from Debian:
https://anonscm.debian.org/cgit/collab-maint/docbook-xsl.git/tree/debian/patches/765567_non-recursive_string_subst.patch

Description: use EXSLT "replace" function when available
 A recursive implementation  of string.subst is problematic,
 long strings with many matches will cause stack overflows.
Author: Peter De Wachter <pdewacht@gmail.com>
Bug-Debian: https://bugs.debian.org/750593

--- a/lib/lib.xsl
+++ b/lib/lib.xsl
@@ -10,7 +10,10 @@
      This module implements DTD-independent functions

      ******************************************************************** -->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:str="http://exslt.org/strings"
+                exclude-result-prefixes="str"
+                version="1.0">

 <xsl:template name="dot.count">
   <!-- Returns the number of "." characters in a string -->
@@ -56,6 +59,9 @@
   <xsl:param name="replacement"/>

   <xsl:choose>
+    <xsl:when test="function-available('str:replace')">
+      <xsl:value-of select="str:replace($string, string($target), string($replacement))"/>
+    </xsl:when>
     <xsl:when test="contains($string, $target)">
       <xsl:variable name="rest">
         <xsl:call-template name="string.subst">


code:
From: Tobias Geerinckx-Rice <me@tobias.gr>
Date: Mon, 25 Jun 2018 00:34:52 +0200
Subject: dovecot-trees: Fix build with dovecot 2.3.

The following patch was taken verbatim from the upstream repository[0]
and will be included in the next release.

[0]: https://0xacab.org/riseuplabs/trees/commit/e136c32a044701d68b0235b8405357c5fca62a11
---
From e136c32a044701d68b0235b8405357c5fca62a11 Mon Sep 17 00:00:00 2001
From: David Goulet <dgoulet@ev0ke.net>
Date: Tue, 10 Apr 2018 13:48:01 -0400
Subject: [PATCH] Support dovecot 2.3

Untested but it builds now properly. Thanks to "smorks" for the report!

Fixes #16

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
---
 src/trees-istream.c | 4 ++++
 src/trees-ostream.c | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/src/trees-istream.c b/src/trees-istream.c
index b08ff16..e94be7d 100644
--- a/src/trees-istream.c
+++ b/src/trees-istream.c
@@ -431,5 +431,9 @@ trees_istream_create(struct istream *input,
   sstream->out_byte_count = 0;
 #endif

+#if DOVECOT_PREREQ(2, 3)
+	return i_stream_create(&sstream->istream, input, i_stream_get_fd(input), 0);
+#else
   return i_stream_create(&sstream->istream, input, i_stream_get_fd(input));
+#endif /* DOVECOT_PREREQ */
 }
diff --git a/src/trees-ostream.c b/src/trees-ostream.c
index 1b25a91..0cb7867 100644
--- a/src/trees-ostream.c
+++ b/src/trees-ostream.c
@@ -174,7 +174,14 @@ trees_ostream_sendv(struct ostream_private *stream,
 static int
 trees_ostream_flush(struct ostream_private *stream)
 {
+  /* This is pretty ugly but unfortunately between 2.2 and 2.3, Dovecot changed
+   * the expected value to be non zero in 2.3+ . */
+#if DOVECOT_PREREQ(2, 3)
+  ssize_t result = 1;
+#else
   ssize_t result = 0;
+#endif /* DOVECOT_PREREQ */
+
   struct trees_ostream *sstream = (struct trees_ostream *) stream;

   if (sstream->flushed) {
--
2.17.1