From 32ffc768152ff5dddf0c2c0b5a60cf4e0611834f Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Wed, 4 Mar 2015 16:53:40 +0100 Subject: [PATCH] Suppress error messages when reading extended attributes from a mounted filesystem that does not support extended attributes. This solves #1303. --- Duplicati/Library/Snapshots/SystemIOLinux.cs | 8 +++++--- thirdparty/UnixSupport/File.cs | 7 +++++++ thirdparty/UnixSupport/UnixSupport.dll | Bin 8192 -> 8192 bytes 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Duplicati/Library/Snapshots/SystemIOLinux.cs b/Duplicati/Library/Snapshots/SystemIOLinux.cs index 2d2267760..bd3395495 100644 --- a/Duplicati/Library/Snapshots/SystemIOLinux.cs +++ b/Duplicati/Library/Snapshots/SystemIOLinux.cs @@ -173,10 +173,12 @@ namespace Duplicati.Library.Snapshots public Dictionary GetMetadata(string file) { var f = file.EndsWith(DIR_SEP) ? file.Substring(0, file.Length - 1) : file; - var n = UnixSupport.File.GetExtendedAttributes(f); var dict = new Dictionary(); - foreach(var x in n) - dict["unix-ext:" + x.Key] = Convert.ToBase64String(x.Value); + + var n = UnixSupport.File.GetExtendedAttributes(f); + if (n != null) + foreach(var x in n) + dict["unix-ext:" + x.Key] = Convert.ToBase64String(x.Value); var fse = UnixSupport.File.GetUserGroupAndPermissions(f); dict["unix:uid-gid-perm"] = string.Format("{0}-{1}-{2}", fse.UID, fse.GID, fse.Permissions); diff --git a/thirdparty/UnixSupport/File.cs b/thirdparty/UnixSupport/File.cs index 0fd2d1d0e..f96152201 100644 --- a/thirdparty/UnixSupport/File.cs +++ b/thirdparty/UnixSupport/File.cs @@ -190,7 +190,14 @@ namespace UnixSupport string[] values; var size = SUPPORTS_LLISTXATTR ? Mono.Unix.Native.Syscall.llistxattr(path, out values) : Mono.Unix.Native.Syscall.listxattr(path, out values); if (size < 0) + { + // In case the underlying filesystem does not support extended attributes, + // we simply return that there are no attributes + if (Syscall.GetLastError() == Errno.EOPNOTSUPP) + return null; + throw new FileAccesException(path, "llistxattr"); + } var dict = new Dictionary(); foreach(var s in values) diff --git a/thirdparty/UnixSupport/UnixSupport.dll b/thirdparty/UnixSupport/UnixSupport.dll index 4dac8d3d362885bb17102b932462002224b94de3..da54cd4dee266e7dadfb5c5f3087b797fb2a1f88 100755 GIT binary patch delta 459 zcmZp0XmFU&!JMJ_ePXvPquj)m`b>&}6K|<8UYN|tSkI_3xskD6kim=r3_KVZ7?>DX z83HB?GKsTZP+?$bm~67-r#z2(Y>VUCXTnRNHMu(Ms~_CjFchy*U;yPAu!b=5G1x+R-mFoK{0xy$UK(o>qcB4nlvlu-#3;g00_9b+CNYXKtbp=* zScMqH818_1Z4%cReHp|Vm{mabfq3bR5)4j!aBd!>6hqDCSgzk(0^3r~EEE*6cb(Xs zYJa@GmUVN6XatiGNZ$`r5DCG2W|Pl}OEEE+ZGI&#!nB!B>K8MUg4t$4x%Z3{4cGyw CJcXbD delta 447 zcmZp0XmFU&!MtT()WmLCM!tzF^_f=sPQ0bYcwjOkV?CqDPz`(@7 z%HT3tkV%~NhzbKk!(>B7<;?+1I!ug{C)cuQv+yu5FihUXvWt;nb1`cyWBse$(F#kX zQdXvZY6^_yTQ)PWt1@rhg73v#CwlzXe%BIPCb_so(dCeAU2|>q)7w*ytL(a#yj^Jf zquBaA3;VSn=Q!}L;(MvpY+u1p~knD_~7x6k*7K@~T;r7)2T8KzTi^LX2Vz7r?wWiR+BM z4B`ym;kA?ZriNxi*)GMlkWc tfQB_l!#~r>_r#@`KA3L)B`(4=*@01DGoREiW+nl%&4P0887CUB0{~!_h1&oC