URL: <https://savannah.gnu.org/bugs/?59585>
Summary: Make with output-sync prints 'fcntl(): Bad file descriptor' on MacOS when output is piped Project: make Submitted by: None Submitted on: Tue 01 Dec 2020 11:10:50 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: POSIX-Based Fixed Release: None Triage Status: None _______________________________________________________ Details: OS: macOS 10.13.4 (17E202), Darwin 17.5.0 Make: 4.3 Was checking this problem both on Linux and MacOS, only MacOS is having it right now. Steps to reproduce: 1. Create any rule for make. 2. Launch following command: make -j -O <target> | cat Running make without output-sync does not reproduce the problem. Here is my output: ~/example$ ls -lAhF total 512 -rw-r--r-- 1 nikita.akatiev orcgroup 62B Dec 1 13:56 main.c -rwxr-xr-x 1 nikita.akatiev orcgroup 250K Dec 1 13:55 make* ~/example$ cat main.c #include <stdio.h> int main() { puts("Hello"); return 0; } ~/example$ ./make --version GNU Make 4.3 Built for x86_64-apple-darwin17.5.0 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. ~/example$ ./make -j -O main | cat fcntl(): Bad file descriptor cc main.c -o main This is a minimal example; launched on a project with multiple sources (e.g. when building make itself), it seems like every time the output buffers the error is shown: gmake[1]: Leaving directory '.../make-4.3/lib' make all-recursive fcntl(): Bad file descriptor gmake[3]: Entering directory '.../make-4.3/lib' /usr/local/opt/llvm/bin/clang -DHAVE_CONFIG_H -I. -I../src -I/usr/local/include -g -O2 -MT stripslash.o -MD -MP -MF .deps/stripslash.Tpo -c -o stripslash.o stripslash.c mv -f .deps/stripslash.Tpo .deps/stripslash.Po gmake[3]: Leaving directory '.../make-4.3/lib' fcntl(): Bad file descriptor gmake[3]: Entering directory '.../make-4.3/lib' /usr/local/opt/llvm/bin/clang -DHAVE_CONFIG_H -I. -I../src -I/usr/local/include -g -O2 -MT strerror-override.o -MD -MP -MF .deps/strerror-override.Tpo -c -o strerror-override.o strerror-override.c mv -f .deps/strerror-override.Tpo .deps/strerror-override.Po gmake[3]: Leaving directory '.../make-4.3/lib' fcntl(): Bad file descriptor gmake[3]: Entering directory '.../make-4.3/lib' /usr/local/opt/llvm/bin/clang -DHAVE_CONFIG_H -I. -I../src -I/usr/local/include -g -O2 -MT xconcat-filename.o -MD -MP -MF .deps/xconcat-filename.Tpo -c -o xconcat-filename.o xconcat-filename.c mv -f .deps/xconcat-filename.Tpo .deps/xconcat-filename.Po gmake[3]: Leaving directory '.../make-4.3/lib' fcntl(): Bad file descriptor gmake[3]: Entering directory '.../make-4.3/lib' A real use case of piping the output is, for example, passing the build log to tee command for both printing logs and saving them into a file, while using grouped and synchronized logging produced by output-sync. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?59585> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/