[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #52922] -Otarget does not function properly and errors on FreeBSD,
From: |
John Hood |
Subject: |
[bug #52922] -Otarget does not function properly and errors on FreeBSD, with stdout to a pipe |
Date: |
Wed, 17 Jan 2018 21:35:35 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:57.0) Gecko/20100101 Firefox/57.0 |
URL:
<http://savannah.gnu.org/bugs/?52922>
Summary: -Otarget does not function properly and errors on
FreeBSD, with stdout to a pipe
Project: make
Submitted by: cgull
Submitted on: Thu 18 Jan 2018 02:35:34 AM 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:
FreeBSD 11.1, GNU Make version 4.2.1 (installed from FreeBSD packages; the
distribution patches are small and don't seem relevant here).
On this system, if GNU Make is invoked with options '-j32 -Otarget' and
standard output is redirected to a pipe, Make prints the following errors:
address@hidden:/tmp 0 $ gmake -j32 -Otarget | cat
fcntl(): Bad file descriptor
touch foo
fcntl(): Bad file descriptor
touch bar
address@hidden:/tmp 0 $ uname -a
This is because FreeBSD only supports fcntl(..., F_SETLKW, ...) on a few types
of files, including regular files and ttys. Pipes and sockets are not
supported.
Locking for other than regular files is not required for POSIX compliance, see
http://pubs.opengroup.org/onlinepubs/9699919799/
I think the impact is fairly minimal. The error message appears, and locking
doesn't happen, but since GNU make gathers output and writes it more
atomically in this mode, -Otarget should still mostly work.
This isn't a problem on Linux, which does seem to support F_SETLKW on pipes
and sockets at least. I do see the problem on macOS, and I would expect that
the problem exists on most/all BSD-derived systems and probably various other
POSIX environments as well.
I don't see an obvious easy solution; I think this is intended to work with
child invocations of make, and so it's best to use a file that all of them
already have open, like stdout. BSD systems could probably use flock()
instead, but choosing flock() over fcntl() in Configure would require figuring
out which is the better implementation on a given system.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52922>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug #52922] -Otarget does not function properly and errors on FreeBSD, with stdout to a pipe,
John Hood <=