From 2b9acd261dbdc8f470be8858536bc19aee005f02 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 25 Apr 2019 22:21:38 -0400 Subject: src/session.sh: Delimit command operands --- diff --git a/src/session.sh b/src/session.sh index 46d1885..bb6347b 100644 --- a/src/session.sh +++ b/src/session.sh @@ -37,12 +37,12 @@ session_begin() rand session_id=${rand_x} session_root="${root}" - session_arch="$(cat "${root}/etc/proteanos_arch")" - session_plat="$(cat "${root}/etc/proteanos_plat")" + session_arch="$(cat -- "${root}/etc/proteanos_arch")" + session_plat="$(cat -- "${root}/etc/proteanos_plat")" session_mountdir="${mountdir}" session_atexit="${atexit}" - [ -d "${session_root}/prokit" ] || mkdir "${session_root}/prokit" + [ -d "${session_root}/prokit" ] || mkdir -- "${session_root}/prokit" if [ -f "${session_root}/prokit/installing" ] && ! ${installing}; then error "$(get_msg 'install_running')" return 1 @@ -63,19 +63,19 @@ session_begin() # If a sessions pool exists but the file systems aren't # mounted, clean up the old sessions and mount the file # systems. - rmdir "${session_root}/prokit/sessions/"* + rmdir -- "${session_root}/prokit/sessions/"* session_mount fi else # If the sessions pool doesn't exist, create it and mount the # file systems. - mkdir "${session_root}/prokit/sessions" + mkdir -- "${session_root}/prokit/sessions" session_mount fi # Register the session. - mkdir "${session_root}/prokit/sessions/${session_id}" - mkdir "${session_root}/prokit/sessions/${session_id}/wd" + mkdir -- "${session_root}/prokit/sessions/${session_id}" + mkdir -- "${session_root}/prokit/sessions/${session_id}/wd" profile_bind_mount "${session_arch}" "${session_plat}" \ "${session_mountdir}" \ "${session_root}/prokit/sessions/${session_id}/wd" @@ -95,8 +95,8 @@ session_end() profile_bind_umount "${session_arch}" "${session_plat}" \ "${session_mountdir}" \ "${session_root}/prokit/sessions/${session_id}/wd" - rmdir "${session_root}/prokit/sessions/${session_id}/wd" - rmdir "${session_root}/prokit/sessions/${session_id}" + rmdir -- "${session_root}/prokit/sessions/${session_id}/wd" + rmdir -- "${session_root}/prokit/sessions/${session_id}" if ! mutex_is_unlockable "${session_root}/prokit/sessions.lock"; then if ! mutex_timedlock "${session_root}/prokit/sessions.lock" 5 @@ -109,7 +109,7 @@ session_end() # Clear the sessions pool. If there are no more sessions, unmount the # file systems. - if rmdir "${session_root}/prokit/sessions" 2>/dev/null; then + if rmdir -- "${session_root}/prokit/sessions" 2>/dev/null; then session_umount fi @@ -157,7 +157,7 @@ session_mount() while read fs dir fstype options; do [ "x${dir}" = 'x' ] && continue - mount -t "${fstype}" -o "${options}" "${fs}" \ + mount -t "${fstype}" -o "${options}" -- "${fs}" \ "${session_root}/${dir}" done <<-EOF $(profile_get_fstab "${session_arch}" "${session_plat}") @@ -177,7 +177,7 @@ session_umount() # Here's a kludge to try to handle that. We better make sure # bind mounts get unmounted; otherwise, `rm -Rf ${root}` can be # painful. - while ! umount "${session_root}/${dir}"; do + while ! umount -- "${session_root}/${dir}"; do sleep 1 done done <<-EOF -- cgit v0.9.1