Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/sharecli-fuse/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
fn main() {
#[cfg(target_os = "macos")]
{
println!("cargo:rustc-link-search=framework=/Library/Filesystems/macfuse.fs/Contents/Frameworks");
println!(
"cargo:rustc-link-search=framework=/Library/Filesystems/macfuse.fs/Contents/Frameworks"
);
println!("cargo:rustc-link-lib=framework=MFMount");
}
}
11 changes: 5 additions & 6 deletions crates/sharecli-fuse/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@ pub(crate) fn runtime_diagnostics() -> String {
}
})
.unwrap_or_else(|error| format!("kext=unavailable ({error})"));
let version = std::fs::read_to_string(
"/Library/Filesystems/macfuse.fs/Contents/version.plist",
)
.ok()
.and_then(|contents| parse_bundle_version(&contents))
.unwrap_or_else(|| "unknown".to_string());
let version =
std::fs::read_to_string("/Library/Filesystems/macfuse.fs/Contents/version.plist")
.ok()
.and_then(|contents| parse_bundle_version(&contents))
.unwrap_or_else(|| "unknown".to_string());
let fskit = Command::new("launchctl")
.arg("list")
.output()
Expand Down
9 changes: 4 additions & 5 deletions crates/sharecli-fuse/src/bin/mfmount-probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ mod macos {
}
let result = unsafe { MFMount(channel, mountpoint_c.as_ptr(), options.as_ptr(), true) };
let errno = io::Error::last_os_error();
eprintln!(
"mfmount-probe: result={result:?} ({}), errno={errno}",
result_code(result)
);
eprintln!("mfmount-probe: result={result:?} ({}), errno={errno}", result_code(result));
unsafe {
let _ = MFChannelClose(channel);
MFRelease(channel);
Expand All @@ -70,7 +67,9 @@ mod macos {
MountResult::UnsupportedOs => "unsupported-os",
MountResult::HelperToolsInstallationFailed => "helper-tools-installation-failed",
MountResult::FileSystemExtensionNotFound => "filesystem-extension-not-found",
MountResult::FileSystemExtensionRequiresApproval => "filesystem-extension-requires-approval",
MountResult::FileSystemExtensionRequiresApproval => {
"filesystem-extension-requires-approval"
}
MountResult::UnexpectedFailure => "unexpected-failure",
}
}
Expand Down
12 changes: 10 additions & 2 deletions crates/sharecli-fuse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1011,10 +1011,18 @@ mod platform {
}
},
FuseBackend::Fskit => attempt(Some(FuseBackend::Fskit)).map_err(|err| {
anyhow::anyhow!("FSKit backend mount failed at {}: {err}; {}", mountpoint.display(), crate::backend::runtime_diagnostics())
anyhow::anyhow!(
"FSKit backend mount failed at {}: {err}; {}",
mountpoint.display(),
crate::backend::runtime_diagnostics()
)
}),
FuseBackend::Unavailable => attempt(None).map_err(|err| {
anyhow::anyhow!("FUSE backend unavailable; mount failed at {}: {err}; {}", mountpoint.display(), crate::backend::runtime_diagnostics())
anyhow::anyhow!(
"FUSE backend unavailable; mount failed at {}: {err}; {}",
mountpoint.display(),
crate::backend::runtime_diagnostics()
)
}),
}?;
Ok(())
Expand Down
5 changes: 4 additions & 1 deletion crates/sharecli-fuse/src/session_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,10 @@ mod default_mount_options_tests {
#[test]
fn macos_smoke_config_avoids_unsupported_backend_options() {
let kernel = smoke_fuser_config_for_backend(Some(FuseBackend::Kernel));
assert!(!kernel.mount_options.iter().any(|option| matches!(option, MountOption::CUSTOM(_))));
assert!(!kernel
.mount_options
.iter()
.any(|option| matches!(option, MountOption::CUSTOM(_))));
let fskit = smoke_fuser_config_for_backend(Some(FuseBackend::Fskit));
assert!(!fskit.mount_options.iter().any(|option| matches!(option, MountOption::CUSTOM(_))));
}
Expand Down
6 changes: 2 additions & 4 deletions crates/sharecli-ipc/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,8 @@ fn read_pid_cmdline(pid: u32) -> Result<Vec<String>> {
/// Linux: read `/proc/<pid>/cmdline`, split on NUL, drop trailing empty.
fn read_cmdline_from_proc_path(path: &std::path::Path) -> Result<Vec<String>> {
let mut bytes = Vec::new();
let mut file = fs::File::open(path)
.with_context(|| format!("open {}", path.display()))?;
file.read_to_end(&mut bytes)
.with_context(|| format!("read {}", path.display()))?;
let mut file = fs::File::open(path).with_context(|| format!("open {}", path.display()))?;
file.read_to_end(&mut bytes).with_context(|| format!("read {}", path.display()))?;

// `/proc/.../cmdline` ends with a trailing NUL; split_and_drop leaves
// one empty trailing token, which we discard.
Expand Down
16 changes: 4 additions & 12 deletions crates/sharecli-ipc/src/log_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,8 @@ impl LogBuffer {
let cap = max.min(CAPACITY);
let inner = self.inner.lock().expect("log buffer poisoned");
let last_id = inner.last_id;
let mut out: Vec<LogEntry> = inner
.entries
.iter()
.filter(|e| e.id > since_id)
.cloned()
.collect();
let mut out: Vec<LogEntry> =
inner.entries.iter().filter(|e| e.id > since_id).cloned().collect();
if out.len() > cap {
out.truncate(cap);
}
Expand Down Expand Up @@ -192,11 +188,7 @@ where
let subsystem = subsystem_for(event.metadata().module_path().unwrap_or("core"));
let mut visitor = MsgVisitor { msg: String::new() };
event.record(&mut visitor);
let msg = if visitor.msg.is_empty() {
String::new()
} else {
visitor.msg
};
let msg = if visitor.msg.is_empty() { String::new() } else { visitor.msg };
global().push(level, subsystem, msg);
}
}
Expand Down Expand Up @@ -270,4 +262,4 @@ mod tests {
let b = global();
assert!(std::ptr::eq(a as *const _, b as *const _));
}
}
}
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "stable"
channel = "1.96.0"
components = ["rustfmt", "clippy"]
profile = "minimal"
5 changes: 4 additions & 1 deletion tests/c09_l81_stop_force_confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,8 @@ fn fr004_quit_alias_stops_all() {
let out = bin().args(["quit", "--all"]).output().expect("spawn quit");
assert!(out.status.success(), "quit alias MUST dispatch to stop; combined={}", combined(&out));
let body = combined(&out);
assert!(body.contains("All processes stopped."), "quit alias MUST use stop semantics; body={body}");
assert!(
body.contains("All processes stopped."),
"quit alias MUST use stop semantics; body={body}"
);
}
6 changes: 2 additions & 4 deletions tests/fr007_ipc_monitoring_report_gate_host_watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ async fn fr007_ipc_monitoring_report_gate_host_watch_live() {
/// FR-007 / AC-007.46 — serialized MonitoringReportSnapshot preserves gate → host_watch key order.
#[test]
fn fr007_ipc_monitoring_report_snapshot_gate_before_host_watch() {
use sharecli::runtime::ProcState;
use sharecli::monitoring::HostResourceWatchJson;
use sharecli::runtime::ProcState;
use sharecli_fleet::GateStatusSnapshot;
use sharecli_ipc::handler::{
MonitoringProcessEntry, MonitoringReportSnapshot, PoolSnapshot, StatusSnapshot,
Expand Down Expand Up @@ -105,11 +103,11 @@ fn fr007_ipc_monitoring_report_snapshot_gate_before_host_watch() {
ppid: None,
cwd: None,
env_count: 0,
state: ProcState::default(),
state: "Unknown".into(),
disk_read_bytes: None,
disk_write_bytes: None,
fd_count: None,
log_location: None,
thread_count: None,
}],
gate: gate.clone(),
host_watch: host_watch.clone(),
Expand Down
6 changes: 2 additions & 4 deletions tests/fr007_ipc_monitoring_report_pool_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ async fn fr007_ipc_monitoring_report_pool_status_live() {
/// FR-007 / AC-007.72 — serialized MonitoringReportSnapshot preserves operator key order.
#[test]
fn fr007_ipc_monitoring_report_snapshot_pool_status_order() {
use sharecli::runtime::ProcState;
use sharecli::monitoring::HostResourceWatchJson;
use sharecli::runtime::ProcState;
use sharecli_fleet::GateStatusSnapshot;
use sharecli_ipc::handler::{
MonitoringProcessEntry, MonitoringReportSnapshot, PoolSnapshot, StatusSnapshot,
Expand Down Expand Up @@ -105,11 +103,11 @@ fn fr007_ipc_monitoring_report_snapshot_pool_status_order() {
ppid: None,
cwd: None,
env_count: 0,
state: ProcState::default(),
state: "Unknown".into(),
disk_read_bytes: None,
disk_write_bytes: None,
fd_count: None,
log_location: None,
thread_count: None,
}],
gate: gate.clone(),
host_watch: host_watch.clone(),
Expand Down
Loading