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. Fix: Patch attached with submission follows: How-To-Repeat: Check forums thread.
Responsible Changed From-To: freebsd-bugs->cperciva Over to maintainer.
In PR bin/186152, you wrote: > 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. > + # 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 Instead of the echo/grep stuff, please just do case `readlink "${BASEDIR}/${F}"` in /*) FF=${LINK} esac Also, this does not work if a symlink points to another symlink but I guess this does not happen in practice. -- Jilles Tjoelker
On 01/31/14 17:49, Jilles Tjoelker wrote: > In PR bin/186152, you wrote: >> 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. > >> + # 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 > > Instead of the echo/grep stuff, please just do > case `readlink "${BASEDIR}/${F}"` in > /*) FF=${LINK} > esac Much better, I'm so accustomed to using bash that I wasn't quite sure how best to do it in sh and I couldn't find a better way. I appreciate the feedback. > > Also, this does not work if a symlink points to another symlink but I > guess this does not happen in practice. > Nope, it doesn't. I've updated the patch which should handle them properly. https://googledrive.com/host/0B0OQnKtejJEMSktRRjBUY1AwME0/freebsd-update.diff
Responsible Changed From-To: cperciva->cperciva fix synopsis.
batch change: For bugs that match the following - Status Is In progress AND - Untouched since 2018-01-01. AND - Affects Base System OR Documentation DO: Reset to open status. Note: I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Created attachment 193855 [details] freebsd-update.sh.diff
>+ while [ -L ${BASEDIR}/${FF} ]; do This could cause a potential issue if circular links exist. One solution to this would be to have limit traversal depth (to 10 or something). Also you may want to consider renaming `FF` to something like `SOURCE_F` or `FOLLOWED_F`
Drop freebsd-update PRs which were assigned to me. I'm not working on this code any more.
Keyword: patch or patch-ready – in lieu of summary line prefix: [patch] * bulk change for the keyword * summary lines may be edited manually (not in bulk). Keyword descriptions and search interface: <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>