Skip to content

Support setting file accessed/modified timestamps#98246

Merged
bors merged 7 commits intorust-lang:masterfrom
joshtriplett:times
Aug 1, 2022
Merged

Support setting file accessed/modified timestamps#98246
bors merged 7 commits intorust-lang:masterfrom
joshtriplett:times

Conversation

@joshtriplett
Copy link
Member

Add struct FileTimes to contain the relevant file timestamps, since
most platforms require setting all of them at once. (This also allows
for future platform-specific extensions such as setting creation time.)

Add File::set_file_time to set the timestamps for a File.

Implement the sys backends for UNIX, macOS (which needs to fall back
to futimes before macOS 10.13 because it lacks futimens), Windows,
and WASI.

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jun 19, 2022
@rust-highfive
Copy link
Contributor

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive
Copy link
Contributor

r? @m-ou-se

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 19, 2022
@joshtriplett joshtriplett added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 19, 2022
@joshtriplett joshtriplett force-pushed the times branch 2 times, most recently from af110f4 to 8f3fc2e Compare June 19, 2022 04:44
@m-ou-se
Copy link
Member

m-ou-se commented Jun 20, 2022

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 20, 2022

📌 Commit 8f3fc2e5de8d702b93bb5cf1432630ab721f78d8 has been approved by m-ou-se

@bors bors 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 Jun 20, 2022
@m-ou-se
Copy link
Member

m-ou-se commented Jun 20, 2022

@bors r-

Actually, set_times should probably take FileTimes by value rather than by reference, since it's a Copy type. Then it's also consistent with the signature of set_permissions.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 20, 2022
@joshtriplett joshtriplett added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 20, 2022
@m-ou-se
Copy link
Member

m-ou-se commented Jun 21, 2022

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 21, 2022

📌 Commit 585767d has been approved by m-ou-se

@bors bors 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 Jun 21, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 21, 2022
Support setting file accessed/modified timestamps

Add `struct FileTimes` to contain the relevant file timestamps, since
most platforms require setting all of them at once. (This also allows
for future platform-specific extensions such as setting creation time.)

Add `File::set_file_time` to set the timestamps for a `File`.

Implement the `sys` backends for UNIX, macOS (which needs to fall back
to `futimes` before macOS 10.13 because it lacks `futimens`), Windows,
and WASI.
@JohnTitor
Copy link
Member

Failed in rollup: #98347 (comment)
Seems some tweaks are needed on macOS.
@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 21, 2022
@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 21, 2022
@rust-log-analyzer

This comment has been minimized.

Redox doesn't appear to support `UTIME_OMIT`, so we can't set file times
individually.
@joshtriplett
Copy link
Member Author

@bors r=m-ou-se

@bors
Copy link
Collaborator

bors commented Jul 22, 2022

📌 Commit 11d9be6 has been approved by m-ou-se

It is now in the queue for this repository.

@bors bors 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 Jul 22, 2022
@bors
Copy link
Collaborator

bors commented Jul 22, 2022

⌛ Testing commit 11d9be6 with merge da0c22e89b671e47e40ae8382a0f78a1d7b7a9c7...

@bors
Copy link
Collaborator

bors commented Jul 22, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 22, 2022
@rust-log-analyzer

This comment has been minimized.

@joshtriplett
Copy link
Member Author

@bors r=m-ou-se

@bors
Copy link
Collaborator

bors commented Jul 30, 2022

📌 Commit f8061dd has been approved by m-ou-se

It is now in the queue for this repository.

@bors bors 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 Jul 30, 2022
@bors
Copy link
Collaborator

bors commented Jul 31, 2022

⌛ Testing commit f8061dd with merge eb5c3654b416912da280a0808ac36499e50d3bfe...

@bors
Copy link
Collaborator

bors commented Jul 31, 2022

💥 Test timed out

@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@joshtriplett
Copy link
Member Author

@bors retry

@bors
Copy link
Collaborator

bors commented Aug 1, 2022

⌛ Testing commit f8061dd with merge 1f5d8d4...

@bors
Copy link
Collaborator

bors commented Aug 1, 2022

☀️ Test successful - checks-actions
Approved by: m-ou-se
Pushing 1f5d8d4 to master...

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1f5d8d4): comparison url.

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results
  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
2.5% 2.5% 1
Improvements 🎉
(primary)
-2.3% -2.3% 1
Improvements 🎉
(secondary)
-2.9% -3.4% 2
All 😿🎉 (primary) -2.3% -2.3% 1

Cycles

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 🎉 relevant improvement found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-3.1% -3.1% 1
All 😿🎉 (primary) N/A N/A 0

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

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

Labels

merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.