Skip to content

Commit 48ed342

Browse files
committed
Fix the test_fcntl::test_posix_fallocate::success test with recent ZFS
POSIX 1003.1-2024 Issue 8 changed the error code for this operation, and recent ZFS versions have followed suit. So the test should accept either the old error code (EINVAL) or the new one (ENOTSUP). https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_fallocate.html
1 parent 3cf9007 commit 48ed342

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/test_fcntl.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -541,13 +541,14 @@ mod test_posix_fallocate {
541541
assert_eq!(tmp.read(&mut data).expect("read failure"), LEN);
542542
assert_eq!(&data[..], &[0u8; LEN][..]);
543543
}
544-
Err(Errno::EINVAL) => {
545-
// POSIX requires posix_fallocate to return EINVAL both for
546-
// invalid arguments (i.e. len < 0) and if the operation is not
547-
// supported by the file system.
548-
// There's no way to tell for sure whether the file system
549-
// supports posix_fallocate, so we must pass the test if it
550-
// returns EINVAL.
544+
Err(Errno::ENOTSUP) | Err(Errno::EINVAL) => {
545+
// POSIX 1003.1-2024 Issue 8 specified ENOTSUP for "the file
546+
// system does not support this operation", so Nix should accept
547+
// that error code and pass the test.
548+
// But older POSIX required posix_fallocate to return EINVAL
549+
// both for invalid arguments (i.e. len < 0) and if the
550+
// operation is not supported by the file system. So we must
551+
// also pass the test if it returns EINVAL.
551552
}
552553
_ => res.unwrap(),
553554
}

0 commit comments

Comments
 (0)