From 2ae1ec83d2a97a4bf014986d2fda2fcf1d3791f7 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Tue, 28 May 2024 15:09:13 -0600 Subject: [PATCH] Use cap-std's new read_link_contents function. The read_link function refuses to return the value of a symlink if it's absolute. --- Cargo.toml | 1 - crates/unftp-sbe-fs/Cargo.toml | 2 +- crates/unftp-sbe-fs/src/lib.rs | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0972b8f3..4feb693d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,7 +71,6 @@ tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } unftp-sbe-fs = { path = "../libunftp/crates/unftp-sbe-fs" } [patch.crates-io] -cap-std = { git = "https://github.com/asomers/cap-std", rev = "73bc997" } capsicum = { git = "https://github.com/asomers/capsicum-rs", rev = "24330ee"} casper-sys = { git = "https://github.com/asomers/capsicum-rs", rev = "24330ee"} diff --git a/crates/unftp-sbe-fs/Cargo.toml b/crates/unftp-sbe-fs/Cargo.toml index 4cefb5fc..1f0166dd 100644 --- a/crates/unftp-sbe-fs/Cargo.toml +++ b/crates/unftp-sbe-fs/Cargo.toml @@ -21,7 +21,7 @@ readme = "README.md" [dependencies] async-trait = "0.1.80" cfg-if = "1.0" -cap-std = "3.0" +cap-std = "3.1" futures = { version = "0.3.30", default-features = false, features = ["std"] } lazy_static = "1.4.0" libunftp = { version = "0.20.0", path = "../../" } diff --git a/crates/unftp-sbe-fs/src/lib.rs b/crates/unftp-sbe-fs/src/lib.rs index 296a1e2c..fb0096f4 100644 --- a/crates/unftp-sbe-fs/src/lib.rs +++ b/crates/unftp-sbe-fs/src/lib.rs @@ -114,7 +114,7 @@ impl StorageBackend for Filesystem { .await .map_err(|_| Error::from(ErrorKind::PermanentFileNotAvailable))?; let target = if fs_meta.is_symlink() { - match self.root_fd.read_link(path) { + match self.root_fd.read_link_contents(path) { Ok(p) => Some(p), Err(_e) => { // XXX We should really log an error here. But a logger object is not @@ -143,7 +143,7 @@ impl StorageBackend for Filesystem { let fullpath = path.join(entry_path.clone()); cap_fs::symlink_metadata(self.root_fd.clone(), fullpath.clone()).map_ok(move |meta| { let target = if meta.is_symlink() { - match self.root_fd.read_link(&fullpath) { + match self.root_fd.read_link_contents(&fullpath) { Ok(p) => Some(p), Err(_e) => { // XXX We should really log an error here. But a logger object is