Skip to content

Fix Client::configure* on unix - #100

Merged
weihanglo merged 5 commits into
rust-lang:mainfrom
NobodyXu:fix
Jul 16, 2024
Merged

Fix Client::configure* on unix#100
weihanglo merged 5 commits into
rust-lang:mainfrom
NobodyXu:fix

Conversation

@NobodyXu

Copy link
Copy Markdown
Contributor

Fixed #99

Comment thread src/unix.rs Outdated
Comment thread src/unix.rs Outdated
Comment thread src/unix.rs
Comment thread src/unix.rs
@NobodyXu
NobodyXu requested a review from the8472 July 2, 2024 09:34
Comment thread src/unix.rs

pub fn configure(&self, cmd: &mut Command) {
match self {
if matches!(self.creation_arg, ClientCreationArg::Fifo { .. }) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now that we are passing the fds specified in the environment, and we always clone the fds before using them or setting cloexec, I suppose we could remove this function completely? cc @the8472

This should improve the performance dramatically on platform with vfork available.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should happen in a separate PR since we need to consider both the environment and the file descriptors together, basically #64 but also the role of client.configure. It'd be a breaking change of that API. Right now the docs say that only children built with this method should inherit the jobserver.

The goal of this PR is to fix the fd to fifo conversion and I think it's already big enough for that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Got it thanks

Comment thread src/unix.rs
Comment thread src/unix.rs Outdated
@the8472

the8472 commented Jul 5, 2024

Copy link
Copy Markdown
Member

This also needs a regression test. Apparently nothing ensured that when inheriting a configuration from the parent we pass it through properly to a child.

@NobodyXu

NobodyXu commented Jul 5, 2024

Copy link
Copy Markdown
Contributor Author

cc @the8472 Updated, added regression test as suggested.

@NobodyXu
NobodyXu requested a review from the8472 July 5, 2024 13:32
NobodyXu added a commit to cargo-bins/jobslot that referenced this pull request Jul 5, 2024
rust-lang#100

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
NobodyXu added a commit to cargo-bins/jobslot that referenced this pull request Jul 5, 2024
* Fix `Client::configure*` on unix

rust-lang#100

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix linux compilation

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

@weihanglo weihanglo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fix. Could we fix up some commits?

Also, I'd prefer presenting the regression test first in a commit, followed by the other commits actually fix the behavior and tests. That would make the first commit a minimal reproduction and we know we're fixing the right thing.

Comment thread src/unix.rs

@the8472 the8472 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Functionally it seems fine to me now. I think it could use a few more comments here and there.

Comment thread src/unix.rs Outdated
Comment thread src/unix.rs
@NobodyXu

Copy link
Copy Markdown
Contributor Author

Also, I'd prefer presenting the regression test first in a commit, followed by the other commits actually fix the behavior and tests. That would make the first commit a minimal reproduction and we know we're fixing the right thing.

That might be a bit hard since I wrote after fixing it

NobodyXu and others added 4 commits July 16, 2024 22:23
So that setting `O_NONBLOCK` would not affect other.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
@NobodyXu

Copy link
Copy Markdown
Contributor Author

@weihanglo I squashed the commits, can't get the regression test commit to be the first, but it's much smaller now.

@NobodyXu
NobodyXu requested a review from weihanglo July 16, 2024 12:29

@weihanglo weihanglo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Typos. Otherwise LGTM

Comment thread src/unix.rs Outdated
Comment thread src/unix.rs Outdated
Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
@weihanglo
weihanglo merged commit a9900f3 into rust-lang:main Jul 16, 2024
@weihanglo

Copy link
Copy Markdown
Member

@petrochenkov

Would appreciate if you have time publishing this :)

(We should probably revisit #89 and rust-lang/infra-team#117)

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.

jobserver updates jobserver-auth from old style R,W to new style fifo:PATH for children though children may not be compatible with fifo:PATH style auth

3 participants