Re: gmake and ccache conspiring together in creating gremlins
Edward Welbourne <[email protected]> Mon, 8 Feb 2021 10:43:00 +0000
| Newsgroups | gmane.comp.gnu.make.bugs,gmane.comp.compilers.ccache |
|---|---|
| Message-ID | <AM6PR0202MB34137D5CDA2F6F1DC5667938878F9@AM6PR0202MB3413.eurprd02.prod.outlook.com> |
Hi Sam,=0A= =0A= Thanks for a delightfully illuminating analysis.=0A= I hope you enjoyed the sleuthing, even if it did cost you a month !=0A= =0A= > The TLDR of the above: make reads the job server's file descriptors=0A= > from the MAKEFLAGS environment variable, then checks here if they=0A= > actually exist. If they don't exist, make will create the job server=0A= > pipe. Important: by default they will be file descriptors 3 and 4.=0A= > This becomes a key player in this mystery, a little bit later.=0A= >=0A= > When make spawns a child job (other than a recursive make) the job=0A= > server file descriptors get closed (marked O_CLOEXEC before the actual=0A= > execve), but MAKEFLAGS remains in the environment.=0A= =0A= Sounds to me like that's a bug: when the descriptors are closed, the=0A= part of MAKEFLAGS that claims they're make's jobserver file descriptors=0A= should be removed, since that's when the claim stops being true.=0A= =0A= Eddy.=0A=