NetBSD Problem Report #54730

From tsutsui@ceres.dti.ne.jp  Sun Dec  1 16:51:34 2019
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 153A77A158
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  1 Dec 2019 16:51:34 +0000 (UTC)
Message-Id: <201912011651.xB1GpO1e006893@ceres.dti.ne.jp>
Date: Mon, 2 Dec 2019 01:51:24 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: postinstall(8) fix doesn't remove obsolete /etc/rc.d files
X-Send-Pr-Version: 3.95

>Number:         54730
>Category:       bin
>Synopsis:       postinstall(8) fix doesn't remove obsolete /etc/rc.d files
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 01 16:55:00 +0000 2019
>Closed-Date:    Sun Jan 12 16:06:02 +0000 2020
>Last-Modified:  Sun Jan 12 16:06:02 +0000 2020
>Originator:     Izumi Tsutsui
>Release:        NetBSD 9.0_RC1
>Organization:
>Environment:
System: NetBSD evbarm 9.0_RC1 (HPT5325)
Architecture: earm (but all ports, or all arm ports?)
Machine: evbarm (but all?)

>Description:
It looks postinstall(8) fix command on 9.0_RC1 with the etc.tgz set
doesn't remove at least obsolete /etc/rc.d/isdnd, which it's marked
as obsolete in src/distrib/sets/lists/etc/mi and /var/db/obsolete/etc.

As a result, /etc/rc complains on boot:
---
/etc/rc: WARNING: $dhclient is not set properly - see rc.conf(5).
 :
/etc/rc: WARNING: $isdnd is not set properly - see rc.conf(5).
---
even after postinstall-fix.

>How-To-Repeat:

# ftp -o /tmp/etc.tgz http://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0_RC1/evbarm-earm/binary/sets/etc.tgz
Trying [2a04:4e42:15::262]:80 ...
ftp: Can't connect to `2a04:4e42:15::262:80': No route to host
Trying 151.101.89.6:80 ...
Requesting http://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0_RC1/evbarm-earm/binary/sets/etc.tgz
100% |***********************************|   642 KiB    3.49 MiB/s    00:00 ETA
657924 bytes retrieved in 00:00 (3.48 MiB/s)
# postinstall -s /tmp/etc.tgz fix
Note: Creating temporary directory /tmp/_postinstall.2798.0/etc.tgz
Note: Extracting files from /tmp/etc.tgz
Source directory: /tmp/_postinstall.2798.0/etc.tgz
 (extracted from: /tmp/etc.tgz)
Target directory: /
bluetooth fix:
ddbonpanic fix:
defaults fix:
	(Checking for pf.boot.conf from /tmp/_postinstall.2798.0/etc.tgz/etc/defaults instead of /tmp/_postinstall.2798.0/etc.tgz/usr.sbin/pf/etc/defaults)
dhcpcd fix:
	(Checking for dhcpcd.conf from /tmp/_postinstall.2798.0/etc.tgz/etc instead of /tmp/_postinstall.2798.0/etc.tgz/external/bsd/dhcpcd/dist/src)
dhcpcdrundir fix:
envsys fix:
fontconfig fix:
	/tmp/_postinstall.2798.0/etc.tgz/etc/fonts/conf.avail is not a directory; skipping check
gid fix:
	Error groups (FIX MANUALLY): _rtadvd (missing) _gpio (missing) _nsd (missing) _unbound (missing) nvmm (missing)
	Use the following as a template:
_rtadvd:*:30:
_gpio:*:29:
_nsd:*:33:
_unbound:*:32:
nvmm:*:34:root
	and adjust if necessary.
gpio fix:
hosts fix:
iscsi fix:
makedev fix:
	(Checking for MAKEDEV from /tmp/_postinstall.2798.0/etc.tgz/dev instead of /tmp/_postinstall.2798.0)
	(Checking for MAKEDEV.local from /tmp/_postinstall.2798.0/etc.tgz/dev instead of /tmp/_postinstall.2798.0/etc.tgz/etc)
motd fix:
mtree fix:
named fix:
pam fix:
periodic fix:
pf fix:
	(Checking for pf.os from /tmp/_postinstall.2798.0/etc.tgz/etc instead of /tmp/_postinstall.2798.0/etc.tgz/dist/pf/etc)
pwd_mkdb fix:
rc fix:
	(Checking for blacklistd from /tmp/_postinstall.2798.0/etc.tgz/etc/rc.d instead of /tmp/_postinstall.2798.0/etc.tgz/external/bsd/blacklist/etc/rc.d)
ssh fix:
	(Checking for moduli from /tmp/_postinstall.2798.0/etc.tgz/etc instead of /tmp/_postinstall.2798.0/etc.tgz/crypto/external/bsd/openssh/dist)
wscons fix:
x11 fix:
xkb fix:
uid fix:
	Error users (FIX MANUALLY): _rtadvd (missing) _nsd (missing) _unbound (missing)
	Use the following as a template:
_rtadvd:*:30:30::0:0:& pseudo-user:/var/chroot/rtadvd:/sbin/nologin
_nsd:*:33:33::0:0:& pseudo-user:/var/chroot/nsd:/sbin/nologin
_unbound:*:32:32::0:0:& pseudo-user:/var/chroot/unbound:/sbin/nologin
	and adjust if necessary.
varrwho fix:
tcpdumpchroot fix:
atf fix:
	(Checking for NetBSD.conf from /tmp/_postinstall.2798.0/etc.tgz/etc/atf instead of /tmp/_postinstall.2798.0/etc.tgz/external/bsd/atf/etc/atf)
	(Checking for atf-run.hooks from /tmp/_postinstall.2798.0/etc.tgz/etc/atf instead of /tmp/_postinstall.2798.0/etc.tgz/external/bsd/atf/dist/tools/sample)
catpages fix:
manconf fix:
ptyfsoldnodes fix:
varshm fix:
obsolete fix:
eabi
eabihf
oabi
postinstall fixes passed: bluetooth ddbonpanic defaults dhcpcd dhcpcdrundir envsys fontconfig gpio hosts iscsi makedev motd mtree named pam periodic pf pwd_mkdb rc ssh wscons x11 xkb varrwho tcpdumpchroot atf catpages manconf ptyfsoldnodes varshm obsolete
postinstall fixes failed: gid uid
# ls -l /etc/rc.d/isdnd
-r-xr-xr-x  1 root  wheel  472 Apr 13  2014 /etc/rc.d/isdnd
# cd /tmp
# tar zxf etc.tgz
# grep -R isdnd var
var/db/obsolete/etc:./etc/rc.d/isdnd
# 

>Fix:
Something wrong in this change?
 http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/postinstall/postinstall.in.diff?r1=1.3&r2=1.4

--- src/usr.sbin/postinstall/postinstall.in	2019/06/14 14:17:45	1.3
+++ src/usr.sbin/postinstall/postinstall.in	2019/06/14 14:39:49	1.4
@@ -1422,6 +1428,15 @@ select_set_files()
 	    -e "/^\.${qdir}/s@^.$2[[:space:]].*@\1@p" $3
 }

+# select obsolete files in a sets file
+# $1: directory pattern
+# $2: file pattern
+# $3: filename
+select_obsolete_files()
+{
+	${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" $3
+}
+
 exclude()
 {
 	if [ -z "$*" ]; then
@@ -1465,9 +1480,8 @@ do_rc()
 	    exclude ${rc_external_files})"

 	# obsolete rc file in /etc/rc.d
-	local rc_obsolete_files="$(${SED} -n \
-	    -e '/obsolete/s@./etc/rc.d/\([^[:space:]]*\)[[:space:]].*@\1@p' \
-	    ${etcsets})"
+	local rc_obsolete_files="$(select_obsolete_files /etc/rc.d/ \
+	    "\([^[:space:]]*\)" ${etcsets})"

 	compare_dir "${op}" "${SRC_DIR}/etc" "${DEST_DIR}/etc" 644 \
 		${rc_644_files}

>Release-Note:

>Audit-Trail:
From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: bin/54730: postinstall(8) fix doesn't remove obsolete /etc/rc.d
 files
Date: Sun, 1 Dec 2019 13:21:10 -0500

 I don't think that's there anything wrong with this change. The problem =
 is
 that there is no information about obsolete files in /etc/mtree so you =
 need
 to use source sets.=20

 $ cat x
 #!/bin/sh
 # does not work
 #etcsets=3D/etc/mtree/set.etc
 etcsets=3D/usr/src/distrib/sets/lists/etc/mi
 SED=3Dsed

 select_obsolete_files()
 {
         ${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" $3
 }

 # obsolete rc file in /etc/rc.d
 rc_obsolete_files=3D"$(select_obsolete_files /etc/rc.d/ \
     "\([^[:space:]]*\)" ${etcsets})"

 echo ${rc_obsolete_files}
 $./x=20
 NETWORK btattach btconfig btcontrol btdevctl bthcid btuartd dhclient =
 fixsb fsck.sh gated isdnd kerberos lkm1 lkm2 lkm3 poffd rtsold sdpd =
 systemfs xntpd ypset


 christos
 > On Dec 1, 2019, at 11:55 AM, Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> =
 wrote:
 >=20
 >> Number:         54730
 >> Category:       bin
 >> Synopsis:       postinstall(8) fix doesn't remove obsolete /etc/rc.d =
 files
 >> Confidential:   no
 >> Severity:       non-critical
 >> Priority:       high
 >> Responsible:    bin-bug-people
 >> State:          open
 >> Class:          sw-bug
 >> Submitter-Id:   net
 >> Arrival-Date:   Sun Dec 01 16:55:00 +0000 2019
 >> Originator:     Izumi Tsutsui
 >> Release:        NetBSD 9.0_RC1
 >> Organization:
 >> Environment:
 > System: NetBSD evbarm 9.0_RC1 (HPT5325)
 > Architecture: earm (but all ports, or all arm ports?)
 > Machine: evbarm (but all?)
 >=20
 >> Description:
 > It looks postinstall(8) fix command on 9.0_RC1 with the etc.tgz set
 > doesn't remove at least obsolete /etc/rc.d/isdnd, which it's marked
 > as obsolete in src/distrib/sets/lists/etc/mi and /var/db/obsolete/etc.
 >=20
 > As a result, /etc/rc complains on boot:
 > ---
 > /etc/rc: WARNING: $dhclient is not set properly - see rc.conf(5).
 > :
 > /etc/rc: WARNING: $isdnd is not set properly - see rc.conf(5).
 > ---
 > even after postinstall-fix.
 >=20
 >> How-To-Repeat:
 >=20
 > # ftp -o /tmp/etc.tgz =
 http://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0_RC1/evbarm-earm/binary/sets/et=
 c.tgz
 > Trying [2a04:4e42:15::262]:80 ...
 > ftp: Can't connect to `2a04:4e42:15::262:80': No route to host
 > Trying 151.101.89.6:80 ...
 > Requesting =
 http://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0_RC1/evbarm-earm/binary/sets/et=
 c.tgz
 > 100% |***********************************|   642 KiB    3.49 MiB/s    =
 00:00 ETA
 > 657924 bytes retrieved in 00:00 (3.48 MiB/s)
 > # postinstall -s /tmp/etc.tgz fix
 > Note: Creating temporary directory /tmp/_postinstall.2798.0/etc.tgz
 > Note: Extracting files from /tmp/etc.tgz
 > Source directory: /tmp/_postinstall.2798.0/etc.tgz
 > (extracted from: /tmp/etc.tgz)
 > Target directory: /
 > bluetooth fix:
 > ddbonpanic fix:
 > defaults fix:
 > 	(Checking for pf.boot.conf from =
 /tmp/_postinstall.2798.0/etc.tgz/etc/defaults instead of =
 /tmp/_postinstall.2798.0/etc.tgz/usr.sbin/pf/etc/defaults)
 > dhcpcd fix:
 > 	(Checking for dhcpcd.conf from =
 /tmp/_postinstall.2798.0/etc.tgz/etc instead of =
 /tmp/_postinstall.2798.0/etc.tgz/external/bsd/dhcpcd/dist/src)
 > dhcpcdrundir fix:
 > envsys fix:
 > fontconfig fix:
 > 	/tmp/_postinstall.2798.0/etc.tgz/etc/fonts/conf.avail is not a =
 directory; skipping check
 > gid fix:
 > 	Error groups (FIX MANUALLY): _rtadvd (missing) _gpio (missing) =
 _nsd (missing) _unbound (missing) nvmm (missing)
 > 	Use the following as a template:
 > _rtadvd:*:30:
 > _gpio:*:29:
 > _nsd:*:33:
 > _unbound:*:32:
 > nvmm:*:34:root
 > 	and adjust if necessary.
 > gpio fix:
 > hosts fix:
 > iscsi fix:
 > makedev fix:
 > 	(Checking for MAKEDEV from /tmp/_postinstall.2798.0/etc.tgz/dev =
 instead of /tmp/_postinstall.2798.0)
 > 	(Checking for MAKEDEV.local from =
 /tmp/_postinstall.2798.0/etc.tgz/dev instead of =
 /tmp/_postinstall.2798.0/etc.tgz/etc)
 > motd fix:
 > mtree fix:
 > named fix:
 > pam fix:
 > periodic fix:
 > pf fix:
 > 	(Checking for pf.os from /tmp/_postinstall.2798.0/etc.tgz/etc =
 instead of /tmp/_postinstall.2798.0/etc.tgz/dist/pf/etc)
 > pwd_mkdb fix:
 > rc fix:
 > 	(Checking for blacklistd from =
 /tmp/_postinstall.2798.0/etc.tgz/etc/rc.d instead of =
 /tmp/_postinstall.2798.0/etc.tgz/external/bsd/blacklist/etc/rc.d)
 > ssh fix:
 > 	(Checking for moduli from /tmp/_postinstall.2798.0/etc.tgz/etc =
 instead of =
 /tmp/_postinstall.2798.0/etc.tgz/crypto/external/bsd/openssh/dist)
 > wscons fix:
 > x11 fix:
 > xkb fix:
 > uid fix:
 > 	Error users (FIX MANUALLY): _rtadvd (missing) _nsd (missing) =
 _unbound (missing)
 > 	Use the following as a template:
 > _rtadvd:*:30:30::0:0:& pseudo-user:/var/chroot/rtadvd:/sbin/nologin
 > _nsd:*:33:33::0:0:& pseudo-user:/var/chroot/nsd:/sbin/nologin
 > _unbound:*:32:32::0:0:& pseudo-user:/var/chroot/unbound:/sbin/nologin
 > 	and adjust if necessary.
 > varrwho fix:
 > tcpdumpchroot fix:
 > atf fix:
 > 	(Checking for NetBSD.conf from =
 /tmp/_postinstall.2798.0/etc.tgz/etc/atf instead of =
 /tmp/_postinstall.2798.0/etc.tgz/external/bsd/atf/etc/atf)
 > 	(Checking for atf-run.hooks from =
 /tmp/_postinstall.2798.0/etc.tgz/etc/atf instead of =
 /tmp/_postinstall.2798.0/etc.tgz/external/bsd/atf/dist/tools/sample)
 > catpages fix:
 > manconf fix:
 > ptyfsoldnodes fix:
 > varshm fix:
 > obsolete fix:
 > eabi
 > eabihf
 > oabi
 > postinstall fixes passed: bluetooth ddbonpanic defaults dhcpcd =
 dhcpcdrundir envsys fontconfig gpio hosts iscsi makedev motd mtree named =
 pam periodic pf pwd_mkdb rc ssh wscons x11 xkb varrwho tcpdumpchroot atf =
 catpages manconf ptyfsoldnodes varshm obsolete
 > postinstall fixes failed: gid uid
 > # ls -l /etc/rc.d/isdnd
 > -r-xr-xr-x  1 root  wheel  472 Apr 13  2014 /etc/rc.d/isdnd
 > # cd /tmp
 > # tar zxf etc.tgz
 > # grep -R isdnd var
 > var/db/obsolete/etc:./etc/rc.d/isdnd
 > #=20
 >=20
 >> Fix:
 > Something wrong in this change?
 > =
 http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/postinstall/postinstall.i=
 n.diff?r1=3D1.3&r2=3D1.4
 >=20
 > --- src/usr.sbin/postinstall/postinstall.in	2019/06/14 14:17:45	=
 1.3
 > +++ src/usr.sbin/postinstall/postinstall.in	2019/06/14 14:39:49	=
 1.4
 > @@ -1422,6 +1428,15 @@ select_set_files()
 > 	    -e "/^\.${qdir}/s@^.$2[[:space:]].*@\1@p" $3
 > }
 >=20
 > +# select obsolete files in a sets file
 > +# $1: directory pattern
 > +# $2: file pattern
 > +# $3: filename
 > +select_obsolete_files()
 > +{
 > +	${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" $3
 > +}
 > +
 > exclude()
 > {
 > 	if [ -z "$*" ]; then
 > @@ -1465,9 +1480,8 @@ do_rc()
 > 	    exclude ${rc_external_files})"
 >=20
 > 	# obsolete rc file in /etc/rc.d
 > -	local rc_obsolete_files=3D"$(${SED} -n \
 > -	    -e =
 '/obsolete/s@./etc/rc.d/\([^[:space:]]*\)[[:space:]].*@\1@p' \
 > -	    ${etcsets})"
 > +	local rc_obsolete_files=3D"$(select_obsolete_files /etc/rc.d/ \
 > +	    "\([^[:space:]]*\)" ${etcsets})"
 >=20
 > 	compare_dir "${op}" "${SRC_DIR}/etc" "${DEST_DIR}/etc" 644 \
 > 		${rc_644_files}

From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/54730: postinstall(8) fix doesn't remove obsolete /etc/rc.d files
Date: Mon, 02 Dec 2019 08:03:01 +0700

     Date:        Sun,  1 Dec 2019 16:55:00 +0000 (UTC)
     From:        Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
     Message-ID:  <20191201165500.73E7D7A1D6@mollari.NetBSD.org>


   | Something wrong in this change?

 Maybe I'm missing something, but what is really changing there?

 The sed command is moved into a shell function (which only handles one
 "${etcfiles}" where the original would have worked with more - which is
 most likely irrelevant and would be easy to fix) but it looks to me that
 it ends up being the exact same sed command running on the exact same data
 (assuming there is just one etcset))

 Did I not see some subtle change?

 kre

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: christos@zoulas.com, tsutsui@ceres.dti.ne.jp
Subject: Re: bin/54730: postinstall(8) fix doesn't remove obsolete /etc/rc.dfiles
Date: Mon, 2 Dec 2019 19:44:43 +0900

 >  I don't think that's there anything wrong with this change.

 Sorry, I was so stupid that I just quoted a recent revision
 which had "obsolete rc.d" strings.

 >  The problem is
 >  that there is no information about obsolete files in /etc/mtree so you need
 >  to use source sets.

 Indeed, but why not ./var/db/obsolete/etc in etc.tgz as other sets?

 ---
 Izumi Tsutsui

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54730 CVS commit: src/usr.sbin/postinstall
Date: Tue, 3 Dec 2019 23:45:42 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Wed Dec  4 04:45:42 UTC 2019

 Modified Files:
 	src/usr.sbin/postinstall: postinstall.in

 Log Message:
 PR/54730: Izumi Tsutsui: Use /var/db/obsolete/<set> to remove obsolete rc.d
 files when not in $SOURCEMODE.


 To generate a diff of this commit:
 cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/postinstall/postinstall.in

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: christos@netbsd.org, tsutsui@ceres.dti.ne.jp
Subject: Re: PR/54730 CVS commit: src/usr.sbin/postinstall
Date: Wed, 4 Dec 2019 20:44:21 +0900

 >  Module Name:	src
 >  Committed By:	christos
 >  Date:		Wed Dec  4 04:45:42 UTC 2019
 >  
 >  Modified Files:
 >  	src/usr.sbin/postinstall: postinstall.in
 >  
 >  Log Message:
 >  PR/54730: Izumi Tsutsui: Use /var/db/obsolete/<set> to remove obsolete rc.d
 >  files when not in $SOURCEMODE.

 ---
 -# $3: filename
 +# $3: setname
  select_obsolete_files()
  {
 -	${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" $3
 +	if $SOURCEMODE; then
 +		${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" \
 +		    ${SRC_DIR}/distrib/sets/lists/$3/mi
 +	else
 +		${SED} -n -e "s@\.$1$2\$@\1@p" "${DEST_DIR}/var/db/obsolete/$3"
 +	fi
  }
 ---

 Sorry, my previous comment was incomplete and
 this does not work as expected.

 /var/db/obsolete/etc is not extracted into ${DESTDIR}
 as other sets but prepared in ${ETCTGZDIR}:

 --- postinstall.in.orig	2019-12-04 20:36:27.562323424 +0900
 +++ postinstall.in	2019-12-04 20:37:31.591546076 +0900
 @@ -1465,11 +1465,18 @@
  # $3: setname
  select_obsolete_files()
  {
 +	local obsolete_dir
 +	if [ $3 = "etc" ] ;then
 +		obsolete_dir=${SRC_DIR}/var/db/obsolete
 +	else
 +		obsolete_dir=${DEST_DIR}/var/db/obsolete
 +	fi
 +
  	if $SOURCEMODE; then
  		${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" \
  		    ${SRC_DIR}/distrib/sets/lists/$3/mi
  	else
 -		${SED} -n -e "s@\.$1$2\$@\1@p" "${DEST_DIR}/var/db/obsolete/$3"
 +		${SED} -n -e "s@\.$1$2\$@\1@p" "${obsolete_dir}/$3"
  	fi
  }


From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: christos@netbsd.org
Cc: gnats-bugs@netbsd.org, tsutsui@ceres.dti.ne.jp
Subject: Re: PR/54730 CVS commit: src/usr.sbin/postinstall
Date: Sun, 22 Dec 2019 11:15:46 +0900

 I wrote:

 > /var/db/obsolete/etc is not extracted into ${DESTDIR}
 > as other sets but prepared in ${ETCTGZDIR}:
 > 
 > --- postinstall.in.orig	2019-12-04 20:36:27.562323424 +0900
 > +++ postinstall.in	2019-12-04 20:37:31.591546076 +0900
 > @@ -1465,11 +1465,18 @@
 >  # $3: setname
 >  select_obsolete_files()
 >  {
 > +	local obsolete_dir
 > +	if [ $3 = "etc" ] ;then
 > +		obsolete_dir=${SRC_DIR}/var/db/obsolete
 > +	else
 > +		obsolete_dir=${DEST_DIR}/var/db/obsolete
 > +	fi
 > +
 >  	if $SOURCEMODE; then
 >  		${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" \
 >  		    ${SRC_DIR}/distrib/sets/lists/$3/mi
 >  	else
 > -		${SED} -n -e "s@\.$1$2\$@\1@p" "${DEST_DIR}/var/db/obsolete/$3"
 > +		${SED} -n -e "s@\.$1$2\$@\1@p" "${obsolete_dir}/$3"
 >  	fi
 >  }
 >  
 > 

 You have a concern (in PR/54741):

  https://mail-index.netbsd.org/netbsd-bugs/2019/12/07/msg064879.html
 >> I am worried that SRC_DIR does not work if not $SOURCEMODE, this is why
 >> I have not committed it...

 My answer is:

  https://mail-index.netbsd.org/netbsd-bugs/2019/12/07/msg064883.html
 >> I guess !$SOURCEMODE means $TGZMODE.
 >> In that case SRC_DIR for the etc set is already handled,
 >> at least it should work in select_obsolete_files():

 Do you have some idea about specific test cases?
 These postinstall problems should be fixed before 9.0 release.

 Thanks,

 ---
 Izumi Tsutsui

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 tsutsui@ceres.dti.ne.jp
Subject: Re: PR/54730 CVS commit: src/usr.sbin/postinstall
Date: Sun, 22 Dec 2019 10:53:21 -0500

 --Apple-Mail=_F19DAF02-B7A0-4B70-9B42-9C7276A3EACA
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=us-ascii

 Yes, and I have not had time to understand and test it. I have not =
 committed
 anything because I don't want to make it worse. For example your latest
 patch does something special for the "etc" set, and I don't understand =
 how "etc"
 is special. Also obsolete_dir is only used in one part of the if =
 statement and
 should not be always set.

 christos

 > On Dec 21, 2019, at 9:20 PM, Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> =
 wrote:
 >=20
 > The following reply was made to PR bin/54730; it has been noted by =
 GNATS.
 >=20
 > From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
 > To: christos@netbsd.org
 > Cc: gnats-bugs@netbsd.org, tsutsui@ceres.dti.ne.jp
 > Subject: Re: PR/54730 CVS commit: src/usr.sbin/postinstall
 > Date: Sun, 22 Dec 2019 11:15:46 +0900
 >=20
 > I wrote:
 >=20
 >> /var/db/obsolete/etc is not extracted into ${DESTDIR}
 >> as other sets but prepared in ${ETCTGZDIR}:
 >>=20
 >> --- postinstall.in.orig	2019-12-04 20:36:27.562323424 +0900
 >> +++ postinstall.in	2019-12-04 20:37:31.591546076 +0900
 >> @@ -1465,11 +1465,18 @@
 >> # $3: setname
 >> select_obsolete_files()
 >> {
 >> +	local obsolete_dir
 >> +	if [ $3 =3D "etc" ] ;then
 >> +		obsolete_dir=3D${SRC_DIR}/var/db/obsolete
 >> +	else
 >> +		obsolete_dir=3D${DEST_DIR}/var/db/obsolete
 >> +	fi
 >> +
 >> 	if $SOURCEMODE; then
 >> 		${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" \
 >> 		    ${SRC_DIR}/distrib/sets/lists/$3/mi
 >> 	else
 >> -		${SED} -n -e "s@\.$1$2\$@\1@p" =
 "${DEST_DIR}/var/db/obsolete/$3"
 >> +		${SED} -n -e "s@\.$1$2\$@\1@p" "${obsolete_dir}/$3"
 >> 	fi
 >> }
 >>=20
 >>=20
 >=20
 > You have a concern (in PR/54741):
 >=20
 >  https://mail-index.netbsd.org/netbsd-bugs/2019/12/07/msg064879.html
 >>> I am worried that SRC_DIR does not work if not $SOURCEMODE, this is =
 why
 >>> I have not committed it...
 >=20
 > My answer is:
 >=20
 >  https://mail-index.netbsd.org/netbsd-bugs/2019/12/07/msg064883.html
 >>> I guess !$SOURCEMODE means $TGZMODE.
 >>> In that case SRC_DIR for the etc set is already handled,
 >>> at least it should work in select_obsolete_files():
 >=20
 > Do you have some idea about specific test cases?
 > These postinstall problems should be fixed before 9.0 release.
 >=20
 > Thanks,
 >=20
 > ---
 > Izumi Tsutsui
 >=20


 --Apple-Mail=_F19DAF02-B7A0-4B70-9B42-9C7276A3EACA
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org

 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXf+RcQAKCRBxESqxbLM7
 OpPQAJ0agprmJmKOzxi9o2AJ70sExo0OwACg0AbjKpF9aBexqAXMp8srRLiKLes=
 =bT8y
 -----END PGP SIGNATURE-----

 --Apple-Mail=_F19DAF02-B7A0-4B70-9B42-9C7276A3EACA--

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: christos@zoulas.com
Cc: gnats-bugs@netbsd.org, tsutsui@ceres.dti.ne.jp
Subject: Re: PR/54730 CVS commit: src/usr.sbin/postinstall
Date: Mon, 23 Dec 2019 01:55:37 +0900

 > Yes, and I have not had time to understand and test it. I have not committed
 > anything because I don't want to make it worse. For example your latest
 > patch does something special for the "etc" set, and I don't understand how "etc"
 > is special.

 IIUC, etc.tgz is not extracted into ${DESTDIR} on upgrade installation.
 Then upgraded ${DESTDIR} doesn't have updated /var/db/obsolete/etc data.

 That's the reason why obsolete /etc/rc.d/dhclient etc. won't
 be removed even after postinstall(8) during upgrade.
 That's the reason why etc set is special.

 Warning messages during first boot after upgrade seems really
 annoying for users:
 > > /etc/rc: WARNING: $dhclient is not set properly - see rc.conf(5).
 > > /etc/rc: WARNING: $isdnd is not set properly - see rc.conf(5).
 and at least my patch suppress them.

 > Also obsolete_dir is only used in one part of the if statement and
 > should not be always set.

 You are pointing out style issue?  How should it be written?

 ---
 Izumi Tsutsui


From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 tsutsui@ceres.dti.ne.jp
Subject: Re: PR/54730 CVS commit: src/usr.sbin/postinstall
Date: Sun, 22 Dec 2019 12:16:46 -0500

 --Apple-Mail=_C7E784E7-716F-489E-BE7F-DE35D890C1A6
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=us-ascii


 > IIUC, etc.tgz is not extracted into ${DESTDIR} on upgrade =
 installation.
 > Then upgraded ${DESTDIR} doesn't have updated /var/db/obsolete/etc =
 data.
 >=20
 > That's the reason why obsolete /etc/rc.d/dhclient etc. won't
 > be removed even after postinstall(8) during upgrade.
 > That's the reason why etc set is special.

 Thanks for the explanation. I get it now. I think that this is the bug =
 there:
 We should be extracting at least the obsolete file (and perhaps =
 locate.database)
 from the etc set instead of doing special things in the postinstall =
 script because
 we are not even guaranteed to have the sources around.

 > You are pointing out style issue?  How should it be written?

 That is minor and I will take care of it. I just don't think it is the =
 right
 way to fix it because it does not work all the time and the decision
 whether to use the source instead of the installed files is done in
 another place. How hard would it be to fix the upgrade process instead =
 to
 extract those two files?

 christos

 --Apple-Mail=_C7E784E7-716F-489E-BE7F-DE35D890C1A6
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org

 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXf+k/gAKCRBxESqxbLM7
 Oj7+AKDk6HEeo9a7IB7+RdFZbuik5B1osACcCXCmzvyjWZY8Ct0rhgfNKC08mb0=
 =FfRl
 -----END PGP SIGNATURE-----

 --Apple-Mail=_C7E784E7-716F-489E-BE7F-DE35D890C1A6--

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: christos@zoulas.com
Cc: gnats-bugs@netbsd.org, tsutsui@ceres.dti.ne.jp
Subject: Re: PR/54730 CVS commit: src/usr.sbin/postinstall
Date: Mon, 23 Dec 2019 02:29:57 +0900

 > How hard would it be to fix the upgrade process instead to
 > extract those two files?

 What about manual upgrade installation?
 (i.e. extracting all sets except etc,
  then updating etc and others by postinstall(8))

 I'm afraid certain old users also want "postinstall -s etc.tgz fix"
 just works as the past releases, without manually extracting
 "those two files" from etc.tgz.

 IMO postintall(8) itself should install (update) /var/db/obsolete
 (and other necessary files) from ${ETCTGZDIR} in TGZMODE case,
 rather than sysinst(8).

 ---
 Izumi Tsutsui

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 tsutsui@ceres.dti.ne.jp
Subject: Re: PR/54730 CVS commit: src/usr.sbin/postinstall
Date: Sun, 22 Dec 2019 12:47:01 -0500

 --Apple-Mail=_68429C8D-B110-4662-8DD0-DE56585C5B8A
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii


 > 
 > What about manual upgrade installation?
 > (i.e. extracting all sets except etc,
 >  then updating etc and others by postinstall(8))

 Perhaps move these two files to the base set then?

 > I'm afraid certain old users also want "postinstall -s etc.tgz fix"
 > just works as the past releases, without manually extracting
 > "those two files" from etc.tgz.
 > 
 > IMO postintall(8) itself should install (update) /var/db/obsolete
 > (and other necessary files) from ${ETCTGZDIR} in TGZMODE case,
 > rather than sysinst(8).

 That would be a better solution I think. I guess the expedient solution
 is to commit your suggestion with a comment to look at this PR for
 coming up with a better way.

 christos


 --Apple-Mail=_68429C8D-B110-4662-8DD0-DE56585C5B8A
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org

 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXf+sFQAKCRBxESqxbLM7
 Oo+EAKCjcYGv3K3M5wrYsOpuNVL1GtTXRwCbBVUFyRlq7AJaF0Re+7yxq47sbtE=
 =DwfQ
 -----END PGP SIGNATURE-----

 --Apple-Mail=_68429C8D-B110-4662-8DD0-DE56585C5B8A--

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54730 CVS commit: src/usr.sbin/postinstall
Date: Sun, 22 Dec 2019 13:41:37 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sun Dec 22 18:41:37 UTC 2019

 Modified Files:
 	src/usr.sbin/postinstall: postinstall.in

 Log Message:
 PR/54730: Izumi Tsutsui: obsolete etc files are not being cleaned up on
 an upgrade build.


 To generate a diff of this commit:
 cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/postinstall/postinstall.in

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Martin Husemann <martin@duskware.de>
To: Christos Zoulas <christos@zoulas.com>
Cc: gnats-bugs@netbsd.org
Subject: Re: PR/54730 CVS commit: src/usr.sbin/postinstall
Date: Mon, 23 Dec 2019 10:06:17 +0100

 On Sun, Dec 22, 2019 at 12:16:46PM -0500, Christos Zoulas wrote:
 > another place. How hard would it be to fix the upgrade process instead to
 > extract those two files?

 Should be simple - I'll have a look.

 Martin

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: PR/54730 CVS commit: src/usr.sbin/postinstall
Date: Mon, 23 Dec 2019 14:19:28 +0300

 On Mon, Dec 23, 2019 at 09:10:02 +0000, Martin Husemann wrote:

 >  On Sun, Dec 22, 2019 at 12:16:46PM -0500, Christos Zoulas wrote:

 >  > another place. How hard would it be to fix the upgrade process
 >  > instead to extract those two files?
 >  
 >  Should be simple - I'll have a look.

 Is that a proposal for postinstall fix obsolete to install the
 obsolete list from its -s etc.tgz or just for it to use that obsolete
 list without installing it?

 -uwe

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 tsutsui@ceres.dti.ne.jp
Subject: Re: PR/54730 CVS commit: src/usr.sbin/postinstall
Date: Mon, 23 Dec 2019 09:20:43 -0500

 --Apple-Mail=_799EBA81-9B10-4B03-9FD6-1C1EB8DBBF55
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii


 > Is that a proposal for postinstall fix obsolete to install the
 > obsolete list from its -s etc.tgz or just for it to use that obsolete
 > list without installing it?

 I am not sure. Perhaps it is better to move all the obsolete files
 to the base set so that they are always synched with base. This
 way we don't need the etc.tgz set or the source for anything.

 christos


 --Apple-Mail=_799EBA81-9B10-4B03-9FD6-1C1EB8DBBF55
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org

 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXgDNOwAKCRBxESqxbLM7
 OhJNAJwL3JJRiS9hc8rZ1rfw2tct8vUc2QCgoJytuHErmGe2VrQOXRY3rmtZcc4=
 =GMY5
 -----END PGP SIGNATURE-----

 --Apple-Mail=_799EBA81-9B10-4B03-9FD6-1C1EB8DBBF55--

State-Changed-From-To: open->needs-pullups
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Sun, 29 Dec 2019 11:27:42 +0000
State-Changed-Why:
For NetBSD 9.0, postinstall.in rev 1.10 and 1.11 would be enough.
I'll file another PR how obsolete list and set files should be handled
on upgrade installation.


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54730 CVS commit: [netbsd-9] src/usr.sbin/postinstall
Date: Thu, 2 Jan 2020 09:09:01 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Jan  2 09:09:01 UTC 2020

 Modified Files:
 	src/usr.sbin/postinstall [netbsd-9]: postinstall.in

 Log Message:
 Pull up following revision(s) (requested by tsutsui in ticket #592):

 	usr.sbin/postinstall/postinstall.in: revision 1.9
 	usr.sbin/postinstall/postinstall.in: revision 1.10
 	usr.sbin/postinstall/postinstall.in: revision 1.11
 	usr.sbin/postinstall/postinstall.in: revision 1.12

 remove debugging.

 PR/54730: Izumi Tsutsui: Use /var/db/obsolete/<set> to remove obsolete rc.d
 files when not in $SOURCEMODE.

 PR/54730: Izumi Tsutsui: obsolete etc files are not being cleaned up on
 an upgrade build.

 Make sure rc, rc.subr, and rc.shutdown are properly updated.

 Currently there is no info which rc* files should be updated
 or not on upgrade (at least rc.conf and rc.local shouldn't),
 so put back an explicit list in the postinstall script.
 "Go for it" by christos@ in PR/54741.

 Should be pulled up to netbsd-9.


 To generate a diff of this commit:
 cvs rdiff -u -r1.5.2.2 -r1.5.2.3 src/usr.sbin/postinstall/postinstall.in

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: needs-pullups->closed
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Sun, 12 Jan 2020 16:06:02 +0000
State-Changed-Why:
Pulled up via [pullup-9 #592].


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.