Skip to content

Replace filetime with std::fs timestamp APIs - #14087

Draft
wtcpython wants to merge 1 commit into
uutils:mainfrom
wtcpython:replace-filetime
Draft

Replace filetime with std::fs timestamp APIs#14087
wtcpython wants to merge 1 commit into
uutils:mainfrom
wtcpython:replace-filetime

Conversation

@wtcpython

Copy link
Copy Markdown
Contributor

Replaces the filetime crate with std::fs::set_times and std::fs::set_times_nofollow.

Rust 1.99 is currently beta, so RUSTC_BOOTSTRAP and the feature gate are
temporary and can be removed once 1.99 is stable.

All relevant tests pass.

Fixes #13808

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/rm/isatty (fails in this run but passes in the 'main' branch)
Note: The gnu test tests/seq/seq-epipe is now being skipped but was previously passing.

Comment thread .cargo/config.toml
rustflags = ["-C", "target-feature=+crt-static"]

[env]
RUSTC_BOOTSTRAP = "1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I strongly disagree with adding such hack. (Maybe, breaking crate.io). If you need nightly API to remove the dep, you are probably using incorrect API.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See caution on config.toml.

@oech3

oech3 commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

The method .set_times for File should work with stable Rust.

Comment thread src/uu/cp/src/cp.rs
.set_accessed(source_metadata.accessed()?)
.set_modified(source_metadata.modified()?);

if dest.is_symlink() {

@oech3 oech3 Aug 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can open dest as File with NOFOLLOW and use method on unix. I don't know any alt for Windows and wasi (or copy code from nightly std to uucore).

@xtqqczze

Copy link
Copy Markdown
Contributor

Is it necessary to bump rust-version to 1.94.1?

@oech3

oech3 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Would you split PR for tests/* unrelated with nightly API?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace filetime crate with std library

3 participants