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
6 changes: 4 additions & 2 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ smallvec = { version = "1.15.1", features = ["union"] }
strum = { version = "0.28.0", features = ["derive"] }
zstd = "0.13.3"

[target.'cfg(not(windows))'.dependencies]
[target.'cfg(not(any(windows, all(target_os="android", target_arch="x86"))))'.dependencies]
sha2 = { version = "0.10.9", features = ["asm"] }

[target.'cfg(windows)'.dependencies]
[target.'cfg(any(windows, all(target_os="android", target_arch="x86")))'.dependencies]
# unfortunately, the asm extensions do not build on Windows, see https://github.com/RustCrypto/asm-hashes/issues/17
# and https://github.com/RustCrypto/asm-hashes/pull/issues/78
# Android x86 links this crate into a JNI shared library. sha2-asm's 32-bit x86 objects contain text
# relocations, which Android rejects when loading shared libraries.
sha2 = "0.10.9"

[target.'cfg(not(any(windows, target_os="openbsd")))'.dependencies]
Expand Down
34 changes: 31 additions & 3 deletions crates/core/src/backend/local_destination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ pub enum LocalDestinationErrorKind {
DirectoryCreationFailed(std::io::Error),
/// file `{0:?}` should have a parent
FileDoesNotHaveParent(PathBuf),
#[cfg(any(target_os = "macos", target_os = "openbsd"))]
#[cfg(any(
target_os = "macos",
target_os = "openbsd",
all(target_os = "android", target_pointer_width = "32")
))]
/// `DeviceID` could not be converted to other type `{target}` of device `{device}`: `{source}`
DeviceIdConversionFailed {
target: String,
Expand Down Expand Up @@ -655,7 +659,11 @@ impl LocalDestination {
})?;
}
NodeType::Dev { device } => {
#[cfg(not(any(target_os = "macos", target_os = "openbsd")))]
#[cfg(not(any(
target_os = "macos",
target_os = "openbsd",
all(target_os = "android", target_pointer_width = "32")
)))]
let device = *device;
#[cfg(any(target_os = "macos", target_os = "openbsd"))]
let device = i32::try_from(*device).map_err(|err| {
Expand All @@ -665,11 +673,23 @@ impl LocalDestination {
source: err,
}
})?;
#[cfg(all(target_os = "android", target_pointer_width = "32"))]
let device = u32::try_from(*device).map_err(|err| {
LocalDestinationErrorKind::DeviceIdConversionFailed {
target: "u32".to_string(),
device: *device,
source: err,
}
})?;
mknod(&filename, SFlag::S_IFBLK, Mode::empty(), device)
.map_err(LocalDestinationErrorKind::FromErrnoError)?;
}
NodeType::Chardev { device } => {
#[cfg(not(any(target_os = "macos", target_os = "openbsd")))]
#[cfg(not(any(
target_os = "macos",
target_os = "openbsd",
all(target_os = "android", target_pointer_width = "32")
)))]
let device = *device;
#[cfg(any(target_os = "macos", target_os = "openbsd"))]
let device = i32::try_from(*device).map_err(|err| {
Expand All @@ -679,6 +699,14 @@ impl LocalDestination {
source: err,
}
})?;
#[cfg(all(target_os = "android", target_pointer_width = "32"))]
let device = u32::try_from(*device).map_err(|err| {
LocalDestinationErrorKind::DeviceIdConversionFailed {
target: "u32".to_string(),
device: *device,
source: err,
}
})?;
mknod(&filename, SFlag::S_IFCHR, Mode::empty(), device)
.map_err(LocalDestinationErrorKind::FromErrnoError)?;
}
Expand Down
Loading