From 2787d1a3f8100a4cefaba40f4a458212f502bacc Mon Sep 17 00:00:00 2001 From: Ilham Deneri Date: Thu, 5 Nov 2026 22:29:11 +0100 Subject: [PATCH] fix(io): read extended attribute sizes with the size query rustix 1.1.6 no longer treats an empty buffer as a size query: getxattr with an empty buffer now reads 0 bytes. Our attribute copy asked for the size that way, so with 1.1.6 every extended attribute (Finder tags and comments, the resource fork) would be carried as empty, with no error. xattr 1.6 has the same problem when listing names, so it would list none. Ask with lgetxattr_query instead, and require xattr 1.7 and rustix 1.1.6 together, so that neither can be updated alone into the broken pairing. The written bytes are the same as before on the old versions. Signed-off-by: Ilham Deneri --- Cargo.lock | 20 ++++++++++---------- Cargo.toml | 4 ++-- crates/sc-io/src/txn/meta.rs | 3 ++- crates/sc-io/tests/resource_fork.rs | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 57ac096..54b238d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1318,7 +1318,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -1507,7 +1507,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2899,7 +2899,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4040,15 +4040,15 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ "bitflags 2.13.2", "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -5292,7 +5292,7 @@ dependencies = [ "getrandom 0.4.3", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -6116,7 +6116,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -6524,9 +6524,9 @@ dependencies = [ [[package]] name = "xattr" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" +checksum = "963d6fab92d5504b971dc8bd90ca743c2575e590bc8071ea5bc571598667ae08" dependencies = [ "libc", "rustix", diff --git a/Cargo.toml b/Cargo.toml index 3bbc9b1..9685742 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,8 +46,8 @@ quick-xml = "0.42" percent-encoding = "2.3" # Write transaction: extended attributes copied through the atomic rename, fsync fallback, # free space and no-replace rename (rustix, fs only), ACL detection on macOS (exacl). -xattr = "1.6" -rustix = { version = "1.1", features = ["fs", "process"] } +xattr = "1.7" +rustix = { version = "1.1.6", features = ["fs", "process"] } exacl = "0.13" # Local date of the backup folders (time zone from the system); MIT OR Unlicense, used under MIT. jiff = { version = "0.2", default-features = false, features = ["std", "tz-system", "tzdb-zoneinfo"] } diff --git a/crates/sc-io/src/txn/meta.rs b/crates/sc-io/src/txn/meta.rs index 14f2553..4028e22 100644 --- a/crates/sc-io/src/txn/meta.rs +++ b/crates/sc-io/src/txn/meta.rs @@ -153,7 +153,8 @@ pub(crate) fn read_xattr(path: &Path, name: &OsStr) -> std::io::Result n, Err(e) if e == NO_ATTR => return Ok(None), Err(e) => return Err(e.into()), diff --git a/crates/sc-io/tests/resource_fork.rs b/crates/sc-io/tests/resource_fork.rs index 9ee6a46..2ad52c2 100644 --- a/crates/sc-io/tests/resource_fork.rs +++ b/crates/sc-io/tests/resource_fork.rs @@ -51,7 +51,7 @@ fn listed(p: &Path) -> bool { /// The size `getxattr(2)` gives the resource fork of `p`. fn attribute_size(p: &Path) -> usize { - rustix::fs::getxattr(p, RESOURCE_FORK, &mut [0_u8; 0][..]).expect("resource fork attribute") + rustix::fs::getxattr_query(p, RESOURCE_FORK).expect("resource fork attribute") } /// A 70,000-byte resource fork (reads of it are cut to the buffer unless sized first).