Skip to content

Conversation

@tgross35
Copy link
Contributor

@tgross35 tgross35 commented Nov 19, 2025

There are a number of platforms that support file locking but aren't getting tested. Synchronize the list and mark the tests should_panic otherwise, to make sure they get updated if more platforms add locking support.

The supported platform list comes from

#[cfg(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "netbsd",
target_os = "openbsd",
target_os = "cygwin",
target_os = "illumos",
target_os = "aix",
target_vendor = "apple",
))]
pub fn lock(&self) -> io::Result<()> {
cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_EX) })?;
return Ok(());
}
#[cfg(target_os = "solaris")]
pub fn lock(&self) -> io::Result<()> {
. Windows also supports file locks, all other platforms are unsupported.

The list of platforms for which file locks are tested is smaller than
the list of platforms that support it. Synchronize these here.

Link: https://github.com/rust-lang/rust/blob/07bdbaedc63094281483c40a88a1a8f2f8ffadc5/library/std/src/sys/fs/unix.rs#L1291-L1308
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 19, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 19, 2025

r? @ChrisDenton

rustbot has assigned @ChrisDenton.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@tgross35

This comment was marked as outdated.

@tgross35
Copy link
Contributor Author

Sorry bors3

@bors2 try jobs=arm-android,test-various

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Nov 19, 2025
fs: Run file lock tests on all platforms that support it

try-job: arm-android
try-job: test-various
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Nov 19, 2025

💔 Test for 534bfac failed: CI. Failed jobs:

Rather than skipping the tests, make sure that they fail. This ensures
that if file locking support is added for more platforms in the future,
the tests don't wind up quietly skipped.
@tgross35
Copy link
Contributor Author

@bors2 try jobs=arm-android,test-various

rust-bors bot added a commit that referenced this pull request Nov 19, 2025
fs: Run file lock tests on all platforms that support it

try-job: arm-android
try-job: test-various
@rust-bors

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Nov 20, 2025

☀️ Try build successful (CI)
Build commit: eb7fa5a (eb7fa5adff9becc0b258d7730b9afab7defca4d6, parent: 07bdbaedc63094281483c40a88a1a8f2f8ffadc5)

@mati865
Copy link
Member

mati865 commented Nov 20, 2025

FYI, you no longer need to call bors2 because bors try already uses the new one: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20try.20builds.20with.20new.20bors/near/530101996

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants