Skip to content

file locking: clarify that double-locking is underspecified#157046

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
RalfJung:file_lock_double_unlock
May 28, 2026
Merged

file locking: clarify that double-locking is underspecified#157046
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
RalfJung:file_lock_double_unlock

Conversation

@RalfJung
Copy link
Copy Markdown
Member

@RalfJung RalfJung commented May 28, 2026

The 2nd commit fixes #157045 by making the docs more clear.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 28, 2026
@RalfJung
Copy link
Copy Markdown
Member Author

@bors try jobs=*apple*,*freebsd*

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 28, 2026
enable file_lock_double_unlock test on Unix targets as well


try-job: *apple*
try-job: *freebsd*
@RalfJung RalfJung force-pushed the file_lock_double_unlock branch from 5736335 to d80ff46 Compare May 28, 2026 08:31
@RalfJung
Copy link
Copy Markdown
Member Author

@bors try jobs=*apple*,*freebsd*,*various*

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 28, 2026
enable file_lock_double_unlock test on Unix targets as well


try-job: *apple*
try-job: *freebsd*
try-job: *various*
and make it cover the specific difference between Windows and Unix
@RalfJung RalfJung force-pushed the file_lock_double_unlock branch from d80ff46 to a3b8240 Compare May 28, 2026 09:18
@RalfJung RalfJung marked this pull request as ready for review May 28, 2026 09:18
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 28, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 28, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 28, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates

@RalfJung
Copy link
Copy Markdown
Member Author

Cc @the8472

@RalfJung RalfJung force-pushed the file_lock_double_unlock branch from 5e4ae0b to 6397112 Compare May 28, 2026 09:24
Comment thread library/std/src/fs.rs
/// process, may acquire another lock.
/// If this file handle/descriptor, or a clone of it, already holds a lock, the exact behavior
/// is unspecified and platform dependent, including the possibility that it will deadlock.
/// However, if this method returns, then an exclusive lock is held.
Copy link
Copy Markdown
Member Author

@RalfJung RalfJung May 28, 2026

Choose a reason for hiding this comment

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

I moved this paragraph up because it relates to the "other" from what is now the previous sentence, where previously it was a bit harder to connect the dots.

View changes since the review

@RalfJung RalfJung force-pushed the file_lock_double_unlock branch from 6397112 to 2c1d605 Compare May 28, 2026 09:25
@RalfJung RalfJung changed the title enable file_lock_double_unlock test on Unix targets as well file locking: clarify that double-locking is underspecified May 28, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 28, 2026

☀️ Try build successful (CI)
Build commit: a39422e (a39422e4239ba1da738619f706e7589bef9b3f8e, parent: 8f02e856be945d5d879b2ff9b7d19dd6bfb1c0e5)

@Mark-Simulacrum
Copy link
Copy Markdown
Member

@bors r+ rollup=iffy

Thanks!

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 28, 2026

📌 Commit 2c1d605 has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 28, 2026
rust-bors Bot pushed a commit that referenced this pull request May 28, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #157046 (file locking: clarify that double-locking is underspecified)
 - #156401 (rustdoc: deterministic sorting for `doc_cfg` badges)
 - #156746 (cg_llvm: Use `LLVMDIBuilderCreateEnumeratorOfArbitraryPrecision`)
 - #156889 (Suggest function-local constructors without enclosing function path)
 - #157012 (Fix missing note of escaping `{` for braces including whitespaces)
 - #157056 (Update Xtensa target data layouts to match upstream LLVM)
 - #157062 (Add link to RFMF Sponsors page)
@RalfJung
Copy link
Copy Markdown
Member Author

Does new bors support try jobs after r+? We will see.

@bors try jobs=*illumos*,*solaris*

rust-bors Bot pushed a commit that referenced this pull request May 28, 2026
file locking: clarify that double-locking is underspecified


try-job: *illumos*
try-job: *solaris*
@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 28, 2026

☀️ Try build successful (CI)
Build commit: 1faa84a (1faa84ac03b77f5a49ed6221c1e8d7062d88c553, parent: b5e038d7158c1af55a646027fdacf5ecd7c783c7)

@rust-bors rust-bors Bot merged commit 22f9a1d into rust-lang:main May 28, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone May 28, 2026
rust-timer added a commit that referenced this pull request May 28, 2026
Rollup merge of #157046 - RalfJung:file_lock_double_unlock, r=Mark-Simulacrum

file locking: clarify that double-locking is underspecified

The 2nd commit fixes #157045 by making the docs more clear.
@RalfJung RalfJung deleted the file_lock_double_unlock branch May 28, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

Windows file locking behavior seems to contradict docs

3 participants