Hello,

it seems that we encountered a bug in star 1.5.3 as star is not able to
preserve 'security.capability" extended attribute after extracting. The
problem seems to be in the lchown() and set_xattr() calls order
(star_unix.c). I'm attaching a simple patch that switches these two
calls and solves this issue for us.

Btw. Fedora encountered a similar issue in tar [1].


Reproducer:
----------
touch testfile
setfattr -n security.capability -v TEST_VALUE testfile
getfattr -n security.capability testfile
star H=exustar -xattr -c -f testfile.tar testfile
rm -rf testfile
star H=exustar -xattr -x -f testfile.tar testfile
getfattr -n security.capability testfile


Results without the patch:
-------------------------
# file: testfile
security.capability="TEST_VALUE"

star: 1 blocks + 0 bytes (total of 10240 bytes = 10.00k).
star: 1 blocks + 0 bytes (total of 10240 bytes = 10.00k).
testfile: security.capability: No such attribute


Results with the patch:
----------------------
# file: testfile
security.capability="TEST_VALUE"

star: 1 blocks + 0 bytes (total of 10240 bytes = 10.00k).
star: 1 blocks + 0 bytes (total of 10240 bytes = 10.00k).
# file: testfile
security.capability="TEST_VALUE"


Best Regards,
Kristyna Streitova


[1]
http://pkgs.fedoraproject.org/cgit/rpms/tar.git/commit/?id=58fd5d562d21cfd20295183e202deebc7cf05783
Index: star-1.5.3/star/star_unix.c
===================================================================
--- star-1.5.3.orig/star/star_unix.c
+++ star-1.5.3/star/star_unix.c
@@ -649,10 +649,7 @@ setmodes(info)
 			set_acls(info);
 #endif
 	}
-#ifdef	USE_XATTR
-	if (doxattr)
-		set_xattr(info);
-#endif
+
 #ifdef	USE_FFLAGS
 	if (dofflags && !asymlink)
 		set_fflags(info);
@@ -688,6 +685,12 @@ setmodes(info)
 			}
 		}
 	}
+
+#ifdef  USE_XATTR
+	if (doxattr)
+		set_xattr(info);
+#endif
+
 #ifdef	HAVE_UTIMENSAT
 	/*
 	 * utimensat() is able to set the time stamps on symlinks, if called
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
S-tar-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/s-tar-developers

Reply via email to