NetBSD-Bugs archive

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

bin/52109: etcupdate(8) DESTDIR glitch



>Number:         52109
>Category:       bin
>Synopsis:       etcupdate(8) DESTDIR glitch
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 24 18:05:00 +0000 2017
>Originator:     Hauke Fath
>Release:        NetBSD 7.99.50
>Organization:
Technische Universitaet Darmstadt
>Environment:
	
	
System: NetBSD Gstoder 7.99.50 NetBSD 7.99.50 (MONOLITHIC) #0: Fri Dec 16 15:07:39 CET 2016 hf@Hochstuhl:/var/obj/netbsd-builds/developer/i386/sys/arch/i386/compile/MONOLITHIC i386
Architecture: i386
Machine: i386
>Description:

	When you use etcupdate(8) with a DESTDIR (etcupdate -a -d
	<DESTDIR>), the md5(1) call in the script duplicates DESTDIR
	in the file path, leading to

What do you want to do? [Leave it for later] i
md5: /mnt/mnt/etc/pam.d/README: No such file or directory
md5: /mnt/mnt/etc/pam.d/display_manager: No such file or directory
md5: /mnt/mnt/etc/pam.d/ftpd: No such file or directory
md5: /mnt/mnt/etc/pam.d/gdm: No such file or directory
md5: /mnt/mnt/etc/pam.d/imap: No such file or directory
md5: /mnt/mnt/etc/pam.d/kde: No such file or directory
md5: /mnt/mnt/etc/pam.d/login: No such file or directory
md5: /mnt/mnt/etc/pam.d/other: No such file or directory
md5: /mnt/mnt/etc/pam.d/passwd: No such file or directory
md5: /mnt/mnt/etc/pam.d/pop3: No such file or directory

	ad nauseam.

	
>How-To-Repeat:

	Run etcupdate -a -d <DESTDIR> with DESTDIR != '/' after a
	NetBSD base update, say, to a USB stick installation.

	
>Fix:

	It looks like in

install_checksum() {
        # $1 = target file (relative to ${DESTDIR})

        ${AUTOMATIC} || return

        NEED_ANYTHING=true
        D="$(dirname "${1}")"
        mkdir -p "${DESTDIR}/var/etcupdate/${D}"
        verbose "Saving MD5 checksum for ${DESTDIR}${1} to" \
            "${DESTDIR}/var/etcupdate/${1}"
        # The sed part of the following pipeline changes things like
        # "MD5 (/path/to/dest/dir/etc/filename) = abc123" to
        # "MD5 (/etc/filename) = abc123".
        md5 "${DESTDIR}${1}" | sed -e "s,(${DESTDIR_BRE},(," \
            > "${DESTDIR}/var/etcupdate/${1}"
}

	the initial comment and the md5 invocation are at odds.

	The following patch appears to fix the issue:

--- /usr/sbin/etcupdate~        2016-08-12 13:43:57.000000000 +0200
+++ /usr/sbin/etcupdate 2017-03-24 17:11:46.000000000 +0100
@@ -243,7 +243,7 @@
        # The sed part of the following pipeline changes things like
        # "MD5 (/path/to/dest/dir/etc/filename) = abc123" to
        # "MD5 (/etc/filename) = abc123".
-       md5 "${DESTDIR}${1}" | sed -e "s,(${DESTDIR_BRE},(," \
+       md5 "${1}" | sed -e "s,(${DESTDIR_BRE},(," \
            > "${DESTDIR}/var/etcupdate/${1}"
 }
 
	The related cvs log entry

revision 1.56
date: 2014-06-12 15:56:32 +0200;  author: apb;  state: Exp;  lines: +106 -48;  commitid: riDedw2FWXEBLeEx;
Add "-d destdir" option to etcupdate.
This has been only lightly tested.

	appears correct.  ;)

	

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index