Skip to content
Snippets Groups Projects
Commit c0b97889 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

Merge branch 'f-bend-symlinks-with-ws' into 'dev'

Fix bend_symlinks script for empty space

Closes #125

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