rust-lang / jobserver-rs

Apache License 2.0
69 stars 39 forks source link

The last `--jobserver-auth` flag should be used #66

Closed ojeda closed 6 months ago

ojeda commented 7 months ago

The first --jobserver-auth it finds is used, instead of the last like the Make manual asks:

Be aware that the MAKEFLAGS variable may contain multiple instances of the --jobserver-auth= option. Only the last instance is relevant.

$ echo 'fn main() {}' | MAKEFLAGS='--jobserver-auth= --jobserver-auth=3,4' rustc -
warning: failed to connect to jobserver from environment variable `MAKEFLAGS="--jobserver-auth= --jobserver-auth=3,4"`: cannot parse jobserver environment variable value: expected `fifo:PATH` or `R,W`, found ``
  |
  = note: the build environment is likely misconfigured

From https://github.com/rust-lang/rust/issues/120515.

weihanglo commented 7 months ago

Link to that paragraph

This is definitely a bug in the implementation and jobserver should try its best following how GNU make works.

The question is whether this is a breaking change needing a major version bump. Personally I don't think so. Having it in a major version bump will introduce much more inconsistency.

NobodyXu commented 7 months ago

Does jobserver need to do the same for --jobserver-fds and uses the last instance of it?

If both --jobserver-fds and --jobserver-auth is present, which one shall we use?

Shall we just try both?

weihanglo commented 7 months ago

Good question!

According to this announcement, --jobserver-fds was something internally used by make itself before made public.

There is no reason both of them are present. And to me, it seems better for --jobserver-auth to take precedence over the other.

NobodyXu commented 7 months ago

Thanks!