|
|
3df91b |
diff --git a/usr/share/rear/lib/framework-functions.sh b/usr/share/rear/lib/framework-functions.sh
|
|
|
3df91b |
index 4878216b..e919bdbf 100644
|
|
|
3df91b |
--- a/usr/share/rear/lib/framework-functions.sh
|
|
|
3df91b |
+++ b/usr/share/rear/lib/framework-functions.sh
|
|
|
3df91b |
@@ -121,7 +121,7 @@ function cleanup_build_area_and_end_program () {
|
|
|
3df91b |
sleep 2
|
|
|
3df91b |
umount_mountpoint_lazy $BUILD_DIR/outputfs
|
|
|
3df91b |
fi
|
|
|
3df91b |
- remove_temporary_mountpoint '$BUILD_DIR/outputfs' || BugError "Directory $BUILD_DIR/outputfs not empty, can not remove"
|
|
|
3df91b |
+ remove_temporary_mountpoint "$BUILD_DIR/outputfs" || BugError "Directory $BUILD_DIR/outputfs not empty, can not remove"
|
|
|
3df91b |
rmdir $v $BUILD_DIR >&2
|
|
|
3df91b |
fi
|
|
|
3df91b |
Log "End of program reached"
|
|
|
3df91b |
diff --git a/usr/share/rear/lib/global-functions.sh b/usr/share/rear/lib/global-functions.sh
|
|
|
3df91b |
index c1a11615..0f8f362d 100644
|
|
|
3df91b |
--- a/usr/share/rear/lib/global-functions.sh
|
|
|
3df91b |
+++ b/usr/share/rear/lib/global-functions.sh
|
|
|
3df91b |
@@ -317,7 +317,20 @@ function url_path() {
|
|
|
3df91b |
|
|
|
3df91b |
### Returns true if one can upload files to the URL
|
|
|
3df91b |
function scheme_accepts_files() {
|
|
|
3df91b |
- local scheme=$1
|
|
|
3df91b |
+ # Be safe against 'set -eu' which would exit 'rear' with "bash: $1: unbound variable"
|
|
|
3df91b |
+ # when scheme_accepts_files is called without an argument
|
|
|
3df91b |
+ # by bash parameter expansion with using an empty default value if $1 is unset or null.
|
|
|
3df91b |
+ # Bash parameter expansion with assigning a default value ${1:=} does not work
|
|
|
3df91b |
+ # (then it would still exit with "bash: $1: cannot assign in this way")
|
|
|
3df91b |
+ # but using a default value is practicable here because $1 is used only once
|
|
|
3df91b |
+ # cf. https://github.com/rear/rear/pull/2675#discussion_r705018956
|
|
|
3df91b |
+ local scheme=${1:-}
|
|
|
3df91b |
+ # Return false if scheme is empty or blank (e.g. when OUTPUT_URL is unset or empty or blank)
|
|
|
3df91b |
+ # cf. https://github.com/rear/rear/issues/2676
|
|
|
3df91b |
+ # and https://github.com/rear/rear/issues/2667#issuecomment-914447326
|
|
|
3df91b |
+ # also return false if scheme is more than one word (so no quoted "$scheme" here)
|
|
|
3df91b |
+ # cf. https://github.com/rear/rear/pull/2675#discussion_r704401462
|
|
|
3df91b |
+ test $scheme || return 1
|
|
|
3df91b |
case $scheme in
|
|
|
3df91b |
(null|tape|obdr)
|
|
|
3df91b |
# tapes do not support uploading arbitrary files, one has to handle them
|
|
|
3df91b |
@@ -341,7 +354,10 @@ function scheme_accepts_files() {
|
|
|
3df91b |
### Returning true does not imply that the URL is currently mounted at a filesystem and usable,
|
|
|
3df91b |
### only that it can be mounted (use mount_url() first)
|
|
|
3df91b |
function scheme_supports_filesystem() {
|
|
|
3df91b |
- local scheme=$1
|
|
|
3df91b |
+ # Be safe against 'set -eu' exit if scheme_supports_filesystem is called without argument
|
|
|
3df91b |
+ local scheme=${1:-}
|
|
|
3df91b |
+ # Return false if scheme is empty or blank or more than one word, cf. scheme_accepts_files() above
|
|
|
3df91b |
+ test $scheme || return 1
|
|
|
3df91b |
case $scheme in
|
|
|
3df91b |
(null|tape|obdr|rsync|fish|ftp|ftps|hftp|http|https|sftp)
|
|
|
3df91b |
return 1
|
|
|
3df91b |
@@ -560,7 +576,7 @@ function umount_url() {
|
|
|
3df91b |
|
|
|
3df91b |
RemoveExitTask "perform_umount_url '$url' '$mountpoint' lazy"
|
|
|
3df91b |
|
|
|
3df91b |
- remove_temporary_mountpoint '$mountpoint' && RemoveExitTask "remove_temporary_mountpoint '$mountpoint'"
|
|
|
3df91b |
+ remove_temporary_mountpoint "$mountpoint" && RemoveExitTask "remove_temporary_mountpoint '$mountpoint'"
|
|
|
3df91b |
return 0
|
|
|
3df91b |
}
|
|
|
3df91b |
|