Discussion:
postinstall bug in mtree check?
J. Lewis Muir
2014-09-24 20:41:49 UTC
Permalink
Hello, NetBSD Users.

I just built on and for amd64 from the netbsd-6 CVS branch source and
installed and ran a postinstall check of the mtree item and got an
unexpected difference. The output is below. Looking at the postinstall
source, I'm thinking (but haven't confirmed) the problem is that make is
echoing to stdout the command executed for the emit_dist_file target,
and that is getting erroneously captured when postinstall invokes it
and redirects stdout to create the expected NetBSD.dist mtree file thus
causing the expected and actual files to differ.

Thank you!

Lewis

~~~
# postinstall -s '/usr/src' -d / diff -u mtree
Source directory: /usr/src
Target directory: /
mtree check:
/tmp/_postinstall.3630.0/NetBSD.dist != /etc/mtree/NetBSD.dist
--- /etc/mtree/NetBSD.dist 2014-09-23 16:01:14.000000000 -0500
+++ /tmp/_postinstall.3630.0/NetBSD.dist 2014-09-24 15:21:59.000000000 -0500
@@ -1,3 +1,4 @@
+cat /usr/src/etc/mtree/NetBSD.dist.base /usr/src/etc/mtree/NetBSD.dist.x86_64 /usr/src/etc/mtree/NetBSD.dist.tests
# $NetBSD: NetBSD.dist.base,v 1.97.2.5 2012/11/18 22:38:37 riz Exp $
# @(#)4.4BSD.dist 8.1 (Berkeley) 6/13/93

postinstall checks passed:
postinstall checks failed: mtree
To fix, run:
sh /usr/sbin/postinstall -s '/usr/src' -d / fix mtree
Note that this may overwrite local changes.
~~~
J. Lewis Muir
2014-09-24 21:02:31 UTC
Permalink
Post by J. Lewis Muir
Hello, NetBSD Users.
I just built on and for amd64 from the netbsd-6 CVS branch source
and installed and ran a postinstall check of the mtree item and
got an unexpected difference. The output is below. Looking at
the postinstall source, I'm thinking (but haven't confirmed) the
problem is that make is echoing to stdout the command executed for the
emit_dist_file target, and that is getting erroneously captured when
postinstall invokes it and redirects stdout to create the expected
NetBSD.dist mtree file thus causing the expected and actual files to
differ.
Adding '-s' to the make invocation in postinstall fixes the problem.
Below is a patch against the netbsd-6 CVS branch.

Thanks,

Lewis

Index: usr.sbin/postinstall/postinstall
===================================================================
RCS file: /cvsroot/src/usr.sbin/postinstall/postinstall,v
retrieving revision 1.129.2.11
diff -u -r1.129.2.11 postinstall
--- usr.sbin/postinstall/postinstall 21 May 2014 20:29:02 -0000 1.129.2.11
+++ usr.sbin/postinstall/postinstall 24 Sep 2014 20:57:20 -0000
@@ -998,7 +998,7 @@
if ! $SOURCEMODE; then
MTREE_DIR="${SRC_DIR}/etc/mtree"
else
- ${MAKE} -C ${SRC_DIR}/etc/mtree emit_dist_file > \
+ ${MAKE} -s -C ${SRC_DIR}/etc/mtree emit_dist_file > \
"${SCRATCHDIR}/NetBSD.dist"
MTREE_DIR="${SCRATCHDIR}"
fi
Greg Troxel
2014-09-30 13:19:09 UTC
Permalink
Post by J. Lewis Muir
Adding '-s' to the make invocation in postinstall fixes the problem.
Below is a patch against the netbsd-6 CVS branch.
Thanks,
Lewis
Index: usr.sbin/postinstall/postinstall
===================================================================
RCS file: /cvsroot/src/usr.sbin/postinstall/postinstall,v
retrieving revision 1.129.2.11
diff -u -r1.129.2.11 postinstall
--- usr.sbin/postinstall/postinstall 21 May 2014 20:29:02 -0000 1.129.2.11
+++ usr.sbin/postinstall/postinstall 24 Sep 2014 20:57:20 -0000
@@ -998,7 +998,7 @@
if ! $SOURCEMODE; then
MTREE_DIR="${SRC_DIR}/etc/mtree"
else
- ${MAKE} -C ${SRC_DIR}/etc/mtree emit_dist_file > \
+ ${MAKE} -s -C ${SRC_DIR}/etc/mtree emit_dist_file > \
"${SCRATCHDIR}/NetBSD.dist"
MTREE_DIR="${SCRATCHDIR}"
fi
There's already a fix in -current and -7, which is to put @ in front of
the cat command in the makefile. I've asked that this be pulled up to
netbsd-6:
http://releng.netbsd.org/cgi-bin/req-6.cgi?show=1163

Thanks for the report - without it none of us would have realized that
this fix was both needed and missing in -6!

Greg
J. Lewis Muir
2014-09-30 14:48:04 UTC
Permalink
of the cat command in the makefile. I've asked that this be pulled up
http://releng.netbsd.org/cgi-bin/req-6.cgi?show=1163
Thanks for the report - without it none of us would have realized that
this fix was both needed and missing in -6!
Hi, Greg.

OK, great!

FYI, I had submitted PR 49238 [1] for this, so once your pull-up request
happens, the PR can be closed.

Thanks!

Lewis

[1] http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=49238
Loading...