tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

owner/group/mode in METALOG for hard links



The appended patch adds LINKSOWN. LINKSGRP, and LINKSMODE variables for
use by bsd.links.mk when installing hard links.  They have no effect
except when using a metalog, in which case the information is added to
the metalog.  It also changes a few things that called ${INSTALL_LINK}
without going through bsd.links.mk.

This should fix PRs 24457 and 41155.

I have tested a complete build before and after these changes, and the only
differences are:

(1) Many lines in the metalog now have explicit "uname=root gname=wheel"
    instead of no uname or gname at all.

(2) The following lines in the metalog now have correct instead of incorrect
    "mode=" value (old value is enclosed in "[-...-]", and new value is
    enclosed in "{+...+}"):

./usr/bin/atq type=file [-mode=0555-] {+uname=root gname=wheel mode=04555+}
./usr/bin/atrm type=file [-mode=0555-] {+uname=root gname=wheel mode=04555+}
./usr/bin/batch type=file [-mode=0555-] {+uname=root gname=wheel mode=04555+}
./usr/bin/chfn type=file [-mode=0555-] {+uname=root gname=wheel mode=04555+}
./usr/bin/chsh type=file [-mode=0555-] {+uname=root gname=wheel mode=04555+}
./usr/bin/kpasswd type=file [-mode=0555-] {+uname=root gname=wheel mode=04555+}
./usr/bin/sysstat type=file [-mode=0555-] {+uname=root gname=kmem mode=02555+}
./usr/bin/yppasswd type=file [-mode=0555-] {+uname=root gname=wheel mode=04555+}

(3) Changes in the *.tgz sets corresponding to the changes under (2) above.

Any objections to committing this?

--apb (Alan Barrett)

Index: share/mk/bsd.README
===================================================================
RCS file: /home/apb/netbsd/cvsmirror/cvsroot/src/share/mk/bsd.README,v
retrieving revision 1.248
diff -d -u -r1.248 bsd.README
--- share/mk/bsd.README 13 Mar 2009 16:23:31 -0000      1.248
+++ share/mk/bsd.README 10 Apr 2009 14:01:02 -0000
@@ -1024,6 +1024,10 @@
 The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
 and is included from from <bsd.lib.mk> and <bsd.prog.mk>.
 
+LINKSOWN, LINKSGRP, and LINKSMODE, are relevant only if a metadata log
+is used.  The defaults may be modified by other bsd.*.mk files which
+include bsd.links.mk.
+
 LINKS          The list of hard links, consisting of pairs of paths:
                        source-file target-file
                ${DESTDIR} is prepended to both paths before linking.
@@ -1045,6 +1049,18 @@
                are installed by the `configinstall' target,
                not the `install' target.
 
+LINKSOWN       Link owner.  [${BINOWN}]
+
+LINKSGRP       Link group.  [${BINGRP}]
+
+LINKSMODE      Link mode.  [${NONBINMODE}]
+
+LINKSOWN_<fn>  Link owner of the specific file <fn>.
+
+LINKSGRP_<fn>  Link group of the specific file <fn>.
+
+LINKSMODE_<fn> Link mode of the specific file <fn>.
+
 
 =-=-=-=-=   bsd.man.mk   =-=-=-=-=
 
Index: share/mk/bsd.links.mk
===================================================================
RCS file: /home/apb/netbsd/cvsmirror/cvsroot/src/share/mk/bsd.links.mk,v
retrieving revision 1.33
diff -d -u -r1.33 bsd.links.mk
--- share/mk/bsd.links.mk       1 Mar 2009 09:42:41 -0000       1.33
+++ share/mk/bsd.links.mk       10 Apr 2009 13:54:06 -0000
@@ -8,11 +8,22 @@
 ##### Default values
 LINKS?=
 SYMLINKS?=
+LINKSOWN?=     ${BINOWN}
+LINKSGRP?=     ${BINGRP}
+LINKSMODE?=    ${NONBINMODE}
 
 __linkinstall: .USE
        ${_MKSHMSG_INSTALL} ${.TARGET}; \
-       ${_MKSHECHO} "${INSTALL_LINK} ${.ALLSRC} ${.TARGET}" && \
-       ${INSTALL_LINK} ${.ALLSRC} ${.TARGET}
+       ${_MKSHECHO} "${INSTALL_LINK} \
+           -o ${LINKSOWN_${.ALLSRC:T}:U${LINKSOWN}} \
+           -g ${LINKSGRP_${.ALLSRC:T}:U${LINKSGRP}} \
+           -m ${LINKSMODE_${.ALLSRC:T}:U${LINKSMODE}} \
+           ${.ALLSRC} ${.TARGET}" && \
+       ${INSTALL_LINK} \
+           -o ${LINKSOWN_${.ALLSRC:T}:U${LINKSOWN}} \
+           -g ${LINKSGRP_${.ALLSRC:T}:U${LINKSGRP}} \
+           -m ${LINKSMODE_${.ALLSRC:T}:U${LINKSMODE}} \
+           ${.ALLSRC} ${.TARGET}
 
 ##### Install rules
 .PHONY:                linksinstall
Index: share/mk/bsd.hostprog.mk
===================================================================
RCS file: /home/apb/netbsd/cvsmirror/cvsroot/src/share/mk/bsd.hostprog.mk,v
retrieving revision 1.54
diff -d -u -r1.54 bsd.hostprog.mk
--- share/mk/bsd.hostprog.mk    19 Nov 2008 14:10:48 -0000      1.54
+++ share/mk/bsd.hostprog.mk    10 Apr 2009 13:54:06 -0000
@@ -132,6 +132,7 @@
 .endif
 
 ##### Pull in related .mk logic
+LINKSMODE?= ${BINMODE}
 .include <bsd.man.mk>
 .include <bsd.nls.mk>
 .include <bsd.files.mk>
Index: share/mk/bsd.kmodule.mk
===================================================================
RCS file: /home/apb/netbsd/cvsmirror/cvsroot/src/share/mk/bsd.kmodule.mk,v
retrieving revision 1.18
diff -d -u -r1.18 bsd.kmodule.mk
--- share/mk/bsd.kmodule.mk     24 Jan 2009 22:14:45 -0000      1.18
+++ share/mk/bsd.kmodule.mk     10 Apr 2009 13:54:06 -0000
@@ -96,6 +96,9 @@
 .endif
 
 ##### Pull in related .mk logic
+LINKSOWN?= ${KMODULEOWN}
+LINKSGRP?= ${KMODULEGRP}
+LINKSMODE?= ${KMODULEMODE}
 .include <bsd.man.mk>
 .include <bsd.links.mk>
 .include <bsd.dep.mk>
Index: share/mk/bsd.lib.mk
===================================================================
RCS file: /home/apb/netbsd/cvsmirror/cvsroot/src/share/mk/bsd.lib.mk,v
retrieving revision 1.297
diff -d -u -r1.297 bsd.lib.mk
--- share/mk/bsd.lib.mk 1 Apr 2009 17:47:39 -0000       1.297
+++ share/mk/bsd.lib.mk 10 Apr 2009 13:54:06 -0000
@@ -733,6 +733,9 @@
 .endif # !target(libinstall)                                           # }
 
 ##### Pull in related .mk logic
+LINKSOWN?= ${LIBOWN}
+LINKSGRP?= ${LIBGRP}
+LINKSMODE?= ${LIBMODE}
 .include <bsd.man.mk>
 .include <bsd.nls.mk>
 .include <bsd.files.mk>
Index: share/mk/bsd.man.mk
===================================================================
RCS file: /home/apb/netbsd/cvsmirror/cvsroot/src/share/mk/bsd.man.mk,v
retrieving revision 1.99
diff -d -u -r1.99 bsd.man.mk
--- share/mk/bsd.man.mk 31 Mar 2009 21:00:34 -0000      1.99
+++ share/mk/bsd.man.mk 10 Apr 2009 13:52:14 -0000
@@ -54,8 +54,10 @@
 # XXX consider including bsd.links.mk and using __linkinstall instead
 __linkinstallpage: .USE
        ${_MKSHMSG_INSTALL} ${.TARGET}; \
-       ${_MKSHECHO} "${INSTALL_LINK} ${.ALLSRC} ${.TARGET}" && \
-       ${INSTALL_LINK} ${.ALLSRC} ${.TARGET}
+       ${_MKSHECHO} "${INSTALL_LINK} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
+           ${.ALLSRC} ${.TARGET}" && \
+       ${INSTALL_LINK} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
+           ${.ALLSRC} ${.TARGET}
 
 ##### Build and install rules (source form pages)
 
Index: share/mk/bsd.prog.mk
===================================================================
RCS file: /home/apb/netbsd/cvsmirror/cvsroot/src/share/mk/bsd.prog.mk,v
retrieving revision 1.240
diff -d -u -r1.240 bsd.prog.mk
--- share/mk/bsd.prog.mk        24 Nov 2008 02:13:08 -0000      1.240
+++ share/mk/bsd.prog.mk        10 Apr 2009 13:54:06 -0000
@@ -442,6 +442,9 @@
 .PHONY:                scriptsinstall
 
 ##### Pull in related .mk logic
+LINKSOWN?= ${BINOWN}
+LINKSGRP?= ${BINGRP}
+LINKSMODE?= ${BINMODE}
 .include <bsd.man.mk>
 .include <bsd.nls.mk>
 .include <bsd.files.mk>
Index: share/dict/Makefile
===================================================================
RCS file: /home/apb/netbsd/cvsmirror/cvsroot/src/share/dict/Makefile,v
retrieving revision 1.16
diff -d -u -r1.16 Makefile
--- share/dict/Makefile 18 Sep 2002 08:12:29 -0000      1.16
+++ share/dict/Makefile 10 Apr 2009 13:52:14 -0000
@@ -8,5 +8,6 @@
 FILES= README propernames web2 web2a
 FILESDIR=${BINDIR}/dict
 LINKS= ${FILESDIR}/web2 ${FILESDIR}/words
+LINKSMODE= ${FILESMODE}
 
 .include <bsd.prog.mk>
Index: share/zoneinfo/Makefile
===================================================================
RCS file: /home/apb/netbsd/cvsmirror/cvsroot/src/share/zoneinfo/Makefile,v
retrieving revision 1.42
diff -d -u -r1.42 Makefile
--- share/zoneinfo/Makefile     8 Nov 2007 20:14:07 -0000       1.42
+++ share/zoneinfo/Makefile     10 Apr 2009 13:52:14 -0000
@@ -104,8 +104,10 @@
                                continue; \
                        fi; \
                        ${_MKSHMSG_INSTALL} $$destfile; \
-                       ${_MKSHECHO} ${INSTALL_LINK} $$lastfile $$destfile; \
-                       ${INSTALL_LINK} $$lastfile $$destfile; \
+                       ${_MKSHECHO} ${INSTALL_LINK} -o ${BINOWN} -g ${BINGRP} \
+                           -m ${NONBINMODE} $$lastfile $$destfile; \
+                       ${INSTALL_LINK} -o ${BINOWN} -g ${BINGRP} \
+                           -m ${NONBINMODE} $$lastfile $$destfile; \
                else \
                        lastdevino=$$devino; \
                        lastfile=$$destfile; \
Index: distrib/common/parselist.awk
===================================================================
RCS file: /home/apb/netbsd/cvsmirror/cvsroot/src/distrib/common/parselist.awk,v
retrieving revision 1.15
diff -d -u -r1.15 parselist.awk
--- distrib/common/parselist.awk        30 Apr 2008 13:10:48 -0000      1.15
+++ distrib/common/parselist.awk        10 Apr 2009 13:52:14 -0000
@@ -225,7 +225,7 @@
                                    crunchprog, 555);
                                continue;
                        }
-                       link(crunchprog, $i);
+                       link(crunchprog, $i, 555);
                }
        }
        next;
@@ -248,7 +248,7 @@
                err("Usage: LINK prog link [...]");
        if (mode == "install" || mode == "mtree" || mode == "populate") {
                for (i = 3; i <= NF; i++)
-                       link($2, $i);
+                       link($2, $i, 444);
        }
        next;
 }
@@ -305,7 +305,8 @@
        if (perm == "")
                perm = 444;
        if (mode == "install") {
-               printf("\t${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m %s %s 
%s/%s\n",
+               printf("\t${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP}" \
+                   " -m %s %s %s/%s\n",
                    perm, src, ENVIRON["TARGETDIR"], dest)
        } else if (mode == "mtree") {
                printf("./%s mode=%s\n", dest, perm);
@@ -316,13 +317,14 @@
        }
 }
 
-function link (src, dest) \
+function link (src, dest, perm) \
 {
        if (mode == "install") {
-               printf("\t${INSTALL_LINK} %s/%s %s/%s\n",
-                   ENVIRON["TARGETDIR"], src, ENVIRON["TARGETDIR"], dest)
+               printf("\t${INSTALL_LINK} -o ${BINOWN} -g ${BINGRP}" \
+                   " -m %s %s/%s %s/%s\n",
+                   perm, ENVIRON["TARGETDIR"], src, ENVIRON["TARGETDIR"], dest)
        } else if (mode == "mtree") {
-               printf("./%s\n", dest);
+               printf("./%s mode=%s\n", dest, perm);
        } else {
                printf("rm -rf %s/%s\n", ENVIRON["TARGETDIR"], dest);
                printf("(cd %s; ln %s %s) || exit 1\n",


Home | Main Index | Thread Index | Old Index