URL: <https://savannah.gnu.org/bugs/?57242>
Summary: Non-recursive command passes invalid jobserver file descriptors Project: make Submitted by: stefanbruens Submitted on: Fri 15 Nov 2019 07:41:39 PM UTC Severity: 3 - Normal Item Group: Bug Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: 4.2.1 Operating System: POSIX-Based Fixed Release: None Triage Status: None _______________________________________________________ Details: The problem can be reproduced using the following trivial Makefile: --- all: env | grep FLAGS --- Using strace to get some diagnostics: $> env -i strace -epipe,dup2,execve,fcntl -v -f -o nonrecursive.txt /usr/bin/make -j2 -f Makefile Obivously, the jobserver file descriptors (3,4) are closed on exec by fcntl({3,4}, F_SETFD, FD_CLOEXEC), but are still exported via MFLAGS/MAKEFLAGS=--jobserver-auth=3,4. When the "env | grep FLAGS" command is invoked via shell, the shell creates a new pipe, reusing the no longer used file descriptors 3 and 4. I.e. "env" (which serves as a placeholder here for some command implementing the jobserver protocol) receives some file descriptors which are no jobserver fds. This does not happen when the command is marked as a recursive one (using the '+' marker), but this is non-trivial to achieve in practice: 1. the Makefile may come from some generator 2. the command itself may be some script invoking "gmake" again. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?57242> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/