From 2fdfdff070920cfc087e3dfb1624c199d1daab84 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Date: Sat, 13 Jan 2018 19:01:15 +0100
Subject: [PATCH] deps: Update xattr to 0.2
get() used to return Result<Vec<u8>> which was indicating problem
either with getting attributes or those attributes being empty.
Now it returns Result<Option<Vec<u8>>> where Result is for reporting
problems with getting attrs and Option for showing whether attrs are
empty.
Then make sure that no_xattrs test is really trying to test something.
And also make indent to be consistent.
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
---
tests/all.rs | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/tests/all.rs b/tests/all.rs
index 6ecd440..1977362 100644
--- a/tests/all.rs
+++ b/tests/all.rs
@@ -201,19 +201,21 @@ fn xattrs() {
t!(ar.unpack(td.path()));
let val = xattr::get(td.path().join("a/b"), "user.pax.flags").unwrap();
- assert_eq!(val, "epm".as_bytes());
+ assert_eq!(val.unwrap(), "epm".as_bytes());
}
#[test]
#[cfg(all(unix, feature = "xattr"))]
fn no_xattrs() {
- let td = t!(TempDir::new("tar-rs"));
- let rdr = Cursor::new(tar!("xattrs.tar"));
- let mut ar = Archive::new(rdr);
+ // If /tmp is a tmpfs, xattr will fail
+ // The xattr crate's unit tests also use /var/tmp for this reason
+ let td = t!(TempDir::new_in("/var/tmp", "tar-rs"));
+ let rdr = Cursor::new(tar!("xattrs.tar"));
+ let mut ar = Archive::new(rdr);
ar.set_unpack_xattrs(false);
- t!(ar.unpack(td.path()));
+ t!(ar.unpack(td.path()));
- xattr::get(td.path().join("a/b"), "user.pax.flags").unwrap_err();
+ assert_eq!(xattr::get(td.path().join("a/b"), "user.pax.flags").unwrap(), None);
}
#[test]
--
2.15.1