Summary: | [make] cc can not create a target when execd by BSD make but succeeds under gmake | ||
---|---|---|---|
Product: | Base System | Reporter: | Bertrand Petit <bsdpr> |
Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
Status: | Closed FIXED | ||
Severity: | Affects Only Me | CC: | andrew, bsdpr, lwhsu, sjg, stable |
Priority: | --- | ||
Version: | CURRENT | ||
Hardware: | Any | ||
OS: | Any | ||
Attachments: |
Description
Bertrand Petit
2020-04-22 00:14:42 UTC
Created attachment 213656 [details]
Truss trace on bsd make, generated with $ truss -f -a -o truss-make.log make CFLAGS=-v ttytest
Created attachment 213657 [details]
Truss trace on gnu make, generated with $ truss -f -a -o truss-gmake.log gmake CFLAGS=-v ttytest
User error, caused by non-obvious magic behavior (aka "POLA violation") on the part of bmake. In short, since /usr/obj/home/elrond exists, bsd make is using that as .OBJDIR by default, and changing directory to it before running commands. So it's the permissions on _that_ directory that cause the issue. It doesn't fail with gmake because that has no such magic behavior. (In reply to andrew from comment #3) Indeed, a major POLA violation is it, but also it is still a bug since this "magic behavior" should only select an /usr/obj subdirectory as an objdir only when that directory exists *and* is writable by the current user. (In reply to andrew from comment #3) The setting of .OBJDIR to /usr/obj/* is controlled by bsd.obj.mk not make. Yes BSD make is a sharp tool compared to gmake ;-) (In reply to Simon J. Gerraty from comment #5) Not correct - the use of /usr/obj as the default prefix for .OBJDIR is hardcoded into bmake - you can see it in contrib/bmake/main.c and pathnames.h. You can also verify this using make -r to skip the use of default .mk files. (In reply to andrew from comment #6) You are correct - sorry, I've added a writable check to Main_SetObjdir in upstream. Fixed in bmake-20201101 correction, fixed in CURRENT will MFC next week |