Skip to content
Snippets Groups Projects
Commit d344db0c authored by Timm Fitschen's avatar Timm Fitschen Committed by Henrik tom Wörden
Browse files

Fix bend_symlinks script for empty space

parent fe87cd69
No related branches found
No related tags found
2 merge requests!21Release v0.4.0,!8Fix bend_symlinks script for empty space
......@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
* #125 - `bend_symlinks` script did not allow whitespace in filename.
* #122 - Dead-lock due to error in the DatabaseAccessManager.
* #120 - Editing entities that were created with a no longer existing user
leads to a server error.
......
......@@ -66,8 +66,10 @@ if [ $IS_MOVE -eq 1 ] ; then
REPLACEMENT=$(new_dir "$REPLACEMENT")
fi
set -o noglob
for syml in $(find -P $(realpath $FILE_SYSTEM_ROOT) -type l) ; do
find -P $(realpath $FILE_SYSTEM_ROOT) -type l -print0 |
while ISF= read -r -d '' syml; do
OLD_TARGET=$(realpath -m "$syml" | sed -n -r "/$REGEX_OLD/p")
if [ -z "$OLD_TARGET" ] ; then
# filter non matching
......
......@@ -37,6 +37,8 @@ function escape_simple_path () {
SPATH=$(echo "$SPATH" | sed -r "s/\(/\\\\(/g")
# {
SPATH=$(echo "$SPATH" | sed -r "s/\{/\\\\{/g")
# white space
SPATH=$(echo "$SPATH" | sed -r "s/ /\\ /g")
echo "$SPATH"
}
......
......@@ -23,8 +23,11 @@ tearDown () {
_make_test_file () {
touch "$DATA_DIR/$1"
ln -s $(realpath "$DATA_DIR/$1") "$FILE_SYSTEM_ROOT/$1"
assertEquals "initial target $1" $(realpath "$FILE_SYSTEM_ROOT/$1") $(realpath "$DATA_DIR/$1")
TARGET=$(realpath "$DATA_DIR/$1")
LINK=$FILE_SYSTEM_ROOT/$1
ln -s "$TARGET" "$LINK"
LINKED=$(realpath "$LINK")
assertEquals "initial target $1" "$LINKED" "$TARGET"
}
_break_link_move_file () {
......@@ -35,7 +38,8 @@ _break_link_move_file () {
NEW_PATH_REAL=$(realpath "$NEW_PATH")
LINK="$FILE_SYSTEM_ROOT/$1"
mv "$OLD_PATH_REAL" "$NEW_PATH_REAL"
assertEquals "still target $OLD_PATH_REAL" $(realpath "$LINK") "$OLD_PATH_REAL"
LINKED=$(realpath "$LINK")
assertEquals "still target $OLD_PATH_REAL" "$LINKED" "$OLD_PATH_REAL"
assertFalse "$LINK link is broken" "[ -f '$LINK' ]"
assertFalse "$OLD_PATH_REAL was moved" "[ -f '$OLD_PATH_REAL' ]"
assertTrue "$NEW_PATH_REAL is there" "[ -f '$NEW_PATH_REAL' ]"
......@@ -51,7 +55,7 @@ assertLinkOk () {
LINK=$(realpath "$FILE_SYSTEM_ROOT/$1")
TARGET=$(realpath "$DATA_DIR/$2")
assertTrue "target exists $LINK" "[ -f '$LINK' ]"
assertEquals "target matches $TARGET" $TARGET "$LINK"
assertEquals "target matches $TARGET" "$TARGET" "$LINK"
set +o noglob
}
......@@ -135,6 +139,7 @@ testFullPathWithStrangeChars () {
_testFullPathWithStrageChars "{"
_testFullPathWithStrageChars "]"
_testFullPathWithStrageChars "[.]"
_testFullPathWithStrageChars " "
}
testRegex () {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment