Description: Dump fails verifying long symlinks with ext4 extents
Author: Tim Woodall <debianbugs@woodall.me.uk>
Bug: http://bugs.debian.org/1081010
--- a/restore/dirs.c
+++ b/restore/dirs.c
@@ -796,7 +796,7 @@ comparedirmodes(void)
 				do_compare_error;
 			}
 #ifdef	__linux__
-			if (lgetflags(cp, &newflags) < 0) {
+			if (lgetflags(cp, &newflags, 0) < 0) {
 				if (node.flags != 0) {
 					warn("%s: lgetflags failed", cp);
 					do_compare_error;
--- a/restore/extern.h
+++ b/restore/extern.h
@@ -127,7 +127,7 @@ int fgetflags (const char *, unsigned lo
 int setflags (int, unsigned long);
 
 int lsetflags (const char *, unsigned long);
-int lgetflags (const char *, unsigned long *);
+int lgetflags (const char *, unsigned long *, unsigned long);
 
 #ifdef USE_QFA
 int	Inode2Tapepos (dump_ino_t, long *, long long *, int);
--- a/restore/tape.c
+++ b/restore/tape.c
@@ -1829,7 +1829,7 @@ comparefile(char *name)
 		do_compare_error;
 	}
 #ifdef  __linux__
-	if (lgetflags(name, &newflags) < 0) {
+	if (lgetflags(name, &newflags, flags) < 0) {
 		if (flags != 0) {
 			warn("%s: lgetflags failed", name);
 			do_compare_error;
--- a/restore/utilities.c
+++ b/restore/utilities.c
@@ -263,7 +263,7 @@ linkit(char *existing, char *new, int ty
 			 */
 #ifdef sunos
 #else
-			if (lgetflags (existing, &s) != -1 &&
+			if (lgetflags (existing, &s, 0) != -1 &&
 			    lsetflags (existing, 0) != -1) {
 			    	ret = link(existing, new);
 				lsetflags(existing, s);
@@ -731,7 +731,7 @@ CreateAppleDoubleFileRes(char *oFile, Fn
 #endif /* DUMP_MACOSX */
 
 int
-lgetflags(const char *path, unsigned long *flags)
+lgetflags(const char *path, unsigned long *flags, unsigned long inode_flags)
 {
 	int err;
 	struct stat sb;
@@ -742,7 +742,7 @@ lgetflags(const char *path, unsigned lon
 
 	if (S_ISLNK(sb.st_mode) || S_ISFIFO(sb.st_mode)) {
 		// no way to get/set flags on a symlink
-		*flags = 0;
+		*flags = inode_flags & EXT4_EXTENTS_FL;
 		return 0;
 	}
 	else
