Created attachment 239169 [details] Modifications to freebsd-update to make it work with spaces in the file paths If freebsd-update is run with the -b -d or -f options followed by a path with a space, freebsd-update prints its usage and exits instead of updating. This is because it further splits arguments by spaces into more arguments internally, causing it to incorrectly parse them. There are also problems with the internal handling of the $BASEDIR and other path variables. This makes it difficult to update certain installations, for example a jail located at a non-root location with a space in its path. This can be fixed by simply adding quotes to the necessary locations in the script, and changing the use of xargs in one location. I have attached a diff of what I had to do to get it to work for my usage (fetch, upgrade, and install). certctl, which is run by freebsd-update, also has a problem with spaces and would also need to be fixed in a similar manner. The script also doesn't return a nonzero error code upon failure to parse its arguments.
Would you mind attaching a git format patch, so that we can preserve the appropriate metadata (in particular, your author details), or if you already have a GitHub account you can submit as a pull request there. Alternatively, I can commit the change with a "Submitted by" tag with your preferred author info.
- WORKDIR=$1 + WORKDIR="$1" This isn't necessary; spaces in $1 will be retained when assigning WORKDIR. Same for BASEDIR=$1 and perhaps other cases in the file. Quotes are indeed needed on e.g. [ -z "${BASEDIR}" ].