NetBSD-Bugs archive

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

bin/48647: postinstall uses both DEST_DIR and DESTDIR variables for destdir



>Number:         48647
>Category:       bin
>Synopsis:       postinstall uses both DEST_DIR and DESTDIR variables for 
>destdir
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 08 15:10:00 +0000 2014
>Originator:     Jim Bernard
>Release:        NetBSD 6.99.31
>Organization:
>Environment:
System: NetBSD 6.99.31 NetBSD #0: Sat Feb 15 18:45:02 MST 2014 i386
Architecture: i386
Machine: i386
>Description:
        postinstall supports updating files rooted at a destination other
        than /, which is handy for preparing an installation for later
        use on the current system or another system, without altering the
        running installation.  This is done by supplying the arguments
        "-d destdir" on the command line.  Internally, the destination
        directory is represented by the shell variable DEST_DIR, which
        is set to the supplied "destdir".  However, in revisions 1.103 and
        1.106 the alternative spelling DESTDIR was introduced in 1 and 2
        places, respectively.  Of course, DESTDIR is never set, so the
        supplied destdir is not used in those three places.  The first,
        from 1.103, is only in a message, so is harmless, though potentially
        confusing to a reader of the message.  The last two alter the
        behavior of the code, potentially resulting in incorrect behavior.

>How-To-Repeat:
        Inspection of the script usr.sbin/postinstall.

>Fix:
--- postinstall.orig    2014-02-15 12:42:54.000000000 -0700
+++ postinstall 2014-03-08 07:49:20.000000000 -0700
@@ -903,11 +903,11 @@
 
        if [ "$conf_d_failed" = 1 ]; then
                msg \
     "Broken fontconfig configuration found; please delete these files"
                msg \
-    "in the ${DESTDIR}/etc/fonts/conf.d/ subdirectory:"
+    "in the ${DEST_DIR}/etc/fonts/conf.d/ subdirectory:"
                msg \
     "   10-autohint.conf 10-no-sub-pixel.conf 10-sub-pixel-bgr.conf"
                msg \
     "   10-sub-pixel-rgb.conf 10-sub-pixel-vbgr.conf"
                msg \
@@ -1560,11 +1560,11 @@
        _notfixed=""
        if [ "${op}" = "fix" ]; then
                _notfixed="${NOT_FIXED}"
        fi
 
-       if [ ! -d "${DESTDIR}${pcpath}" ]; then
+       if [ ! -d "${DEST_DIR}${pcpath}" ]; then
                return 0
        fi
 
        # Delete obsolete files in the directory, and the directory
        # itself.  If the directory contains unexpected extra files
@@ -1576,11 +1576,11 @@
        | obsolete_paths "${op}"
        failed=$(( ${failed} + $? ))
 
        # If the directory was removed above, then try to replace it with
        # a file.
-       if [ -d "${DESTDIR}${pcpath}" ]; then
+       if [ -d "${DEST_DIR}${pcpath}" ]; then
                msg "${filemsg}${_notfixed}"
                failed=$(( ${failed} + 1 ))
        else
                if ! find_file_in_dirlist pc "${pcpath}" \
                        "${pcsrcdir}" "${SRC_DIR}${pcpath%/*}"



Home | Main Index | Thread Index | Old Index