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

Bootstrap command refactoring: make command output API more bulletproof (step 7) #127799

Merged
merged 5 commits into from
Jul 28, 2024

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Jul 16, 2024

Continuation of #127680.

This PR modifies the API of running commands to make it more explicit when a command is expected to produce programmatically handled output. Now if you call just run, you cannot access the stdout/stderr by accident, because it will not be returned to the caller.

This API change might be seen as overkill, let me know what do you think. In any case, I'd like to land the second commit, to make it harder to accidentally read stdout/stderr of commands that did not capture output (now you'd get an empty string as a result, but you should probably get a panic instead, if you try to read uncaptured stdout/stderr).

Tracking issue: #126819

r? @onur-ozkan

try-job: x86_64-msvc

@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 Jul 16, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jul 16, 2024

This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp.

@bors

This comment was marked as outdated.

@onur-ozkan
Copy link
Member

Didn't see anything wrong.

@bors r+

@bors
Copy link
Contributor

bors commented Jul 20, 2024

📌 Commit 1984a46 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 Jul 20, 2024
tgross35 added a commit to tgross35/rust that referenced this pull request Jul 20, 2024
…=onur-ozkan

Bootstrap command refactoring: make command output API more bulletproof (step 7)

Continuation of rust-lang#127680.

This PR modifies the API of running commands to make it more explicit when a command is expected to produce programmatically handled output. Now if you call just `run`, you cannot access the stdout/stderr by accident, because it will not be returned to the caller.

This API change might be seen as overkill, let me know what do you think. In any case, I'd like to land the second commit, to make it harder to accidentally read stdout/stderr of commands that did not capture output (now you'd get an empty string as a result, but you should probably get a panic instead, if you try to read uncaptured stdout/stderr).

Tracking issue: rust-lang#126819

r? `@onur-ozkan`
tgross35 added a commit to tgross35/rust that referenced this pull request Jul 20, 2024
…=onur-ozkan

Bootstrap command refactoring: make command output API more bulletproof (step 7)

Continuation of rust-lang#127680.

This PR modifies the API of running commands to make it more explicit when a command is expected to produce programmatically handled output. Now if you call just `run`, you cannot access the stdout/stderr by accident, because it will not be returned to the caller.

This API change might be seen as overkill, let me know what do you think. In any case, I'd like to land the second commit, to make it harder to accidentally read stdout/stderr of commands that did not capture output (now you'd get an empty string as a result, but you should probably get a panic instead, if you try to read uncaptured stdout/stderr).

Tracking issue: rust-lang#126819

r? ``@onur-ozkan``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 20, 2024
…=onur-ozkan

Bootstrap command refactoring: make command output API more bulletproof (step 7)

Continuation of rust-lang#127680.

This PR modifies the API of running commands to make it more explicit when a command is expected to produce programmatically handled output. Now if you call just `run`, you cannot access the stdout/stderr by accident, because it will not be returned to the caller.

This API change might be seen as overkill, let me know what do you think. In any case, I'd like to land the second commit, to make it harder to accidentally read stdout/stderr of commands that did not capture output (now you'd get an empty string as a result, but you should probably get a panic instead, if you try to read uncaptured stdout/stderr).

Tracking issue: rust-lang#126819

r? ```@onur-ozkan```
@matthiaskrgr
Copy link
Member

@bors rollup=never

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 23, 2024
…nur-ozkan

Bootstrap command refactoring: make command output API more bulletproof (step 7)

Continuation of rust-lang#127680.

This PR modifies the API of running commands to make it more explicit when a command is expected to produce programmatically handled output. Now if you call just `run`, you cannot access the stdout/stderr by accident, because it will not be returned to the caller.

This API change might be seen as overkill, let me know what do you think. In any case, I'd like to land the second commit, to make it harder to accidentally read stdout/stderr of commands that did not capture output (now you'd get an empty string as a result, but you should probably get a panic instead, if you try to read uncaptured stdout/stderr).

Tracking issue: rust-lang#126819

r? `@onur-ozkan`
@bors
Copy link
Contributor

bors commented Jul 23, 2024

⌛ Testing commit 1984a46 with merge 9e82096...

@bors
Copy link
Contributor

bors commented Jul 23, 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 23, 2024
@rust-log-analyzer

This comment has been minimized.

@Kobzol
Copy link
Contributor Author

Kobzol commented Jul 23, 2024

Rebased.

@bors r=onur-ozkan

@bors
Copy link
Contributor

bors commented Jul 23, 2024

📌 Commit 037b626 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 Jul 23, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 24, 2024
…nur-ozkan

Bootstrap command refactoring: make command output API more bulletproof (step 7)

Continuation of rust-lang#127680.

This PR modifies the API of running commands to make it more explicit when a command is expected to produce programmatically handled output. Now if you call just `run`, you cannot access the stdout/stderr by accident, because it will not be returned to the caller.

This API change might be seen as overkill, let me know what do you think. In any case, I'd like to land the second commit, to make it harder to accidentally read stdout/stderr of commands that did not capture output (now you'd get an empty string as a result, but you should probably get a panic instead, if you try to read uncaptured stdout/stderr).

Tracking issue: rust-lang#126819

r? `@onur-ozkan`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2024
…try>

Bootstrap command refactoring: make command output API more bulletproof (step 7)

Continuation of rust-lang#127680.

This PR modifies the API of running commands to make it more explicit when a command is expected to produce programmatically handled output. Now if you call just `run`, you cannot access the stdout/stderr by accident, because it will not be returned to the caller.

This API change might be seen as overkill, let me know what do you think. In any case, I'd like to land the second commit, to make it harder to accidentally read stdout/stderr of commands that did not capture output (now you'd get an empty string as a result, but you should probably get a panic instead, if you try to read uncaptured stdout/stderr).

Tracking issue: rust-lang#126819

r? `@onur-ozkan`

try-job: x86_64-msvc
@bors
Copy link
Contributor

bors commented Jul 25, 2024

⌛ Trying commit 5980328 with merge 597741d...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jul 25, 2024

💔 Test failed - checks-actions

@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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 25, 2024
Kobzol and others added 5 commits July 26, 2024 09:17
Now there are separate functions for running a command without capturing, running while capturing stdout
and running while capturing everything. This should help avoid situations where stdout/stderr is accessed
when it was not captured.
…ut/stderr

If e.g. only stdout is captured, but the caller tries to read stderr, previously
they would get back an empty string. Now the code will explicitly panic when
accessing an uncaptured output stream.
Before, their stdout/stderr was forcefully set to `None`, even if the corresponding command tried to capture output.
@Kobzol
Copy link
Contributor Author

Kobzol commented Jul 26, 2024

The problem was with storing stdout/stderr of commands that failed to even start.

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

@bors r+

@bors
Copy link
Contributor

bors commented Jul 28, 2024

📌 Commit abd8768 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 Jul 28, 2024
@bors
Copy link
Contributor

bors commented Jul 28, 2024

⌛ Testing commit abd8768 with merge 1b51d80...

@bors
Copy link
Contributor

bors commented Jul 28, 2024

☀️ Test successful - checks-actions
Approved by: onur-ozkan
Pushing 1b51d80 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 28, 2024
@bors bors merged commit 1b51d80 into rust-lang:master Jul 28, 2024
7 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Jul 28, 2024
@Kobzol Kobzol deleted the bootstrap-cmd-refactor-7 branch July 28, 2024 14:51
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1b51d80): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

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

Cycles

Results (secondary -2.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.7% [-2.7%, -2.7%] 1
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 770.349s -> 770.165s (-0.02%)
Artifact size: 331.55 MiB -> 331.66 MiB (0.03%)

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 29, 2024
[experiment] stage0 bump: test reverting bootstrap changes

rust-lang#128083 failed with a stage0/stage1 mismatch. Try reverting rust-lang#127799 since it is the only thing that touched bootstrap since the last known success at rust-lang#128216.
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-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.

7 participants