NetBSD Problem Report #50615

From jbernard@knox.mines.edu  Sun Jan  3 03:25:22 2016
Return-Path: <jbernard@knox.mines.edu>
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 "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id DA8527ABF3
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  3 Jan 2016 03:25:22 +0000 (UTC)
Message-Id: <201601030212.u032Co0r027378@knox.mines.edu>
Date: Sat, 2 Jan 2016 19:12:50 -0700 (MST)
From: jbernard@mines.edu
Reply-To: jbernard@mines.edu
To: gnats-bugs@NetBSD.org
Subject: etcupdate installs checksums in the wrong directory
X-Send-Pr-Version: 3.95

>Number:         50615
>Category:       install
>Synopsis:       etcupdate installs checksums in the wrong directory
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    install-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 03 03:30:00 +0000 2016
>Closed-Date:    Sun Jan 03 08:46:29 +0000 2016
>Last-Modified:  Sun Jan 03 08:46:29 +0000 2016
>Originator:     Jim Bernard
>Release:        NetBSD 7.99.25
>Organization:
>Environment:
NetBSD 7.99.25 201512260025Z: amd64
Architecture: x86_64
Machine: amd64
>Description:
	"etcupdate -a" stores checksums in subdirectories of /var/etcupdate,
	specifically dev, etc, root, and var.  When it is used together with
	the "-d destdir" option, the checksums of unchanged files are written
	in subdirectories with those same names under /var/etcupdate/<destdir>,
	rather than /var/etcupdate.
>How-To-Repeat:
	etcupdate -a -l -d otherroot -s etcsrcdir

	or read the code in the first conditional block of the
	diff_and_merge_file() function.  It's obviously inconsistent with
	the intended meaning of the install_checksum() function (as documented
	with its definition) and with all other invocations of that function.

	Issuing the command leads to numerous error messages about missing
	directories, and many of the checksums then show up under
	/var/etcupdate/otherroot.
>Fix:
	This patch fixes the problem.  I checked the rest of the script
	and didn't find any other mistakes like this.

--- etcupdate-dist	2015-12-25 19:54:15.000000000 -0700
+++ etcupdate	2016-01-02 16:50:04.000000000 -0700
@@ -278,11 +278,11 @@
 	# $1 = target file (relative to ${DESTDIR})

 	if cmp -s "${TEMPROOT}${1}" "${DESTDIR}${1}"; then
 		verbose "===> ${1} (ok)"
 		rm -f "${TEMPROOT}${1}"
-		install_checksum "${DESTDIR}${1}"
+		install_checksum "${1}"
 		return
 	fi

 	if ${AUTOMATIC} && [ -f "${DESTDIR}/var/etcupdate/${1}" ]; then
 		SUM1="$(md5 "${1}")"

>Release-Note:

>Audit-Trail:
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50615 CVS commit: src/usr.sbin/etcupdate
Date: Sun, 3 Jan 2016 08:44:59 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Jan  3 08:44:59 UTC 2016

 Modified Files:
 	src/usr.sbin/etcupdate: etcupdate

 Log Message:
 From Jim Bernard in PR install/50615: install_checksum expects a path
 relative to ${DESTDIR}, and most callers did pass it that way - fix the
 one place where it eroneously was called with a ${DESTDIR} path.


 To generate a diff of this commit:
 cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/etcupdate/etcupdate

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

State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Sun, 03 Jan 2016 08:46:29 +0000
State-Changed-Why:
Applied, thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.