git: 2352b89d2f73 - main - nanobsd: Fix regressions from last cleanup
Date: Wed, 24 Sep 2025 16:44:50 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=2352b89d2f732e3fa33fbd494267f0d4cb917e51
commit 2352b89d2f732e3fa33fbd494267f0d4cb917e51
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-09-24 15:43:42 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-09-24 15:43:42 +0000
nanobsd: Fix regressions from last cleanup
c99bb5747f5e changed ( ) grouping into { }, but in these cases we chdir
and depended on the subshell not changing it for the caller. Restore the
old behavior. It seems to work w/o this change, true, but the old code
was intentionally like this.
Fixes: c99bb5747f5e
Sponsored by: Netflix
---
tools/tools/nanobsd/defaults.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index 4f0cc2fa99bd..588758154c98 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -253,13 +253,13 @@ nano_global_make_env() {
# Create empty files in the target tree, and record the fact. All paths
# are relative to NANO_WORLDDIR.
#
-tgt_touch() {
+tgt_touch() (
cd "${NANO_WORLDDIR}"
for i; do
touch $i
echo "./${i} type=file" >> ${NANO_METALOG}
done
-}
+)
#
# Convert a directory into a symlink. Takes two arguments, the
@@ -267,7 +267,7 @@ tgt_touch() {
# directory is removed and a symlink is created. If we're doing
# a nopriv build, then append this fact to the metalog
#
-tgt_dir2symlink() {
+tgt_dir2symlink() (
local dir=$1
local symlink=$2
@@ -277,7 +277,7 @@ tgt_dir2symlink() {
if [ -n "$NANO_METALOG" ]; then
echo "./${dir} type=link mode=0777 link=${symlink}" >> ${NANO_METALOG}
fi
-}
+)
# run in the world chroot, errors fatal
CR() {
@@ -766,14 +766,14 @@ cust_allow_ssh_root() {
#######################################################################
# Install the stuff under ./Files
-cust_install_files() {
+cust_install_files() (
cd "${NANO_TOOLS}/Files"
find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)/' | cpio ${CPIO_SYMLINK} -Ldumpv ${NANO_WORLDDIR}
if [ -n "${NANO_CUST_FILES_MTREE}" -a -f ${NANO_CUST_FILES_MTREE} ]; then
CR "mtree -eiU -p /" <${NANO_CUST_FILES_MTREE}
fi
-}
+)
#######################################################################
# Install packages from ${NANO_PACKAGE_DIR}