Date: Mon, 27 Jan 2014 01:45:40 GMT From: David Shane Holden <dpejesh@yahoo.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/186152: [patch] freebsd-update -b: correctly handle symlinks with absolute paths Message-ID: <201401270145.s0R1jeUU050798@oldred.freebsd.org> Resent-Message-ID: <201401270150.s0R1o07W072609@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 186152 >Category: bin >Synopsis: [patch] freebsd-update -b: correctly handle symlinks with absolute paths >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jan 27 01:50:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: David Shane Holden >Release: 10.0-RELEASE >Organization: >Environment: FreeBSD node 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014 root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 >Description: When upgrading a base directory (freebsd-update -b), symlinks with absolute paths are checked against the host system instead of the base directory which was causing the problem reported at https://forums.freebsd.org/viewtopic.php?f=5&t=44520. >How-To-Repeat: Check forums thread. >Fix: Patch attached with submission follows: --- freebsd-update.orig 2014-01-27 01:03:59.000000000 +0000 +++ freebsd-update 2014-01-27 01:18:01.000000000 +0000 @@ -1437,11 +1437,21 @@ # sorted by device and inode number. while read F; do # If the symlink/file/directory does not exist, record this. - if ! [ -e ${BASEDIR}/${F} ]; then + # Symlinks with absolute paths need to be checked relative + # to their base directories. + FF=${F} + if [ -L ${BASEDIR}/${F} ]; then + LINK=`readlink ${BASEDIR}/${F}` + echo "${LINK}" | grep -qe "^/" + if [ $? -eq 0 ]; then + FF=${LINK} + fi + fi + if ! [ -e ${BASEDIR}/${FF} ]; then echo "${F}|-||||||" continue fi - if ! [ -r ${BASEDIR}/${F} ]; then + if ! [ -r ${BASEDIR}/${FF} ]; then echo "Cannot read file: ${BASEDIR}/${F}" \ >/dev/stderr touch .err >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401270145.s0R1jeUU050798>