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

Fix Client::configure* on unix #100

Merged
merged 5 commits into from
Jul 16, 2024
Merged

Fix Client::configure* on unix #100

merged 5 commits into from
Jul 16, 2024

Conversation

NobodyXu
Copy link
Contributor

Fixed #99

src/unix.rs Outdated Show resolved Hide resolved
src/unix.rs Outdated Show resolved Hide resolved
src/unix.rs Show resolved Hide resolved
src/unix.rs Show resolved Hide resolved
@NobodyXu NobodyXu requested a review from the8472 July 2, 2024 09:34
Ok(unsafe { len.assume_init() } as usize)
}

pub fn configure(&self, cmd: &mut Command) {
match self {
if matches!(self.creation_arg, ClientCreationArg::Fifo { .. }) {
Copy link
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
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
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

src/unix.rs Show resolved Hide resolved
src/unix.rs Outdated Show resolved Hide resolved
@the8472
Copy link
Member

the8472 commented Jul 5, 2024

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
Copy link
Contributor Author

NobodyXu commented Jul 5, 2024

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
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 <[email protected]>

* Fix linux compilation

Signed-off-by: Jiahao XU <[email protected]>

---------

Signed-off-by: Jiahao XU <[email protected]>
Copy link
Member

@weihanglo weihanglo left a comment

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.

src/unix.rs Show resolved Hide resolved
Copy link
Member

@the8472 the8472 left a comment

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.

src/unix.rs Outdated Show resolved Hide resolved
src/unix.rs Outdated Show resolved Hide resolved
@NobodyXu
Copy link
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
@NobodyXu
Copy link
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
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Typos. Otherwise LGTM

src/unix.rs Outdated Show resolved Hide resolved
src/unix.rs Outdated Show resolved Hide resolved
Co-authored-by: Weihang Lo <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
@weihanglo weihanglo merged commit a9900f3 into rust-lang:main Jul 16, 2024
15 checks passed
@weihanglo
Copy link
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
3 participants