Skip to content
Closed
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
2 changes: 1 addition & 1 deletion crates/fspy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod artifact;

pub mod error;

#[cfg(not(target_env = "musl"))]
#[cfg(all(not(target_os = "android"), not(target_env = "musl")))]
mod ipc;

#[cfg(unix)]
Expand Down
22 changes: 12 additions & 10 deletions crates/fspy/src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ use std::{io, path::Path};

#[cfg(target_os = "linux")]
use fspy_seccomp_unotify::supervisor::supervise;
use fspy_shared::ipc::PathAccess;
#[cfg(not(target_env = "musl"))]
use fspy_shared::ipc::{NativeStr, channel::channel};
use fspy_shared::ipc::NativeStr;
use fspy_shared::ipc::PathAccess;
#[cfg(all(not(target_os = "android"), not(target_env = "musl")))]
use fspy_shared::ipc::channel::channel;
#[cfg(target_os = "macos")]
use fspy_shared_unix::payload::Artifacts;
use fspy_shared_unix::{
Expand All @@ -24,7 +26,7 @@ use syscall_handler::SyscallHandler;
use tokio::task::spawn_blocking;
use tokio_util::sync::CancellationToken;

#[cfg(not(target_env = "musl"))]
#[cfg(all(not(target_os = "android"), not(target_env = "musl")))]
use crate::ipc::{OwnedReceiverLockGuard, SHM_CAPACITY};
use crate::{ChildTermination, Command, TrackedChild, arena::PathAccessArena, error::SpawnError};

Expand Down Expand Up @@ -86,12 +88,12 @@ impl SpyImpl {
#[cfg(target_os = "linux")]
let supervisor = supervise::<SyscallHandler>().map_err(SpawnError::Supervisor)?;

#[cfg(not(target_env = "musl"))]
#[cfg(all(not(target_os = "android"), not(target_env = "musl")))]
let (ipc_channel_conf, ipc_receiver) =
channel(SHM_CAPACITY).map_err(SpawnError::ChannelCreation)?;

let payload = Payload {
#[cfg(not(target_env = "musl"))]
#[cfg(all(not(target_os = "android"), not(target_env = "musl")))]
ipc_channel_conf,

#[cfg(target_os = "macos")]
Expand Down Expand Up @@ -169,12 +171,12 @@ impl SpyImpl {

// Lock the ipc channel after the child has exited.
// We are not interested in path accesses from descendants after the main child has exited.
#[cfg(not(target_env = "musl"))]
#[cfg(all(not(target_os = "android"), not(target_env = "musl")))]
let ipc_receiver_lock_guard =
OwnedReceiverLockGuard::lock_async(ipc_receiver).await?;
let path_accesses = PathAccessIterable {
arenas,
#[cfg(not(target_env = "musl"))]
#[cfg(all(not(target_os = "android"), not(target_env = "musl")))]
ipc_receiver_lock_guard,
};

Expand All @@ -188,7 +190,7 @@ impl SpyImpl {

pub struct PathAccessIterable {
arenas: Vec<PathAccessArena>,
#[cfg(not(target_env = "musl"))]
#[cfg(all(not(target_os = "android"), not(target_env = "musl")))]
ipc_receiver_lock_guard: OwnedReceiverLockGuard,
}

Expand All @@ -197,12 +199,12 @@ impl PathAccessIterable {
let accesses_in_arena =
self.arenas.iter().flat_map(|arena| arena.borrow_accesses().iter()).copied();

#[cfg(not(target_env = "musl"))]
#[cfg(all(not(target_os = "android"), not(target_env = "musl")))]
{
let accesses_in_shm = self.ipc_receiver_lock_guard.iter_path_accesses();
accesses_in_shm.chain(accesses_in_arena)
}
#[cfg(target_env = "musl")]
#[cfg(any(target_os = "android", target_env = "musl"))]
{
accesses_in_arena
}
Expand Down
2 changes: 1 addition & 1 deletion crates/fspy_shared/src/ipc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(not(target_env = "musl"))]
#[cfg(all(not(target_os = "android"), not(target_env = "musl")))]
pub mod channel;
Comment on lines +1 to 2
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Gate preload IPC references on Android

Excluding fspy_shared::ipc::channel for Android here leaves downstream Android builds with unresolved symbols: fspy_preload_unix still imports channel::Sender and accesses encoded_payload.payload.ipc_channel_conf unconditionally (crates/fspy_preload_unix/src/client/mod.rs, lines 11 and 48). On target_os="android" + non-musl, this commit removes the module/field definitions but does not gate or replace those call sites, so compiling the preload crate fails.

Useful? React with 👍 / 👎.

mod native_path;
pub(crate) mod native_str;
Expand Down
4 changes: 2 additions & 2 deletions crates/fspy_shared_unix/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use bincode::{Decode, Encode, config::standard};
use bstr::BString;
#[cfg(not(target_env = "musl"))]
use fspy_shared::ipc::NativeStr;
#[cfg(not(target_env = "musl"))]
#[cfg(all(not(target_os = "android"), not(target_env = "musl")))]
use fspy_shared::ipc::channel::ChannelConf;

#[derive(Debug, Encode, Decode)]
pub struct Payload {
#[cfg(not(target_env = "musl"))]
#[cfg(all(not(target_os = "android"), not(target_env = "musl")))]
pub ipc_channel_conf: ChannelConf,

#[cfg(not(target_env = "musl"))]
Expand Down
Loading