File ddr_1998-check-nofail-noxattr.diff of Package dd_rescue

commit 7944395ea224067e54f1a094ee91b20b93f5ef65
Author: Kurt Garloff <kurt@garloff.de>
Date:   Sun Apr 15 11:58:59 2018 +0200

    Avoid check fail if dd_rescue was built w/o xattr support.

diff --git a/Makefile b/Makefile
index 6c9f958..5d81353 100644
--- a/Makefile
+++ b/Makefile
@@ -63,6 +63,12 @@ else
   HAVE_OPENSSL=0
 endif
 
+ifeq ($(shell grep 'HAVE_ATTR_XATTR_H 1' config.h >/dev/null 2>&1 && echo 1), 1)
+  HAVE_XATTR=1
+else
+  HAVE_XATTR=0
+endif
+
 ifeq ($(CC),wcl386)
   CFLAGS = "-ox -wx $(EXTRA_CFLAGS)"
   DEFINES = -dMISS_STRSIGNAL -dMISS_PREAD -dVERSION=\"$(VERSION)\" -d__COMPILER__="\"$(COMPILER)\""
@@ -493,15 +499,9 @@ check: $(TARGETS) find_nonzero md5 sha1 sha256 sha512 fmt_no
 	#if test $(HAVE_LZO) = 1; then $(MAKE) check_lzo_test; fi
 	if test $(HAVE_LZO) = 1; then $(MAKE) check_lzo_fuzz; fi
 	# Tests for libddr_null
-	$(VG) ./dd_rescue -L ./libddr_null.so=debug dd_rescue /dev/null
-	# Tests with hash set_xattr and chk_xattr (with fallback as not all filesystems support xattrs ...)
-	$(VG) ./dd_rescue -tL ./libddr_hash.so=sha256:set_xattr:fallback dd_rescue /tmp/dd_rescue
-	$(VG) ./dd_rescue -L ./libddr_hash.so=sha256:chk_xattr:fallback /tmp/dd_rescue /dev/null
-	rm -f /tmp/dd_rescue CHECKSUMS.sha256
-	# Tests with prepend and append
-	$(VG) ./dd_rescue -tL ./libddr_hash.so=sha512:set_xattr:fallback:prepend=abc:append=xyz dd_rescue /tmp/dd_rescue
-	$(VG) ./dd_rescue  -L ./libddr_hash.so=sha512:chk_xattr:fallback /tmp/dd_rescue /dev/null && false || true
-	$(VG) ./dd_rescue  -L ./libddr_hash.so=sha512:chk_xattr:fallback:prepend=abc:append=xyz /tmp/dd_rescue /dev/null
+	$(VG) ./dd_rescue  -L ./libddr_null.so=debug dd_rescue /dev/null
+	# Hash tests with set_xattr and chk_xattr
+	if test $(HAVE_XATTR) = 1; then $(MAKE) check_xattr_storehash; fi
 	# Extra xattrs (should be preserved)
 	#make check_xattr_copy
 	# Tests with HMAC
@@ -514,6 +514,15 @@ check: $(TARGETS) find_nonzero md5 sha1 sha256 sha512 fmt_no
 	#$(MAKE) check_aes
 	$(MAKE) check_crypt
 
+check_xattr_storehash: $(TARGETS)
+	# Tests with hash set_xattr and chk_xattr (with fallback as not all filesystems support xattrs ...)
+	$(VG) ./dd_rescue -tL ./libddr_hash.so=sha256:set_xattr:fallback dd_rescue /tmp/dd_rescue
+	$(VG) ./dd_rescue  -L ./libddr_hash.so=sha256:chk_xattr:fallback /tmp/dd_rescue /dev/null
+	rm -f /tmp/dd_rescue CHECKSUMS.sha256
+	# Tests with prepend and append
+	$(VG) ./dd_rescue -tL ./libddr_hash.so=sha512:set_xattr:fallback:prepend=abc:append=xyz dd_rescue /tmp/dd_rescue
+	$(VG) ./dd_rescue  -L ./libddr_hash.so=sha512:chk_xattr:fallback /tmp/dd_rescue /dev/null && false || true
+	$(VG) ./dd_rescue  -L ./libddr_hash.so=sha512:chk_xattr:fallback:prepend=abc:append=xyz /tmp/dd_rescue /dev/null
 
 # FIXME: This fails on filesystems without xattr support - disabled until we know how to handle this
 check_xattr_copy: $(TARGETS)
commit 919323921daed3afc339079378d1af58f0252840
Author: Kurt Garloff <kurt@garloff.de>
Date:   Sun Apr 15 17:04:03 2018 +0200

    Also avoid xattr usage in test_crypt.sh if not supported.

diff --git a/test_crypt.sh b/test_crypt.sh
index 0aef640..47f1fc9 100755
--- a/test_crypt.sh
+++ b/test_crypt.sh
@@ -170,10 +170,12 @@ done
 echo "*** Salt and XAttrs ***"
 # Use random numbers and write to binary file
 enc_dec_compare dd_rescue AES192-CTR saltgen pass=PWD_:pbkdf2:saltfile=SALT
-# Use random numbers and write to xattr, fall back to saltsfile
-enc_dec_compare dd_rescue AES192-CTR saltgen pass=PSWD:pbkdf2:saltxattr:sxfallback
-# Save key and IV to xattrs
-enc_dec_compare dd_rescue AES192-CTR keygen:ivgen keyxattr:kxfallb:ivxattr:ixfallb
+if grep 'define HAVE_ATTR_XATTR_H 1' config.h >/dev/null 2>&1 ; then
+  # Use random numbers and write to xattr, fall back to saltsfile
+  enc_dec_compare dd_rescue AES192-CTR saltgen pass=PSWD:pbkdf2:saltxattr:sxfallback
+  # Save key and IV to xattrs
+  enc_dec_compare dd_rescue AES192-CTR keygen:ivgen keyxattr:kxfallb:ivxattr:ixfallb
+fi
 
 HAVE_AESNI=`grep " sse4" /proc/cpuinfo 2>/dev/null | grep " aes " 2>/dev/null`
 HAVE_AESARM=`grep " pmull " /proc/cpuinfo 2>/dev/null`
openSUSE Build Service is sponsored by