|
|
Subscribe / Log in / New account

Breakage ahead

Breakage ahead

Posted Jan 23, 2020 15:59 UTC (Thu) by StefanBr (guest, #110916)
In reply to: Breakage ahead by josh
Parent article: GNU make 4.3 released

> The jobserver protocol isn't hard to implement manually, even if not using make.

Unfortunately, the jobserver protocol is broken.

Job tokens are passed down via inherited file descriptors -

Caveat 1: If the called program is not $(MAKE) (verbatim), the file descriptors are closed on exec (FD_CLOEXEC), and the chain ends there. You can opt-in by adding a '+' in front of your command, but then you have to do that on every elegible command. Hint - none of the common Makefile generators does that.

Caveat 2: If you happen to call make indirectly (e.g. via a script called from the Makefile), unfortunately the '--jobserver-auth=<readfd>,<writefd>' will still be in the MAKEFLAGS env var although make had just closed the corresponding file descriptors. Two things can happen:

a) The fds no longer refer to valid file descriptors - make will detect this
b) The fds have been reused in the meantime - make will find valid file descriptors. If the fd is not readable (e.g. referring to a write end of a pipe), make will start busy looping. If the fd is readable, it will spawn a new job for every byte read (now figure what will happen if it points to a 2 kByte source file ...)


to post comments

Breakage ahead

Posted Jan 23, 2020 16:16 UTC (Thu) by mirabilos (subscriber, #84359) [Link]

Caveat 3: the Korn shell closes open file descriptors >2 upon running external programs, so if you have any shell scripts in between…


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds