File 0001-fd-fix-f_flags-fdinfo-test-on-other-architectures.patch of Package libpathrs
From 3b5c7817bdc54adb47fb9e10e0e02176c7fa41b8 Mon Sep 17 00:00:00 2001
From: Aleksa Sarai <cyphar@cyphar.com>
Date: Fri, 28 Nov 2025 14:11:49 +1100
Subject: [PATCH] fd: fix f_flags fdinfo test on other architectures
O_LARGEFILE has different values on different architectures so we need
to special-case the fdinfo test to avoid spurious failures in the RPM
%check section on ARM and PowerPC.
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
---
src/utils/fd.rs | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/utils/fd.rs b/src/utils/fd.rs
index 9a6fff59..b9f35aae 100644
--- a/src/utils/fd.rs
+++ b/src/utils/fd.rs
@@ -623,6 +623,19 @@ mod tests {
Ok(())
}
+ // O_LARGEFILE has different values on different architectures.
+ #[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
+ const DEFAULT_FDINFO_FLAGS: &str = "02400000";
+ #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
+ const DEFAULT_FDINFO_FLAGS: &str = "02200000";
+ #[cfg(not(any(
+ target_arch = "arm",
+ target_arch = "aarch64",
+ target_arch = "powerpc",
+ target_arch = "powerpc64"
+ )))]
+ const DEFAULT_FDINFO_FLAGS: &str = "02100000";
+
#[test]
fn get_fdinfo_field() -> Result<(), Error> {
let file = File::open("/").context("open dummy file")?;
@@ -635,7 +648,7 @@ mod tests {
assert_eq!(
file.get_fdinfo_field::<String>(RawProcfsRoot::UnsafeGlobal, "flags")?,
- Some("02100000".to_string()),
+ Some(DEFAULT_FDINFO_FLAGS.to_string()),
"flags should be parsed for new file"
);
@@ -668,7 +681,7 @@ mod tests {
assert_eq!(
file.get_fdinfo_field::<String>(procfs.as_raw_procfs(), "flags")?,
- Some("02100000".to_string()),
+ Some(DEFAULT_FDINFO_FLAGS.to_string()),
"flags should be parsed for new file"
);