Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-server
Commits
5c81cccb
Verified
Commit
5c81cccb
authored
4 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
Fix bend_symlinks script for empty space
parent
fe87cd69
No related branches found
No related tags found
1 merge request
!8
Fix bend_symlinks script for empty space
Pipeline
#6065
passed
4 years ago
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
misc/bend_symlinks/src/main.sh
+3
-1
3 additions, 1 deletion
misc/bend_symlinks/src/main.sh
misc/bend_symlinks/src/utils.sh
+2
-0
2 additions, 0 deletions
misc/bend_symlinks/src/utils.sh
misc/bend_symlinks/test/test_suite.sh
+9
-4
9 additions, 4 deletions
misc/bend_symlinks/test/test_suite.sh
with
14 additions
and
5 deletions
misc/bend_symlinks/src/main.sh
+
3
−
1
View file @
5c81cccb
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
misc/bend_symlinks/src/utils.sh
+
2
−
0
View file @
5c81cccb
...
...
@@ -37,6 +37,8 @@ function escape_simple_path () {
SPATH
=
$(
echo
"
$SPATH
"
|
sed
-r
"s/
\(
/
\\\\
(/g"
)
# {
SPATH
=
$(
echo
"
$SPATH
"
|
sed
-r
"s/
\{
/
\\\\
{/g"
)
# \s
SPATH
=
$(
echo
"
$SPATH
"
|
sed
-r
"s/ /
\\
/g"
)
echo
"
$SPATH
"
}
...
...
This diff is collapsed.
Click to expand it.
misc/bend_symlinks/test/test_suite.sh
+
9
−
4
View file @
5c81cccb
...
...
@@ -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
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment