Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting file accessed/modified timestamps #98246

Merged
merged 7 commits into from
Aug 1, 2022

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
Collaborator

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
Collaborator

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
@m-ou-se
Copy link
Member

m-ou-se commented Jun 20, 2022

@bors r+

@bors
Copy link
Contributor

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
Contributor

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
@rust-log-analyzer

This comment has been minimized.

@joshtriplett
Copy link
Member Author

@bors r=m-ou-se

@bors
Copy link
Contributor

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
Contributor

bors commented Jul 31, 2022

⌛ Testing commit f8061dd with merge eb5c3654b416912da280a0808ac36499e50d3bfe...

@bors
Copy link
Contributor

bors commented Jul 31, 2022

💥 Test timed out

@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 31, 2022
@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 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 31, 2022
@bors
Copy link
Contributor

bors commented Aug 1, 2022

⌛ Testing commit f8061dd with merge 1f5d8d4...

@bors
Copy link
Contributor

bors commented Aug 1, 2022

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 1, 2022
@bors bors merged commit 1f5d8d4 into rust-lang:master Aug 1, 2022
@rustbot rustbot added this to the 1.64.0 milestone Aug 1, 2022
@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

@joshtriplett joshtriplett deleted the times branch August 2, 2022 08:15
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Aug 5, 2022
…-98246, r=joshtriplett

kmc-solid: Add a stub implementation of rust-lang#98246 (`File::set_times`)

 Fixes the build failure of the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets after rust-lang#98246.

This target does not support setting a modification time and access time separately, hence stubbing out the implementation.
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 5, 2022
Rollup of 6 pull requests

Successful merges:

 - rust-lang#99835 (Suggest adding/removing `ref` for binding patterns)
 - rust-lang#100155 (Use `node_type_opt` to skip over generics that were not expected)
 - rust-lang#100157 (rustdoc: use `collect()` instead of repeatedly pushing)
 - rust-lang#100158 (kmc-solid: Add a stub implementation of rust-lang#98246 (`File::set_times`))
 - rust-lang#100166 (Remove more Clean trait implementations)
 - rust-lang#100168 (Improve diagnostics for `const a: = expr;`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 8, 2022
Fix HorizonOS regression in FileTimes

The changes in rust-lang#98246 caused a regression for multiple Newlib-based systems. This is just a fix including HorizonOS to the list of  targets which require a workaround.

`@AzureMarker` `@ian-h-chamberlain`
r? `@nagisa`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 14, 2022
Fix HorizonOS regression in FileTimes

The changes in rust-lang#98246 caused a regression for multiple Newlib-based systems. This is just a fix including HorizonOS to the list of  targets which require a workaround.

`@AzureMarker` `@ian-h-chamberlain`
r? `@nagisa`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 14, 2022
Fix HorizonOS regression in FileTimes

The changes in rust-lang#98246 caused a regression for multiple Newlib-based systems. This is just a fix including HorizonOS to the list of  targets which require a workaround.

``@AzureMarker`` ``@ian-h-chamberlain``
r? ``@nagisa``
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.