#2478 PR merged
: Have 'cd WORKING_DIR' in Source() function¶
Labels: cleanup
, fixed / solved / done
jsmeix opened issue at 2020-08-13 13:48:¶
-
Type: Cleanup
-
Impact: Low
-
Reference to related issue (URL):
https://github.com/rear/rear/issues/2461 -
How was this pull request tested?
Both "rear mkbackup" and "!rear recover" worked well for me
with BACKUP=NETFS on SLES12-SP5 -
Brief description of the changes in this pull request:
The current working directory when usr/sbin/rear is launched
is also the working directory of all the other scripts and config
files
that get sourced via the Source() function in lib/framework-functions.sh
jsmeix commented at 2020-08-13 13:57:¶
@rear/contributors
I would appreciate a review.
When there is none and/or if there are no objections
I would like to merge it tomorrow afternoon.
jsmeix commented at 2020-08-13 14:07:¶
Things behave fail-safe if WORKING_DIR="$( pwd )"
fails
which results WORKING_DIR=""
because then
cd "$WORKING_DIR"
becomes cd ""
which succeeds
without changing the current directory
at least on my openSUSE Leap 15.1 system:
# pwd
/root/rear.github.master
# WORKING_DIR="$( pwdqq )"
pwdqq: command not found
# echo "'$WORKING_DIR'"
''
# cd "$WORKING_DIR" || echo fail
# pwd
/root/rear.github.master
I.e. cd ""
succeeds without changing the current directory
in contrast to cd
which changes to the home directory (/root
in this
case).
[Export of Github issue for rear/rear.]