Subject: bin/35185: postinstall(8) mishandles pf update
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <uwe@NetBSD.org>
List: netbsd-bugs
Date: 12/05/2006 01:40:00
>Number:         35185
>Category:       bin
>Synopsis:       postinstall(8) mishandles pf update
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 05 01:40:00 +0000 2006
>Originator:     Valeriy E. Ushakov
>Release:        4.99.5
>Organization:
>Environment:
>Description:
On a newly installed system (with /etc/pf.{conf,os} in place and up to date:

# postinstall -s etc.tgz check pf
Note: -s etc.tgz is a file,
      temporarily extracting to /tmp/_postinstall.540.0/etc.tgz
Source directory: /tmp/_postinstall.540.0/etc.tgz
 (extracted from: etc.tgz)
Target directory: /
pf check:
	(Checking for pf.conf from /etc instead of /tmp/_postinstall.540.0/etc.tgz/dist/pf/etc)
	(Checking for pf.os from /etc instead of /tmp/_postinstall.540.0/etc.tgz/dist/pf/etc)
	/tmp/_postinstall.540.0/etc.tgz/dist/pf/etc is not a directory; skipping check
postinstall checks passed:
postinstall checks failed: pf
To fix, run:
    /usr/sbin/postinstall -s etc.tgz -d / fix pf


This is caused by incorrect usage of postinstall functions.

do_pf does:

	find_file_in_dirlist pf.conf "pf.conf" \
	    ${SRC_DIR}/dist/pf/etc ${DEST_DIR}/etc \
	    || return 1

but that should be ${SRC_DIR}/etc not ${DEST_DIR}/etc !

Cf. do_ssh that does

	find_file_in_dirlist moduli "moduli" \
	    ${SRC_DIR}/crypto/dist/ssh ${SRC_DIR}/etc

populate_dir call in do_pf should also be prepared to handle the case
of updating from etc.tgz


>How-To-Repeat:
Run postinstall check on a system with pf config files present
>Fix: