bugmake - Bugs: bug #62397, jobserver unavailable from $(shell...

 
 

bug #62397: jobserver unavailable from $(shell $(MAKE)...)

Submitter:  Martin Dorey <mdorey>
Submitted:  Tue 03 May 2022 12:42:45 AM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.4 Operating System:  POSIX-Based
Fixed Release:  4.4 Triage Status:  Medium Effort
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 31 Aug 2022 01:51:18 AM UTC, comment #4: 

This is fixed now in two different ways:

First, the jobserver has been reworked to use a named pipe instead of an anonymous pipe.  This means that any sub-make can open and use the pipe without having to have file descriptors left open.

Second, on systems where we can't use a named pipe we'll add an extra argument disabling the jobserver to MAKEFLAGS to ensure that makes invoked by shell won't try to use it.

Paul D. Smith <psmith>
Group administrator
Tue 03 May 2022 02:03:39 PM UTC, comment #3: 

For explanation of the warning see https://lists.gnu.org/archive/html/bug-make/2021-02/msg00005.html.

MAKEFLAGS= removes all flags. i'd rather use something like filter-out (or some other tool) to remove just the jobserver related flags.

Dmitry Goncharov <dgoncharov>
Tue 03 May 2022 03:01:07 AM UTC, comment #2: 

I don't think so:


martind@sirius:~/tmp/D150109$ cat 2.make
makeprog := $(MAKE)
OUTPUT := $(shell env | grep MAKEFLAGS 1>&2; $(makeprog) -f 3.make)
default:; @true
martind@sirius:~/tmp/D150109$ ~/download/make/make -j2
/home/martind/download/make/make -f 2.make
make[1]: Entering directory '/home/martind/tmp/D150109'
MAKEFLAGS= -j2 --jobserver-auth=3,4
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: Leaving directory '/home/martind/tmp/D150109'
martind@sirius:~/tmp/D150109$


Martin Dorey <mdorey>
Tue 03 May 2022 12:47:13 AM UTC, comment #1: 

Could you also work around it with:

makeprog := $(MAKE)
OUTPUT := $(shell env | grep MAKEFLAGS 1>&2; $(makeprog) -f 3.make)

David Boyce <boyski>
Tue 03 May 2022 12:42:45 AM UTC, original submission:  

This warning:


make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.


... in this demonstration, with a make pulled and built today:


martind@sirius:~/tmp/D150109$ ~/download/make/make --version
GNU Make 4.3.90
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
martind@sirius:~/tmp/D150109$ cat Makefile
default:; $(MAKE) -f 2.make
martind@sirius:~/tmp/D150109$ cat 2.make
OUTPUT := $(shell env | grep MAKEFLAGS 1>&2; $(MAKE) -f 3.make)
default:; @true
martind@sirius:~/tmp/D150109$ cat 3.make
default:; @true
martind@sirius:~/tmp/D150109$ ~/download/make/make -j2
/home/martind/download/make/make -f 2.make
make[1]: Entering directory '/home/martind/tmp/D150109'
MAKEFLAGS= -j2 --jobserver-auth=3,4
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: Leaving directory '/home/martind/tmp/D150109'
martind@sirius:~/tmp/D150109$


... is new with https://savannah.gnu.org/bugs/?58232 (FD_CLOEXEC not initialized on jobserver pipe for recursive make invocations) or so says my git bisect.  I wanted to use $(MAKE), so that the same Make program would be used for nested invocations, as https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html#MAKE-Variable recommends.  I can get rid of the problem by emptying MAKEFLAGS, as suggested by:

https://stackoverflow.com/questions/56485222/gnu-make-nested-calls

... eg like this:


martind@sirius:~/tmp/D150109$ cat 2.work-around
OUTPUT := $(shell env | grep MAKEFLAGS 1>&2; MAKEFLAGS= $(MAKE) -f 3.make)
default:; @true
martind@sirius:~/tmp/D150109$


... and maybe that's not unreasonable because maybe I wouldn't want to pass on eg -n to such (unusual) invocations.  That's what we've done in production to support the Make from Debian Bullseye, which cherry picked that as-yet unreleased fix.  Not passing the jobserver fds might be a more reasonable choice than scraping the arguments to $(shell), looking for $(MAKE), but, in that case, perhaps it would be better were Make not to pass MAKEFLAGS to $(shell) invocations either.  Deciding it's not a bug is fine by me - I really just wanted to make the issue and the work around better known.

Martin Dorey <mdorey>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by dgoncharov (Posted a comment)
  • -email is unavailable- added by boyski (Posted a comment)
  • -email is unavailable- added by mdorey (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-31 psmith StatusNone Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.4
        Triage StatusNone Medium Effort

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code