[bug #58232] FD_CLOEXEC not initialized on jobserver pipe for recursive make invocations

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #58232] FD_CLOEXEC not initialized on jobserver pipe for recursive make invocations

anonymous
URL:
  <https://savannah.gnu.org/bugs/?58232>

                 Summary: FD_CLOEXEC not initialized on jobserver pipe for
recursive make invocations
                 Project: make
            Submitted by: kevinbuettner
            Submitted on: Thu 23 Apr 2020 09:58:58 PM UTC
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.3
        Operating System: POSIX-Based
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

In make version 4.3, there are circumstances in which the jobserver pipe FDs
are not closed when invoking a job that's not a recursive make invocation.
This happens when invoking make from the top-level make and then starting
another (non-make) job.

I have a test case which causes "make -j4" to hang on 4.3, but not on 4.2.1.
Download the attachment make-cloexec-bug.tgz, and do the following:

[kevinb-fedora@rawhide-1 ~]$ tar xf make-cloexec-bug.tgz
[kevinb-fedora@rawhide-1 ~]$ cd make-cloexec-bug
[kevinb-fedora@rawhide-1 make-cloexec-bug]$ make -j4
sleep 2; echo a
sleep 1; echo b
make -C looper
make[1]: Entering directory '/home/kevinb-fedora/make-cloexec-bug/looper'
gcc -o looper looper.c
./looper
In looper; do...
kill -KILL 2360472
...when done.
make[1]: Leaving directory '/home/kevinb-fedora/make-cloexec-bug/looper'
b
a
^C
[kevinb-fedora@rawhide-1 make-cloexec-bug]$ make --version
GNU Make 4.3
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://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.
[kevinb-fedora@rawhide-1 make-cloexec-bug]$ kill -KILL 2360472

Note that I needed to interrupt the "make -j4" invocation with Ctrl-C in order
to get back to the shell.

This problem occurs for me on current Fedora rawhide using
make-4.3-1.fc33.x86_64, but I have also reproduced it using make built from
git sources; "make --version" shows 4.3.90 for the git version.

---

Here's what a successful / non-buggy run looks like when using make 4.2.1 on
Fedora 31:

[kevinb-fedora@f31-1 ~]$ tar xf make-cloexec-bug.tgz
[kevinb-fedora@f31-1 ~]$ cd make-cloexec-bug
[kevinb-fedora@f31-1 make-cloexec-bug]$ make -j4
sleep 2; echo a
sleep 1; echo b
make -C looper
make[1]: Entering directory '/home/kevinb-fedora/make-cloexec-bug/looper'
gcc -o looper looper.c
./looper
In looper; do...
kill -KILL 814945
...when done.
make[1]: Leaving directory '/home/kevinb-fedora/make-cloexec-bug/looper'
b
a
[kevinb-fedora@f31-1 make-cloexec-bug]$ make --version
GNU Make 4.2.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://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.
[kevinb-fedora@f31-1 make-cloexec-bug]$ kill -KILL 814945

Note that I did NOT need to interrupt make with Ctrl-C in this run.

I have a patch for this bug.  I'll attach/upload it after the bug is
submitted.  (I want to be able to put the bug ID into the commit log.)



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 23 Apr 2020 09:58:58 PM UTC  Name: make-cloexec-bug.tgz  Size: 559B
 By: kevinbuettner

<http://savannah.gnu.org/bugs/download.php?file_id=48915>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58232>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #58232] FD_CLOEXEC not initialized on jobserver pipe for recursive make invocations

anonymous
Additional Item Attachment, bug #58232 (project make):

File name: bug58232.patch                 Size:2 KB
    <https://savannah.gnu.org/file/bug58232.patch?file_id=48916>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58232>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #58232] FD_CLOEXEC not initialized on jobserver pipe for recursive make invocations

anonymous
Update of bug #58232 (project make):

                  Status:                    None => Fixed                  
             Open/Closed:                    Open => Closed                
           Fixed Release:                    None => SCM                    

    _______________________________________________________

Follow-up Comment #1:

Fix applied, thanks!

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58232>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/