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

Make mtime of reproducible tarballs dependent on git commit #127050

Merged
merged 2 commits into from
Jul 3, 2024

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Jun 27, 2024

Since #123246, our tarballs should be fully reproducible. That means that the mtime of all files and directories in the tarballs is set to the date of the first Rust commit (from 2006). However, this is causing some mtime invalidation issues (#125578 (comment)).

Ideally, we would like to keep the mtime reproducible, but still update it with new versions of Rust. That's what this PR does. It modifies the tarball installer bootstrap invocation so that if the current rustc directory is managed by git, we will set the UTC timestamp of the latest commit as the mtime for all files in the archive. This means that the archive should be still fully reproducible from a given commit SHA, but it will also be changed with new beta bumps and download-rustc versions.

Note that only files are set to this mtime, directories are still set to the year 2006, because the tar library used by rust-installer doesn't allow us to selectively override mtime for directories (or at least I haven't found it). We could work around that by doing all the mtime modifications in bootstrap, but that would require more changes. I think/hope that just modifying the file mtimes should be enough. It should at least fix cargo rustc mtime invalidation.

Fixes: #125578

r? @onur-ozkan

try-job: x86_64-gnu-distcheck

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jun 27, 2024
@Kobzol
Copy link
Contributor Author

Kobzol commented Jun 27, 2024

CC @ehuss

Copy link
Member

@onur-ozkan onur-ozkan left a comment

Choose a reason for hiding this comment

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

Good solution! Just 2 small notes and LGTM other than that.

src/tools/rust-installer/src/tarballer.rs Outdated Show resolved Hide resolved
src/bootstrap/src/utils/tarball.rs Outdated Show resolved Hide resolved
@Kobzol
Copy link
Contributor Author

Kobzol commented Jun 28, 2024

Thanks, performed the changes.

@onur-ozkan
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 28, 2024

📌 Commit 50350f4 has been approved by onur-ozkan

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 Jun 28, 2024
@bors
Copy link
Contributor

bors commented Jun 29, 2024

☔ The latest upstream changes (presumably #127111) made this pull request unmergeable. Please resolve the merge conflicts.

@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 29, 2024
@jieyouxu
Copy link
Member

@bors r- (needs rebase)

@Kobzol
Copy link
Contributor Author

Kobzol commented Jun 29, 2024

Rebased.

@bors r=onur-ozkan

@bors
Copy link
Contributor

bors commented Jun 29, 2024

📌 Commit c54a2a5 has been approved by onur-ozkan

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 29, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 29, 2024
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#126805 (Migrate `pdb-alt-path`, `mismatching-target-triples` and `mingw-export-call-convention` `run-make` tests to rmake)
 - rust-lang#126995 (Migrate `pretty-print-with-dep-file`, `pretty-print-to-file` and `libtest-padding` `run-make` tests to rmake)
 - rust-lang#127041 (Migrate `run-make/override-aliased-flags` to `rmake.rs`)
 - rust-lang#127072 (docs: say "includes" instead of "does include")
 - rust-lang#127073 (Remove unnecessary SeqCst in `impl fmt::Pointer for AtomicPtr`)
 - rust-lang#127112 (Bootstrap: Don't get output if `lldb --version` errors)
 - rust-lang#127116 (Migrate `run-make/return-non-c-like-enum` to `rmake.rs`)

Failed merges:

 - rust-lang#127050 (Make mtime of reproducible tarballs dependent on git commit)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 29, 2024
…-ozkan

Make mtime of reproducible tarballs dependent on git commit

Since rust-lang#123246, our tarballs should be fully reproducible. That means that the mtime of all files and directories in the tarballs is set to the date of the first Rust commit (from 2006). However, this is causing some mtime invalidation issues (rust-lang#125578 (comment)).

Ideally, we would like to keep the mtime reproducible, but still update it with new versions of Rust. That's what this PR does. It modifies the tarball installer bootstrap invocation so that if the current rustc directory is managed by git, we will set the UTC timestamp of the latest commit as the mtime for all files in the archive. This means that the archive should be still fully reproducible from a given commit SHA, but it will also be changed with new beta bumps and `download-rustc` versions.

Note that only files are set to this mtime, directories are still set to the year 2006, because the `tar` library used by `rust-installer` doesn't allow us to selectively override mtime for directories (or at least I haven't found it). We could work around that by doing all the mtime modifications in bootstrap, but that would require more changes. I think/hope that just modifying the file mtimes should be enough. It should at least fix cargo `rustc` mtime invalidation.

Fixes: rust-lang#125578

r? `@onur-ozkan`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 29, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#123237 (Various rustc_codegen_ssa cleanups)
 - rust-lang#126960 (Improve error message in tidy)
 - rust-lang#127002 (Implement `x perf` as a separate tool)
 - rust-lang#127050 (Make mtime of reproducible tarballs dependent on git commit)
 - rust-lang#127081 (Add a run-make test that LLD is not being used by default on the x64 beta/stable channel)
 - rust-lang#127106 (Improve unsafe extern blocks diagnostics)
 - rust-lang#127110 (Fix a error suggestion for E0121 when using placeholder _ as return types on function signature.)
 - rust-lang#127114 (fix: prefer `(*p).clone` to `p.clone` if the `p` is a raw pointer)
 - rust-lang#127118 (Show `used attribute`'s kind for user when find it isn't applied to a `static` variable.)

r? `@ghost`
`@rustbot` modify labels: rollup
@matthiaskrgr
Copy link
Member

@bors r-
#127125 (comment)

@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 29, 2024
@bors
Copy link
Contributor

bors commented Jun 29, 2024

⌛ Trying commit e1999f9 with merge 16deff3...

@bors
Copy link
Contributor

bors commented Jun 29, 2024

☀️ Try build successful - checks-actions
Build commit: 16deff3 (16deff398341dea5954d6cedf3be010fe52c1ed6)

@Kobzol
Copy link
Contributor Author

Kobzol commented Jun 30, 2024

@rustbot ready

@rustbot rustbot 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 30, 2024
@onur-ozkan
Copy link
Member

Nothing seem suspicious/wrong to me.

@bors r+

@bors
Copy link
Contributor

bors commented Jun 30, 2024

📌 Commit e1999f9 has been approved by onur-ozkan

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 Jun 30, 2024
@bors
Copy link
Contributor

bors commented Jul 2, 2024

⌛ Testing commit e1999f9 with merge 98108d2...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 2, 2024
…zkan

Make mtime of reproducible tarballs dependent on git commit

Since rust-lang#123246, our tarballs should be fully reproducible. That means that the mtime of all files and directories in the tarballs is set to the date of the first Rust commit (from 2006). However, this is causing some mtime invalidation issues (rust-lang#125578 (comment)).

Ideally, we would like to keep the mtime reproducible, but still update it with new versions of Rust. That's what this PR does. It modifies the tarball installer bootstrap invocation so that if the current rustc directory is managed by git, we will set the UTC timestamp of the latest commit as the mtime for all files in the archive. This means that the archive should be still fully reproducible from a given commit SHA, but it will also be changed with new beta bumps and `download-rustc` versions.

Note that only files are set to this mtime, directories are still set to the year 2006, because the `tar` library used by `rust-installer` doesn't allow us to selectively override mtime for directories (or at least I haven't found it). We could work around that by doing all the mtime modifications in bootstrap, but that would require more changes. I think/hope that just modifying the file mtimes should be enough. It should at least fix cargo `rustc` mtime invalidation.

Fixes: rust-lang#125578

r? `@onur-ozkan`

try-job: x86_64-gnu-distcheck
@bors
Copy link
Contributor

bors commented Jul 2, 2024

💔 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 2, 2024
@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)
#14 0.347 
#14 0.347 gzip: stdin: not in gzip format
#14 0.347 tar: Child returned status 1
#14 0.348 tar: Error is not recoverable: exiting now
#14 ERROR: process "/bin/sh -c env HOST_CFLAGS=\"-O -fcommon\" /tmp/build-netbsd-toolchain.sh" did not complete successfully: exit code: 2
 > [6/8] RUN env HOST_CFLAGS="-O -fcommon" /tmp/build-netbsd-toolchain.sh:
0.036 + mkdir netbsd

100   245  100   245    0     0    814      0 --:--:-- --:--:-- --:--:--   816
---
  11 | >>> RUN env HOST_CFLAGS="-O -fcommon" /tmp/build-netbsd-toolchain.sh
  12 |     
  13 |     COPY scripts/sccache.sh /scripts/
--------------------
ERROR: failed to solve: process "/bin/sh -c env HOST_CFLAGS=\"-O -fcommon\" /tmp/build-netbsd-toolchain.sh" did not complete successfully: exit code: 2
#0 building with "brave_hopper" instance using docker-container driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 988B done
---
#11 0.653 
#11 0.653 gzip: stdin: not in gzip format
#11 0.654 tar: Child returned status 1
#11 0.654 tar: Error is not recoverable: exiting now
#11 ERROR: process "/bin/sh -c env HOST_CFLAGS=\"-O -fcommon\" /tmp/build-netbsd-toolchain.sh" did not complete successfully: exit code: 2
 > [6/8] RUN env HOST_CFLAGS="-O -fcommon" /tmp/build-netbsd-toolchain.sh:
0.033 + mkdir netbsd

100   245  100   245    0     0    400      0 --:--:-- --:--:-- --:--:--   399
---
  11 | >>> RUN env HOST_CFLAGS="-O -fcommon" /tmp/build-netbsd-toolchain.sh
  12 |     
  13 |     COPY scripts/sccache.sh /scripts/
--------------------
ERROR: failed to solve: process "/bin/sh -c env HOST_CFLAGS=\"-O -fcommon\" /tmp/build-netbsd-toolchain.sh" did not complete successfully: exit code: 2
#0 building with "brave_hopper" instance using docker-container driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 988B done
---
#11 0.319 
#11 0.319 gzip: stdin: not in gzip format
#11 0.319 tar: Child returned status 1
#11 0.319 tar: Error is not recoverable: exiting now
#11 ERROR: process "/bin/sh -c env HOST_CFLAGS=\"-O -fcommon\" /tmp/build-netbsd-toolchain.sh" did not complete successfully: exit code: 2
 > [6/8] RUN env HOST_CFLAGS="-O -fcommon" /tmp/build-netbsd-toolchain.sh:

100   245  100   245    0     0    887      0 --:--:-- --:--:-- --:--:--   890
0.319 
---
  11 | >>> RUN env HOST_CFLAGS="-O -fcommon" /tmp/build-netbsd-toolchain.sh
  12 |     
  13 |     COPY scripts/sccache.sh /scripts/
--------------------
ERROR: failed to solve: process "/bin/sh -c env HOST_CFLAGS=\"-O -fcommon\" /tmp/build-netbsd-toolchain.sh" did not complete successfully: exit code: 2
#0 building with "brave_hopper" instance using docker-container driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 988B done
---
#11 0.392 
#11 0.392 gzip: stdin: not in gzip format
#11 0.392 tar: Child returned status 1
#11 0.392 tar: Error is not recoverable: exiting now
#11 ERROR: process "/bin/sh -c env HOST_CFLAGS=\"-O -fcommon\" /tmp/build-netbsd-toolchain.sh" did not complete successfully: exit code: 2
 > [6/8] RUN env HOST_CFLAGS="-O -fcommon" /tmp/build-netbsd-toolchain.sh:

100   245  100   245    0     0    696      0 --:--:-- --:--:-- --:--:--   698
0.392 
---
  11 | >>> RUN env HOST_CFLAGS="-O -fcommon" /tmp/build-netbsd-toolchain.sh
  12 |     
  13 |     COPY scripts/sccache.sh /scripts/
--------------------
ERROR: failed to solve: process "/bin/sh -c env HOST_CFLAGS=\"-O -fcommon\" /tmp/build-netbsd-toolchain.sh" did not complete successfully: exit code: 2
#0 building with "brave_hopper" instance using docker-container driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 988B done
---
#11 0.333 
#11 0.333 gzip: stdin: not in gzip format
#11 0.333 tar: Child returned status 1
#11 0.333 tar: Error is not recoverable: exiting now
#11 ERROR: process "/bin/sh -c env HOST_CFLAGS=\"-O -fcommon\" /tmp/build-netbsd-toolchain.sh" did not complete successfully: exit code: 2
 > [6/8] RUN env HOST_CFLAGS="-O -fcommon" /tmp/build-netbsd-toolchain.sh:

100   245  100   245    0     0    836      0 --:--:-- --:--:-- --:--:--   836
0.333 
---
  11 | >>> RUN env HOST_CFLAGS="-O -fcommon" /tmp/build-netbsd-toolchain.sh
  12 |     
  13 |     COPY scripts/sccache.sh /scripts/
--------------------
ERROR: failed to solve: process "/bin/sh -c env HOST_CFLAGS=\"-O -fcommon\" /tmp/build-netbsd-toolchain.sh" did not complete successfully: exit code: 2
##[error]Process completed with exit code 1.
Post job cleanup.

@compiler-errors
Copy link
Member

@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 2, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 2, 2024
…-ozkan

Make mtime of reproducible tarballs dependent on git commit

Since rust-lang#123246, our tarballs should be fully reproducible. That means that the mtime of all files and directories in the tarballs is set to the date of the first Rust commit (from 2006). However, this is causing some mtime invalidation issues (rust-lang#125578 (comment)).

Ideally, we would like to keep the mtime reproducible, but still update it with new versions of Rust. That's what this PR does. It modifies the tarball installer bootstrap invocation so that if the current rustc directory is managed by git, we will set the UTC timestamp of the latest commit as the mtime for all files in the archive. This means that the archive should be still fully reproducible from a given commit SHA, but it will also be changed with new beta bumps and `download-rustc` versions.

Note that only files are set to this mtime, directories are still set to the year 2006, because the `tar` library used by `rust-installer` doesn't allow us to selectively override mtime for directories (or at least I haven't found it). We could work around that by doing all the mtime modifications in bootstrap, but that would require more changes. I think/hope that just modifying the file mtimes should be enough. It should at least fix cargo `rustc` mtime invalidation.

Fixes: rust-lang#125578

r? `@onur-ozkan`

try-job: x86_64-gnu-distcheck
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 3, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#126403 (Actually report normalization-based type errors correctly for alias-relate obligations in new solver)
 - rust-lang#126803 (Change `asm-comments` to `verbose-asm`, always emit user comments)
 - rust-lang#126917 (Disable rmake test `inaccessible-temp-dir` on riscv64)
 - rust-lang#127050 (Make mtime of reproducible tarballs dependent on git commit)
 - rust-lang#127145 (Add `as_lang_item` to `LanguageItems`, new trait solver)
 - rust-lang#127184 (More refactorings to rustc_interface)
 - rust-lang#127202 (Remove global error count checks from typeck)
 - rust-lang#127233 (Some parser cleanups)
 - rust-lang#127245 (Add a test for `generic_const_exprs`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 3, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#126403 (Actually report normalization-based type errors correctly for alias-relate obligations in new solver)
 - rust-lang#126803 (Change `asm-comments` to `verbose-asm`, always emit user comments)
 - rust-lang#126917 (Disable rmake test `inaccessible-temp-dir` on riscv64)
 - rust-lang#127050 (Make mtime of reproducible tarballs dependent on git commit)
 - rust-lang#127145 (Add `as_lang_item` to `LanguageItems`, new trait solver)
 - rust-lang#127184 (More refactorings to rustc_interface)
 - rust-lang#127202 (Remove global error count checks from typeck)
 - rust-lang#127233 (Some parser cleanups)
 - rust-lang#127245 (Add a test for `generic_const_exprs`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 3, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#126803 (Change `asm-comments` to `verbose-asm`, always emit user comments)
 - rust-lang#127050 (Make mtime of reproducible tarballs dependent on git commit)
 - rust-lang#127145 (Add `as_lang_item` to `LanguageItems`, new trait solver)
 - rust-lang#127202 (Remove global error count checks from typeck)
 - rust-lang#127233 (Some parser cleanups)
 - rust-lang#127248 (Add parse fail test using safe trait/impl trait)
 - rust-lang#127264 (Small `run-make-support` API improvements)
 - rust-lang#127270 (bootstrap: pass correct struct size to winapi)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 444a0ff into rust-lang:master Jul 3, 2024
6 of 7 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jul 3, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jul 3, 2024
Rollup merge of rust-lang#127050 - Kobzol:reproducibility-git, r=onur-ozkan

Make mtime of reproducible tarballs dependent on git commit

Since rust-lang#123246, our tarballs should be fully reproducible. That means that the mtime of all files and directories in the tarballs is set to the date of the first Rust commit (from 2006). However, this is causing some mtime invalidation issues (rust-lang#125578 (comment)).

Ideally, we would like to keep the mtime reproducible, but still update it with new versions of Rust. That's what this PR does. It modifies the tarball installer bootstrap invocation so that if the current rustc directory is managed by git, we will set the UTC timestamp of the latest commit as the mtime for all files in the archive. This means that the archive should be still fully reproducible from a given commit SHA, but it will also be changed with new beta bumps and `download-rustc` versions.

Note that only files are set to this mtime, directories are still set to the year 2006, because the `tar` library used by `rust-installer` doesn't allow us to selectively override mtime for directories (or at least I haven't found it). We could work around that by doing all the mtime modifications in bootstrap, but that would require more changes. I think/hope that just modifying the file mtimes should be enough. It should at least fix cargo `rustc` mtime invalidation.

Fixes: rust-lang#125578

r? ``@onur-ozkan``

try-job: x86_64-gnu-distcheck
@Kobzol Kobzol deleted the reproducibility-git branch July 3, 2024 18:55
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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bootstrap build fails: found crate serde_derive compiled by an incompatible version of rustc
8 participants