Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Apr 2015 18:03:27 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r281316 - in head: contrib/xz contrib/xz/src/common contrib/xz/src/liblzma/api/lzma contrib/xz/src/liblzma/common contrib/xz/src/liblzma/lz contrib/xz/src/liblzma/lzma contrib/xz/src/xz...
Message-ID:  <201504091803.t39I3R4Y042146@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Thu Apr  9 18:03:27 2015
New Revision: 281316
URL: https://svnweb.freebsd.org/changeset/base/281316

Log:
  MFV r281278:
  
   - Update xz to 5.2.1, where the most visible change is that it
     fixed a compression-ratio regression in fast mode LZMA1 and
     LZMA2 and used cpuset_getaffinity() for CPU cores detection.
   - Make liblzma use the base system SHA256 implementation instead of
     the bundled one.
   - Additional annotation in config.h for FreeBSD specific tweaks.
   - Refresh symbols in XZprivate_1.0 to reflect reality.
  
  Relnotes:	yes
  MFC after:	1 month (TBD)

Modified:
  head/contrib/xz/ChangeLog
  head/contrib/xz/THANKS
  head/contrib/xz/src/common/tuklib_cpucores.c
  head/contrib/xz/src/common/tuklib_integer.h
  head/contrib/xz/src/liblzma/api/lzma/version.h
  head/contrib/xz/src/liblzma/common/memcmplen.h
  head/contrib/xz/src/liblzma/lz/lz_encoder.c
  head/contrib/xz/src/liblzma/lzma/lzma_encoder_optimum_fast.c
  head/contrib/xz/src/xz/file_io.c
  head/lib/liblzma/Makefile
  head/lib/liblzma/Symbol.map
  head/lib/liblzma/config.h
Directory Properties:
  head/contrib/xz/   (props changed)

Modified: head/contrib/xz/ChangeLog
==============================================================================
--- head/contrib/xz/ChangeLog	Thu Apr  9 17:56:25 2015	(r281315)
+++ head/contrib/xz/ChangeLog	Thu Apr  9 18:03:27 2015	(r281316)
@@ -1,3 +1,233 @@
+commit dec11497a71518423b5ff0e759100cf8aadf6c7b
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-02-26 16:53:44 +0200
+
+    Bump version and soname for 5.2.1.
+
+ src/liblzma/Makefile.am        | 2 +-
+ src/liblzma/api/lzma/version.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 29e39c79975ab89ee5dd671e97064534a9f3a649
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-02-26 13:01:09 +0200
+
+    Update NEWS for 5.2.1.
+
+ NEWS | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+commit 7a11c4a8e5e15f13d5fa59233b3172e65428efdd
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-02-22 19:38:48 +0200
+
+    xz: Use pipe2() if available.
+
+ configure.ac     | 4 ++--
+ src/xz/file_io.c | 9 ++++++++-
+ 2 files changed, 10 insertions(+), 3 deletions(-)
+
+commit 117d962685c72682c63edc9bb765367189800202
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-02-21 23:40:26 +0200
+
+    liblzma: Fix a compression-ratio regression in LZMA1/2 in fast mode.
+    
+    The bug was added in the commit
+    f48fce093b07aeda95c18850f5e086d9f2383380 and thus
+    affected 5.1.4beta and 5.2.0. Luckily the bug cannot
+    cause data corruption or other nasty things.
+
+ src/liblzma/lzma/lzma_encoder_optimum_fast.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit ae984e31c167d3bc52972ec422dd1ebd5f5d5719
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-02-21 23:00:19 +0200
+
+    xz: Fix the fcntl() usage when creating a pipe for the self-pipe trick.
+    
+    Now it reads the old flags instead of blindly setting O_NONBLOCK.
+    The old code may have worked correctly, but this is better.
+
+ src/xz/file_io.c | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+commit 2205bb5853098aea36a56df6f5747037175f66b4
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-02-10 15:29:34 +0200
+
+    Update THANKS.
+
+ THANKS | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit d935b0cdf3db440269b9d952b2b281b18f8c7b08
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-02-10 15:28:30 +0200
+
+    tuklib_cpucores: Use cpuset_getaffinity() on FreeBSD if available.
+    
+    In FreeBSD, cpuset_getaffinity() is the preferred way to get
+    the number of available cores.
+    
+    Thanks to Rui Paulo for the patch. I edited it slightly, but
+    hopefully I didn't break anything.
+
+ m4/tuklib_cpucores.m4        | 23 ++++++++++++++++++++++-
+ src/common/tuklib_cpucores.c | 18 ++++++++++++++++++
+ 2 files changed, 40 insertions(+), 1 deletion(-)
+
+commit eb61bc58c20769cac4d05f363b9c0e8c9c71a560
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-02-09 22:08:37 +0200
+
+    xzdiff: Make the mktemp usage compatible with FreeBSD's mktemp.
+    
+    Thanks to Rui Paulo for the fix.
+
+ src/scripts/xzdiff.in | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+commit b9a5b6b7a29029680af733082b6a46e0fc01623a
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-02-03 21:45:53 +0200
+
+    Add a few casts to tuklib_integer.h to silence possible warnings.
+    
+    I heard that Visual Studio 2013 gave warnings without the casts.
+    
+    Thanks to Gabi Davar.
+
+ src/common/tuklib_integer.h | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+commit c45757135f40e4a0de730ba5fff0100219493982
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-01-26 21:24:39 +0200
+
+    liblzma: Set LZMA_MEMCMPLEN_EXTRA depending on the compare method.
+
+ src/liblzma/common/memcmplen.h | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+commit 3c500174ed5485f550972a2a6109c361e875f069
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-01-26 20:40:16 +0200
+
+    Update THANKS.
+
+ THANKS | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit fec88d41e672d9e197c9442aecf02bd0dfa6d516
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-01-26 20:39:28 +0200
+
+    liblzma: Silence harmless Valgrind errors.
+    
+    Thanks to Torsten Rupp for reporting this. I had
+    forgotten to run Valgrind before the 5.2.0 release.
+
+ src/liblzma/lz/lz_encoder.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+commit a9b45badfec0928d20a27c7176c005fa637f7d1e
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-01-09 21:50:19 +0200
+
+    xz: Fix comments.
+
+ src/xz/file_io.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+commit 541aee6dd4aa97a809aba281475a21b641bb89e2
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-01-09 21:35:06 +0200
+
+    Update THANKS.
+
+ THANKS | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 4170edc914655310d2363baccf5e615e09b04911
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-01-09 21:34:06 +0200
+
+    xz: Don't fail if stdout doesn't support O_NONBLOCK.
+    
+    This is similar to the case with stdin.
+    
+    Thanks to Brad Smith for the bug report and testing
+    on OpenBSD.
+
+ src/xz/file_io.c | 36 +++++++++++++++---------------------
+ 1 file changed, 15 insertions(+), 21 deletions(-)
+
+commit 04bbc0c2843c50c8ad1cba42b937118e38b0508d
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-01-07 19:18:20 +0200
+
+    xz: Fix a memory leak in DOS-specific code.
+
+ src/xz/file_io.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit f0f1f6c7235ffa901cf76fe18e33749e200b3eea
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-01-07 19:08:06 +0200
+
+    xz: Don't fail if stdin doesn't support O_NONBLOCK.
+    
+    It's a problem at least on OpenBSD which doesn't support
+    O_NONBLOCK on e.g. /dev/null. I'm not surprised if it's
+    a problem on other OSes too since this behavior is allowed
+    in POSIX-1.2008.
+    
+    The code relying on this behavior was committed in June 2013
+    and included in 5.1.3alpha released on 2013-10-26. Clearly
+    the development releases only get limited testing.
+
+ src/xz/file_io.c | 18 +++++++-----------
+ 1 file changed, 7 insertions(+), 11 deletions(-)
+
+commit d2d484647d9d9d679f03c75abb0404f67069271c
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2015-01-06 20:30:15 +0200
+
+    Tests: Don't hide unexpected error messages in test_files.sh.
+    
+    Hiding them makes no sense since normally there's no error
+    when testing the "good" files. With "bad" files errors are
+    expected and then it makes sense to keep the messages hidden.
+
+ tests/test_files.sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit aae6a6aeda51cf94a47e39ad624728f9bee75e30
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2014-12-30 11:17:16 +0200
+
+    Update Solaris notes in INSTALL.
+    
+    Mention the possible "make check" failure on Solaris in the
+    Solaris-specific section of INSTALL. It was already in
+    section 4.5 but it is better mention it in the OS-specific
+    section too.
+
+ INSTALL | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+commit 7815112153178800a3521b9f31960e7cdc26cfba
+Author: Lasse Collin <lasse.collin@tukaani.org>
+Date:   2014-12-26 12:00:05 +0200
+
+    Build: POSIX shell isn't required if scripts are disabled.
+
+ INSTALL      | 3 ++-
+ configure.ac | 2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
 commit a0cd05ee71d330b79ead6eb9222e1b24e1559d3a
 Author: Lasse Collin <lasse.collin@tukaani.org>
 Date:   2014-12-21 20:48:37 +0200

Modified: head/contrib/xz/THANKS
==============================================================================
--- head/contrib/xz/THANKS	Thu Apr  9 17:56:25 2015	(r281315)
+++ head/contrib/xz/THANKS	Thu Apr  9 18:03:27 2015	(r281316)
@@ -67,6 +67,7 @@ has been important. :-) In alphabetical 
   - Andre Noll
   - Peter O'Gorman
   - Peter Pallinger
+  - Rui Paulo
   - Igor Pavlov
   - Diego Elio Pettenò
   - Elbert Pol
@@ -78,12 +79,14 @@ has been important. :-) In alphabetical 
   - Eric S. Raymond
   - Cristian Rodríguez
   - Christian von Roques
+  - Torsten Rupp
   - Jukka Salmi
   - Alexandre Sauvé
   - Benno Schulenberg
   - Andreas Schwab
   - Dan Shechter
   - Stuart Shelton
+  - Brad Smith
   - Jonathan Stott
   - Dan Stromberg
   - Vincent Torri

Modified: head/contrib/xz/src/common/tuklib_cpucores.c
==============================================================================
--- head/contrib/xz/src/common/tuklib_cpucores.c	Thu Apr  9 17:56:25 2015	(r281315)
+++ head/contrib/xz/src/common/tuklib_cpucores.c	Thu Apr  9 18:03:27 2015	(r281316)
@@ -18,6 +18,11 @@
 #	endif
 #	include <windows.h>
 
+// FreeBSD
+#elif defined(TUKLIB_CPUCORES_CPUSET)
+#	include <sys/param.h>
+#	include <sys/cpuset.h>
+
 #elif defined(TUKLIB_CPUCORES_SYSCTL)
 #	ifdef HAVE_SYS_PARAM_H
 #		include <sys/param.h>
@@ -44,6 +49,19 @@ tuklib_cpucores(void)
 	GetSystemInfo(&sysinfo);
 	ret = sysinfo.dwNumberOfProcessors;
 
+#elif defined(TUKLIB_CPUCORES_CPUSET)
+	cpuset_t set;
+	if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1,
+			sizeof(set), &set) == 0) {
+#	ifdef CPU_COUNT
+		ret = CPU_COUNT(&set);
+#	else
+		for (unsigned i = 0; i < CPU_SETSIZE; ++i)
+			if (CPU_ISSET(i, &set))
+				++ret;
+#	endif
+	}
+
 #elif defined(TUKLIB_CPUCORES_SYSCTL)
 	int name[2] = { CTL_HW, HW_NCPU };
 	int cpus;

Modified: head/contrib/xz/src/common/tuklib_integer.h
==============================================================================
--- head/contrib/xz/src/common/tuklib_integer.h	Thu Apr  9 17:56:25 2015	(r281315)
+++ head/contrib/xz/src/common/tuklib_integer.h	Thu Apr  9 18:03:27 2015	(r281316)
@@ -321,8 +321,8 @@ unaligned_read32le(const uint8_t *buf)
 static inline void
 unaligned_write16be(uint8_t *buf, uint16_t num)
 {
-	buf[0] = num >> 8;
-	buf[1] = num;
+	buf[0] = (uint8_t)(num >> 8);
+	buf[1] = (uint8_t)num;
 	return;
 }
 
@@ -330,8 +330,8 @@ unaligned_write16be(uint8_t *buf, uint16
 static inline void
 unaligned_write16le(uint8_t *buf, uint16_t num)
 {
-	buf[0] = num;
-	buf[1] = num >> 8;
+	buf[0] = (uint8_t)num;
+	buf[1] = (uint8_t)(num >> 8);
 	return;
 }
 
@@ -339,10 +339,10 @@ unaligned_write16le(uint8_t *buf, uint16
 static inline void
 unaligned_write32be(uint8_t *buf, uint32_t num)
 {
-	buf[0] = num >> 24;
-	buf[1] = num >> 16;
-	buf[2] = num >> 8;
-	buf[3] = num;
+	buf[0] = (uint8_t)(num >> 24);
+	buf[1] = (uint8_t)(num >> 16);
+	buf[2] = (uint8_t)(num >> 8);
+	buf[3] = (uint8_t)num;
 	return;
 }
 
@@ -350,10 +350,10 @@ unaligned_write32be(uint8_t *buf, uint32
 static inline void
 unaligned_write32le(uint8_t *buf, uint32_t num)
 {
-	buf[0] = num;
-	buf[1] = num >> 8;
-	buf[2] = num >> 16;
-	buf[3] = num >> 24;
+	buf[0] = (uint8_t)num;
+	buf[1] = (uint8_t)(num >> 8);
+	buf[2] = (uint8_t)(num >> 16);
+	buf[3] = (uint8_t)(num >> 24);
 	return;
 }
 

Modified: head/contrib/xz/src/liblzma/api/lzma/version.h
==============================================================================
--- head/contrib/xz/src/liblzma/api/lzma/version.h	Thu Apr  9 17:56:25 2015	(r281315)
+++ head/contrib/xz/src/liblzma/api/lzma/version.h	Thu Apr  9 18:03:27 2015	(r281316)
@@ -22,7 +22,7 @@
  */
 #define LZMA_VERSION_MAJOR 5
 #define LZMA_VERSION_MINOR 2
-#define LZMA_VERSION_PATCH 0
+#define LZMA_VERSION_PATCH 1
 #define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
 
 #ifndef LZMA_VERSION_COMMIT

Modified: head/contrib/xz/src/liblzma/common/memcmplen.h
==============================================================================
--- head/contrib/xz/src/liblzma/common/memcmplen.h	Thu Apr  9 17:56:25 2015	(r281315)
+++ head/contrib/xz/src/liblzma/common/memcmplen.h	Thu Apr  9 18:03:27 2015	(r281316)
@@ -19,11 +19,6 @@
 #	include <immintrin.h>
 #endif
 
-/// How many extra bytes lzma_memcmplen() may read. This depends on
-/// the method but since it is just a few bytes the biggest possible
-/// value is used here.
-#define LZMA_MEMCMPLEN_EXTRA 16
-
 
 /// Find out how many equal bytes the two buffers have.
 ///
@@ -39,6 +34,11 @@
 ///
 /// \return     Number of equal bytes in the buffers is returned.
 ///             This is always at least len and at most limit.
+///
+/// \note       LZMA_MEMCMPLEN_EXTRA defines how many extra bytes may be read.
+///             It's rounded up to 2^n. This extra amount needs to be
+///             allocated in the buffers being used. It needs to be
+///             initialized too to keep Valgrind quiet.
 static inline uint32_t lzma_attribute((__always_inline__))
 lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2,
 		uint32_t len, uint32_t limit)
@@ -59,6 +59,7 @@ lzma_memcmplen(const uint8_t *buf1, cons
 	// to be a good method. This may be fine on other 64-bit CPUs too.
 	// On big endian one should use xor instead of subtraction and switch
 	// to __builtin_clzll().
+#define LZMA_MEMCMPLEN_EXTRA 8
 	while (len < limit) {
 		const uint64_t x = *(const uint64_t *)(buf1 + len)
 				- *(const uint64_t *)(buf2 + len);
@@ -91,6 +92,7 @@ lzma_memcmplen(const uint8_t *buf1, cons
 	// version is sometimes significantly faster and sometimes
 	// slightly slower than this SSE2 version, so this SSE2
 	// version isn't used on x86-64.
+#	define LZMA_MEMCMPLEN_EXTRA 16
 	while (len < limit) {
 		const uint32_t x = 0xFFFF ^ _mm_movemask_epi8(_mm_cmpeq_epi8(
 			_mm_loadu_si128((const __m128i *)(buf1 + len)),
@@ -116,6 +118,7 @@ lzma_memcmplen(const uint8_t *buf1, cons
 
 #elif defined(TUKLIB_FAST_UNALIGNED_ACCESS) && !defined(WORDS_BIGENDIAN)
 	// Generic 32-bit little endian method
+#	define LZMA_MEMCMPLEN_EXTRA 4
 	while (len < limit) {
 		uint32_t x = *(const uint32_t *)(buf1 + len)
 				- *(const uint32_t *)(buf2 + len);
@@ -138,6 +141,7 @@ lzma_memcmplen(const uint8_t *buf1, cons
 
 #elif defined(TUKLIB_FAST_UNALIGNED_ACCESS) && defined(WORDS_BIGENDIAN)
 	// Generic 32-bit big endian method
+#	define LZMA_MEMCMPLEN_EXTRA 4
 	while (len < limit) {
 		uint32_t x = *(const uint32_t *)(buf1 + len)
 				^ *(const uint32_t *)(buf2 + len);
@@ -160,6 +164,7 @@ lzma_memcmplen(const uint8_t *buf1, cons
 
 #else
 	// Simple portable version that doesn't use unaligned access.
+#	define LZMA_MEMCMPLEN_EXTRA 0
 	while (len < limit && buf1[len] == buf2[len])
 		++len;
 

Modified: head/contrib/xz/src/liblzma/lz/lz_encoder.c
==============================================================================
--- head/contrib/xz/src/liblzma/lz/lz_encoder.c	Thu Apr  9 17:56:25 2015	(r281315)
+++ head/contrib/xz/src/liblzma/lz/lz_encoder.c	Thu Apr  9 18:03:27 2015	(r281316)
@@ -110,6 +110,12 @@ fill_window(lzma_coder *coder, const lzm
 
 	coder->mf.write_pos = write_pos;
 
+	// Silence Valgrind. lzma_memcmplen() can read extra bytes
+	// and Valgrind will give warnings if those bytes are uninitialized
+	// because Valgrind cannot see that the values of the uninitialized
+	// bytes are eventually ignored.
+	memzero(coder->mf.buffer + write_pos, LZMA_MEMCMPLEN_EXTRA);
+
 	// If end of stream has been reached or flushing completed, we allow
 	// the encoder to process all the input (that is, read_pos is allowed
 	// to reach write_pos). Otherwise we keep keep_size_after bytes

Modified: head/contrib/xz/src/liblzma/lzma/lzma_encoder_optimum_fast.c
==============================================================================
--- head/contrib/xz/src/liblzma/lzma/lzma_encoder_optimum_fast.c	Thu Apr  9 17:56:25 2015	(r281315)
+++ head/contrib/xz/src/liblzma/lzma/lzma_encoder_optimum_fast.c	Thu Apr  9 18:03:27 2015	(r281316)
@@ -152,7 +152,7 @@ lzma_lzma_optimum_fast(lzma_coder *restr
 	// the old buf pointer instead of recalculating it with mf_ptr().
 	++buf;
 
-	const uint32_t limit = len_main - 1;
+	const uint32_t limit = my_max(2, len_main - 1);
 
 	for (uint32_t i = 0; i < REPS; ++i) {
 		if (memcmp(buf, buf - coder->reps[i] - 1, limit) == 0) {

Modified: head/contrib/xz/src/xz/file_io.c
==============================================================================
--- head/contrib/xz/src/xz/file_io.c	Thu Apr  9 17:56:25 2015	(r281315)
+++ head/contrib/xz/src/xz/file_io.c	Thu Apr  9 18:03:27 2015	(r281316)
@@ -82,13 +82,26 @@ io_init(void)
 	// we are root.
 	warn_fchown = geteuid() == 0;
 
-	if (pipe(user_abort_pipe)
-			|| fcntl(user_abort_pipe[0], F_SETFL, O_NONBLOCK)
-				== -1
-			|| fcntl(user_abort_pipe[1], F_SETFL, O_NONBLOCK)
-				== -1)
+	// Create a pipe for the self-pipe trick. If pipe2() is available,
+	// we can avoid the fcntl() calls.
+#	ifdef HAVE_PIPE2
+	if (pipe2(user_abort_pipe, O_NONBLOCK))
 		message_fatal(_("Error creating a pipe: %s"),
 				strerror(errno));
+#	else
+	if (pipe(user_abort_pipe))
+		message_fatal(_("Error creating a pipe: %s"),
+				strerror(errno));
+
+	// Make both ends of the pipe non-blocking.
+	for (unsigned i = 0; i < 2; ++i) {
+		int flags = fcntl(user_abort_pipe[i], F_GETFL);
+		if (flags == -1 || fcntl(user_abort_pipe[i], F_SETFL,
+				flags | O_NONBLOCK) == -1)
+			message_fatal(_("Error creating a pipe: %s"),
+					strerror(errno));
+	}
+#	endif
 #endif
 
 #ifdef __DJGPP__
@@ -393,7 +406,11 @@ io_open_src_real(file_pair *pair)
 #ifdef TUKLIB_DOSLIKE
 		setmode(STDIN_FILENO, O_BINARY);
 #else
-		// Enable O_NONBLOCK for stdin.
+		// Try to set stdin to non-blocking mode. It won't work
+		// e.g. on OpenBSD if stdout is e.g. /dev/null. In such
+		// case we proceed as if stdin were non-blocking anyway
+		// (in case of /dev/null it will be in practice). The
+		// same applies to stdout in io_open_dest_real().
 		stdin_flags = fcntl(STDIN_FILENO, F_GETFL);
 		if (stdin_flags == -1) {
 			message_error(_("Error getting the file status flags "
@@ -402,17 +419,10 @@ io_open_src_real(file_pair *pair)
 			return true;
 		}
 
-		if ((stdin_flags & O_NONBLOCK) == 0) {
-			if (fcntl(STDIN_FILENO, F_SETFL,
-					stdin_flags | O_NONBLOCK) == -1) {
-				message_error(_("Error setting O_NONBLOCK "
-						"on standard input: %s"),
-						strerror(errno));
-				return true;
-			}
-
+		if ((stdin_flags & O_NONBLOCK) == 0
+				&& fcntl(STDIN_FILENO, F_SETFL,
+					stdin_flags | O_NONBLOCK) != -1)
 			restore_stdin_flags = true;
-		}
 #endif
 #ifdef HAVE_POSIX_FADVISE
 		// It will fail if stdin is a pipe and that's fine.
@@ -705,7 +715,10 @@ io_open_dest_real(file_pair *pair)
 #ifdef TUKLIB_DOSLIKE
 		setmode(STDOUT_FILENO, O_BINARY);
 #else
-		// Set O_NONBLOCK if it isn't already set.
+		// Try to set O_NONBLOCK if it isn't already set.
+		// If it fails, we assume that stdout is non-blocking
+		// in practice. See the comments in io_open_src_real()
+		// for similar situation with stdin.
 		//
 		// NOTE: O_APPEND may be unset later in this function
 		// and it relies on stdout_flags being set here.
@@ -717,17 +730,10 @@ io_open_dest_real(file_pair *pair)
 			return true;
 		}
 
-		if ((stdout_flags & O_NONBLOCK) == 0) {
-			if (fcntl(STDOUT_FILENO, F_SETFL,
-					stdout_flags | O_NONBLOCK) == -1) {
-				message_error(_("Error setting O_NONBLOCK "
-						"on standard output: %s"),
-						strerror(errno));
-				return true;
-			}
-
-			restore_stdout_flags = true;
-		}
+		if ((stdout_flags & O_NONBLOCK) == 0
+				&& fcntl(STDOUT_FILENO, F_SETFL,
+					stdout_flags | O_NONBLOCK) != -1)
+				restore_stdout_flags = true;
 #endif
 	} else {
 		pair->dest_name = suffix_get_dest_name(pair->src_name);
@@ -742,6 +748,7 @@ io_open_dest_real(file_pair *pair)
 				message_error("%s: Refusing to write to "
 						"a DOS special file",
 						pair->dest_name);
+				free(pair->dest_name);
 				return true;
 			}
 
@@ -751,6 +758,7 @@ io_open_dest_real(file_pair *pair)
 				message_error("%s: Output file is the same "
 						"as the input file",
 						pair->dest_name);
+				free(pair->dest_name);
 				return true;
 			}
 		}
@@ -829,23 +837,24 @@ io_open_dest_real(file_pair *pair)
 				if (lseek(STDOUT_FILENO, 0, SEEK_END) == -1)
 					return false;
 
-				// O_NONBLOCK was set earlier in this function
-				// so it must be kept here too. If this
-				// fcntl() call fails, we continue but won't
+				// Construct the new file status flags.
+				// If O_NONBLOCK was set earlier in this
+				// function, it must be kept here too.
+				int flags = stdout_flags & ~O_APPEND;
+				if (restore_stdout_flags)
+					flags |= O_NONBLOCK;
+
+				// If this fcntl() fails, we continue but won't
 				// try to create sparse output. The original
 				// flags will still be restored if needed (to
 				// unset O_NONBLOCK) when the file is finished.
-				if (fcntl(STDOUT_FILENO, F_SETFL,
-						(stdout_flags | O_NONBLOCK)
-						& ~O_APPEND) == -1)
+				if (fcntl(STDOUT_FILENO, F_SETFL, flags) == -1)
 					return false;
 
 				// Disabling O_APPEND succeeded. Mark
 				// that the flags should be restored
-				// in io_close_dest(). This quite likely was
-				// already set when enabling O_NONBLOCK but
-				// just in case O_NONBLOCK was already set,
-				// set this again here.
+				// in io_close_dest(). (This may have already
+				// been set when enabling O_NONBLOCK.)
 				restore_stdout_flags = true;
 
 			} else if (lseek(STDOUT_FILENO, 0, SEEK_CUR)

Modified: head/lib/liblzma/Makefile
==============================================================================
--- head/lib/liblzma/Makefile	Thu Apr  9 17:56:25 2015	(r281315)
+++ head/lib/liblzma/Makefile	Thu Apr  9 18:03:27 2015	(r281316)
@@ -77,8 +77,7 @@ SRCS+=	common.c \
 .PATH: ${LZMADIR}/check
 SRCS+=	check.c \
 	crc32_table.c \
-	crc64_table.c \
-	sha256.c
+	crc64_table.c
 .if defined(MACHINE_ARCH) && ${MACHINE_ARCH} == "i386"
 SRCS+=	crc32_x86.S \
 	crc64_x86.S
@@ -146,7 +145,7 @@ CFLAGS+=	-DHAVE_CONFIG_H \
 		-I${LZMADIR}/simple \
 		-I${LZMADIR}/../common
 
-LIBADD+=	pthread
+LIBADD+=	md pthread
 
 VERSION_DEF=	${.CURDIR}/Versions.def
 SYMBOL_MAPS=	${.CURDIR}/Symbol.map

Modified: head/lib/liblzma/Symbol.map
==============================================================================
--- head/lib/liblzma/Symbol.map	Thu Apr  9 17:56:25 2015	(r281315)
+++ head/lib/liblzma/Symbol.map	Thu Apr  9 18:03:27 2015	(r281316)
@@ -108,7 +108,9 @@ XZ_5.2 {
 
 XZprivate_1.0 {
 	lzma_alloc;
+	lzma_alloc_zero;
 	lzma_alone_decoder_init;
+	lzma_block_buffer_bound64;
 	lzma_block_decoder_init;
 	lzma_block_encoder_init;
 	lzma_bufcpy;
@@ -131,6 +133,7 @@ XZprivate_1.0 {
 	lzma_lz_decoder_uncompressed;
 	lzma_lz_encoder_init;
 	lzma_lz_encoder_memusage;
+	lzma_lzma2_block_size;
 	lzma_lzma2_decoder_init;
 	lzma_lzma2_decoder_memusage;
 	lzma_lzma2_encoder_init;
@@ -163,16 +166,20 @@ XZprivate_1.0 {
 	lzma_mf_hc3_skip;
 	lzma_mf_hc4_find;
 	lzma_mf_hc4_skip;
+	lzma_mt_block_size;
 	lzma_next_end;
 	lzma_next_filter_init;
 	lzma_next_filter_update;
+	lzma_outq_end;
+	lzma_outq_get_buf;
+	lzma_outq_init;
+	lzma_outq_is_readable;
+	lzma_outq_memusage;
+	lzma_outq_read;
 	lzma_raw_coder_init;
 	lzma_raw_coder_memusage;
 	lzma_raw_decoder_init;
 	lzma_raw_encoder_init;
-	lzma_sha256_finish;
-	lzma_sha256_init;
-	lzma_sha256_update;
 	lzma_simple_arm_decoder_init;
 	lzma_simple_arm_encoder_init;
 	lzma_simple_armthumb_decoder_init;
@@ -190,7 +197,7 @@ XZprivate_1.0 {
 	lzma_simple_x86_decoder_init;
 	lzma_simple_x86_encoder_init;
 	lzma_stream_decoder_init;
-	lzma_stream_encoder_init;
 	lzma_strm_init;
+	lzma_tuklib_cpucores;
 	lzma_tuklib_physmem;
 };

Modified: head/lib/liblzma/config.h
==============================================================================
--- head/lib/liblzma/config.h	Thu Apr  9 17:56:25 2015	(r281315)
+++ head/lib/liblzma/config.h	Thu Apr  9 18:03:27 2015	(r281316)
@@ -1,95 +1,424 @@
 /* $FreeBSD$ */
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* How many MiB of RAM to assume if the real amount cannot be determined. */
 #define ASSUME_RAM 128
+
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+/* FreeBSD - disabled intentionally */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if bswap_16 is available. */
+/* #undef HAVE_BSWAP_16 */
+
+/* Define to 1 if bswap_32 is available. */
+/* #undef HAVE_BSWAP_32 */
+
+/* Define to 1 if bswap_64 is available. */
+/* #undef HAVE_BSWAP_64 */
+
+/* Define to 1 if you have the <byteswap.h> header file. */
+/* #undef HAVE_BYTESWAP_H */
+
+/* Define to 1 if the system has the type `CC_SHA256_CTX'. */
+/* #undef HAVE_CC_SHA256_CTX */
+
+/* Define to 1 if you have the `CC_SHA256_Init' function. */
+/* #undef HAVE_CC_SHA256_INIT */
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+   CoreFoundation framework. */
+/* #undef HAVE_CFLOCALECOPYCURRENT */
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+   the CoreFoundation framework. */
+/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
+
+/* Define to 1 if crc32 integrity check is enabled. */
 #define HAVE_CHECK_CRC32 1
+
+/* Define to 1 if crc64 integrity check is enabled. */
 #define HAVE_CHECK_CRC64 1
+
+/* Define to 1 if sha256 integrity check is enabled. */
 #define HAVE_CHECK_SHA256 1
+
+/* Define to 1 if you have the `clock_gettime' function. */
 #define HAVE_CLOCK_GETTIME 1
+
+/* Define to 1 if you have the <CommonCrypto/CommonDigest.h> header file. */
+/* #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H */
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+/* FreeBSD - disabled intentionally */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC', and to 0 if
+   you don't. */
 #define HAVE_DECL_CLOCK_MONOTONIC 1
+
+/* Define to 1 if you have the declaration of `program_invocation_name', and
+   to 0 if you don't. */
 #define HAVE_DECL_PROGRAM_INVOCATION_NAME 0
+
+/* Define to 1 if arm decoder is enabled. */
 #define HAVE_DECODER_ARM 1
+
+/* Define to 1 if armthumb decoder is enabled. */
 #define HAVE_DECODER_ARMTHUMB 1
+
+/* Define to 1 if delta decoder is enabled. */
 #define HAVE_DECODER_DELTA 1
+
+/* Define to 1 if ia64 decoder is enabled. */
 #define HAVE_DECODER_IA64 1
+
+/* Define to 1 if lzma1 decoder is enabled. */
 #define HAVE_DECODER_LZMA1 1
+
+/* Define to 1 if lzma2 decoder is enabled. */
 #define HAVE_DECODER_LZMA2 1
+
+/* Define to 1 if powerpc decoder is enabled. */
 #define HAVE_DECODER_POWERPC 1
+
+/* Define to 1 if sparc decoder is enabled. */
 #define HAVE_DECODER_SPARC 1
+
+/* Define to 1 if x86 decoder is enabled. */
 #define HAVE_DECODER_X86 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
 #define HAVE_DLFCN_H 1
+
+/* Define to 1 if arm encoder is enabled. */
 #define HAVE_ENCODER_ARM 1
+
+/* Define to 1 if armthumb encoder is enabled. */
 #define HAVE_ENCODER_ARMTHUMB 1
+
+/* Define to 1 if delta encoder is enabled. */
 #define HAVE_ENCODER_DELTA 1
+
+/* Define to 1 if ia64 encoder is enabled. */
 #define HAVE_ENCODER_IA64 1
+
+/* Define to 1 if lzma1 encoder is enabled. */
 #define HAVE_ENCODER_LZMA1 1
+
+/* Define to 1 if lzma2 encoder is enabled. */
 #define HAVE_ENCODER_LZMA2 1
+
+/* Define to 1 if powerpc encoder is enabled. */
 #define HAVE_ENCODER_POWERPC 1
+
+/* Define to 1 if sparc encoder is enabled. */
 #define HAVE_ENCODER_SPARC 1
+
+/* Define to 1 if x86 encoder is enabled. */
 #define HAVE_ENCODER_X86 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
 #define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `futimens' function. */
 #define HAVE_FUTIMENS 1
-#define HAVE_FUTIMES 1
+
+/* Define to 1 if you have the `futimes' function. */
+/* #undef HAVE_FUTIMES */
+
+/* Define to 1 if you have the `futimesat' function. */
+/* #undef HAVE_FUTIMESAT */
+
+/* Define to 1 if you have the <getopt.h> header file. */
 #define HAVE_GETOPT_H 1
+
+/* Define to 1 if you have the `getopt_long' function. */
 #define HAVE_GETOPT_LONG 1
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+/* FreeBSD - disabled intentionally */
+/* #undef HAVE_GETTEXT */
+
+/* Define if you have the iconv() function and it works. */
+#define HAVE_ICONV 1
+
+/* Define to 1 if you have the <immintrin.h> header file. */
+#if defined(__FreeBSD__) && defined(__amd64__)
+#define HAVE_IMMINTRIN_H 1
+#endif
+
+/* Define to 1 if you have the <inttypes.h> header file. */
 #define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <limits.h> header file. */
 #define HAVE_LIMITS_H 1
+
+/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
 #define HAVE_MBRTOWC 1
+
+/* Define to 1 if you have the <memory.h> header file. */
 #define HAVE_MEMORY_H 1
+
+/* Define to 1 to enable bt2 match finder. */
 #define HAVE_MF_BT2 1
+
+/* Define to 1 to enable bt3 match finder. */
 #define HAVE_MF_BT3 1
+
+/* Define to 1 to enable bt4 match finder. */
 #define HAVE_MF_BT4 1
+
+/* Define to 1 to enable hc3 match finder. */
 #define HAVE_MF_HC3 1
+
+/* Define to 1 to enable hc4 match finder. */
 #define HAVE_MF_HC4 1
+
+/* Define to 1 if you have the <minix/sha2.h> header file. */
+/* #undef HAVE_MINIX_SHA2_H */
+
+/* Define to 1 if getopt.h declares extern int optreset. */
 #define HAVE_OPTRESET 1
+
+/* Define to 1 if you have the `pipe2' function. */
+#define HAVE_PIPE2 1
+
+/* Define to 1 if you have the `posix_fadvise' function. */
 #define HAVE_POSIX_FADVISE 1
+
+/* Define to 1 if you have the `pthread_condattr_setclock' function. */
 #define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
+
+/* Have PTHREAD_PRIO_INHERIT. */
 #define HAVE_PTHREAD_PRIO_INHERIT 1
+
+/* Define to 1 if you have the `SHA256Init' function. */
+/* #undef HAVE_SHA256INIT */
+
+/* Define to 1 if the system has the type `SHA256_CTX'. */
+#define HAVE_SHA256_CTX 1
+
+/* Define to 1 if you have the <sha256.h> header file. */
+#define HAVE_SHA256_H 1
+
+/* Define to 1 if you have the `SHA256_Init' function. */
+#define HAVE_SHA256_INIT 1
+
+/* Define to 1 if the system has the type `SHA2_CTX'. */
+/* #undef HAVE_SHA2_CTX */
+
+/* Define to 1 if you have the <sha2.h> header file. */
+/* #undef HAVE_SHA2_H */
+
+/* Define to 1 if optimizing for size. */
+/* #undef HAVE_SMALL */
+
+/* Define to 1 if stdbool.h conforms to C99. */
 #define HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
 #define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
 #define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
 #define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
 #define HAVE_STRING_H 1
+
+/* Define to 1 if `st_atimensec' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_ATIMENSEC */
+
+/* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */
 #define HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC 1
+
+/* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC */
+
+/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */
 #define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1
+
+/* Define to 1 if `st_uatime' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_UATIME */
+
+/* Define to 1 if you have the <sys/byteorder.h> header file. */
+/* #undef HAVE_SYS_BYTEORDER_H */
+
+/* Define to 1 if you have the <sys/endian.h> header file. */
 #define HAVE_SYS_ENDIAN_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
 #define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
 #define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
 #define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
 #define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if the system has the type `uintptr_t'. */
 #define HAVE_UINTPTR_T 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
 #define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `utime' function. */
+/* #undef HAVE_UTIME */
+
+/* Define to 1 if you have the `utimes' function. */
+/* #undef HAVE_UTIMES */
+
+/* Define to 1 or 0, depending whether the compiler supports simple visibility
+   declarations. */
 #define HAVE_VISIBILITY 1
+
+/* Define to 1 if you have the `wcwidth' function. */
 #define HAVE_WCWIDTH 1
+
+/* Define to 1 if the system has the type `_Bool'. */
 #define HAVE__BOOL 1
+
+/* Define to 1 if _mm_movemask_epi8 is available. */
 #if defined(__FreeBSD__) && defined(__amd64__)
 #define HAVE__MM_MOVEMASK_EPI8 1
 #endif
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Define to 1 when using POSIX threads (pthreads). */
 #define MYTHREAD_POSIX 1
+
+/* Define to 1 when using Windows Vista compatible threads. This uses features
+   that are not available on Windows XP. */
+/* #undef MYTHREAD_VISTA */
+
+/* Define to 1 when using Windows 95 (and thus XP) compatible threads. This
+   avoids use of features that were added in Windows Vista. */
+/* #undef MYTHREAD_WIN95 */
+
+/* Define to 1 to disable debugging code. */
 #define NDEBUG 1
+
+/* Name of package */
 #define PACKAGE "xz"
+

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504091803.t39I3R4Y042146>