On Sun, Feb 26, 2017 at 02:33:14PM +0100, Jan Stary wrote:
> Cleaning up /usr/obj/ before a kernel build
> as a regular user who's in the wobj group,
> I get the following
>
> rm: /usr/obj/usr.sbin/unbound/util/configparser.h: Permission denied
> rm: /usr/obj/usr.sbin/unbound/util/configparser.c: Permission denied
> rm: /usr/obj/usr.sbin/unbound/util/configlexer.c: Permission denied
> rm: /usr/obj/usr.sbin/unbound/util: Directory not empty
> rm: /usr/obj/usr.sbin/unbound: Directory not empty
> rm: /usr/obj/usr.sbin: Directory not empty
>
>
> $ find /usr/obj/ | xargs ls -ld
> drwxrwx--- 3 build wobj 512 Feb 26 14:19 /usr/obj/
> drwxrwx--- 3 build wobj 2560 Feb 26 14:19 /usr/obj/usr.sbin
> drwxrwx--- 3 build wobj 4096 Feb 26 14:19 /usr/obj/usr.sbin/unbound
> drwxr-xr-x 2 build wobj 512 Feb 23 20:43 /usr/obj/usr.sbin/unbound/util
> -rw-rw---- 1 build wobj 166639 Feb 23 20:43
> /usr/obj/usr.sbin/unbound/util/configlexer.c
> -rw-rw---- 1 build wobj 122438 Feb 23 20:43
> /usr/obj/usr.sbin/unbound/util/configparser.c
> -rw-rw---- 1 build wobj 6016 Feb 23 20:43
> /usr/obj/usr.sbin/unbound/util/configparser.h
>
> Everything is 770 build:wobj, except the single directory
> /usr/obj/usr.sbin/unbound/util which is 755 build:wobj.
>
> This is on four different -current machines.
> Is this intended?
Of course it is not intended. It was discussed during the last hackathon
and aja hunted the problem down to a quirk of install -d. We tried a fix
in Makefile.bsd-wrapper, but it turned out to be racy, so I had to back
it out: it could write to the src/ tree in some circumstances.
This is what seems to be the least evil hack:
Index: usr.sbin/unbound/Makefile.in
===================================================================
RCS file: /var/cvs/src/usr.sbin/unbound/Makefile.in,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile.in
--- usr.sbin/unbound/Makefile.in 17 Feb 2017 18:53:31 -0000 1.20
+++ usr.sbin/unbound/Makefile.in 26 Feb 2017 15:04:38 -0000
@@ -408,7 +408,7 @@ _unbound.la: libunbound_wrap.lo libunbou
util/config_file.c: util/configparser.h
util/configlexer.c: $(srcdir)/util/configlexer.lex util/configparser.h
- @-if test ! -d util; then $(INSTALL) -d util; fi
+ @-if test ! -d util; then mkdir -p util; fi
if test "$(LEX)" != ":"; then \
echo "#include \"config.h\"" > $@ ;\
echo "#include \"util/configyyrename.h\"" >> $@ ;\
@@ -416,7 +416,7 @@ util/configlexer.c: $(srcdir)/util/conf
fi
util/configparser.c util/configparser.h: $(srcdir)/util/configparser.y
- @-if test ! -d util; then $(INSTALL) -d util; fi
+ @-if test ! -d util; then mkdir -p util; fi
$(YACC) -d -o util/configparser.c $(srcdir)/util/configparser.y
clean: