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

                 Summary: gnulib fcntl breaks output-sync on mingw
                 Project: make
            Submitted by: rprichard
            Submitted on: Fri 23 Apr 2021 03:11:46 AM 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: None
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

When I build make on Linux, using the autoconf script, cross-compiling to
mingw-w64, the fcntl in src/w32/compat/posixfcn.c is disabled in favor of the
version in gnulib. This is a problem for output synchronization (-O), which
does something unusual on Windows:

[in src/output.c]
 - sync_handle is initialized using create_mutex(), which returns a Windows
HANDLE rather than an fd.
 - This HANDLE is then passed to fcntl with F_SETLKW.

The gnulib fcntl doesn't have F_SETLKW, but in any case, the mutex HANDLE
isn't a valid fd, so make prints errors:

    fcntl(): Bad file descriptor

This issue affects the Android NDK build of make.exe on Windows:
https://github.com/android/ndk/issues/1492

Aside: The w32/compat/posixfcn.c version of fcntl assumes that F_SETLKW is
only used with a single Win32 mutex HANDLE. The `last_fl` static variable is
used to allow redundant F_WRLCK operations to succeed -- the first F_UNLCK
operation releases the mutex.

Related issues:
 - https://savannah.gnu.org/bugs/?52922
 - https://savannah.gnu.org/bugs/?57888





    _______________________________________________________

Reply to this item at:

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

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


Reply via email to