Skip to content

Conversation

@martin-g
Copy link
Member

@martin-g martin-g commented Sep 9, 2025

Motivation

File::try_clone() should preserve the max_buf_size of the origin, otherwise the cloning would use the default (tokio::io::blocking::DEFAULT_MAX_BUF_SIZE)

Solution

Set the max_buf_size of the cloning to the one used by the origin.

@martin-g
Copy link
Member Author

martin-g commented Sep 9, 2025

Adding a new IT test in tokio/tokio/tests/fs.rs requires to add a public getter for File::max_buf_size. Is that OK ?
Or should I add a unit test ? There are no such for the moment:

mod tests;

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-fs Module: tokio/fs labels Sep 9, 2025
@Darksonn
Copy link
Contributor

Darksonn commented Sep 9, 2025

I'm okay with adding a getter.

@Darksonn
Copy link
Contributor

Darksonn commented Sep 9, 2025

We usually end up with one changelog entry per PR. Could you make two PRs so that we have one for adding a new public method, and another for fixing try_clone()?

@martin-g
Copy link
Member Author

martin-g commented Sep 9, 2025

Sure! I will keep this PR for the second part and rebase it once the (to-be-created) PR for the getter is merged.

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thanks.

@Darksonn Darksonn enabled auto-merge (squash) September 9, 2025 08:29
@Darksonn Darksonn merged commit 044eaa1 into tokio-rs:master Sep 9, 2025
89 checks passed
@martin-g martin-g deleted the file-try=clone branch September 9, 2025 08:39
@Darksonn Darksonn mentioned this pull request Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tokio Area: The main tokio crate M-fs Module: tokio/fs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants