Compare commits

...

2 commits

2 changed files with 26 additions and 2 deletions

View file

@ -319,11 +319,13 @@ data_yeet() {
_sed_sanitize() {
_trim_control "$1"
echo -n "$tr" | xxd -p | tr -d '\n' | sed 's/../\\x&/g'
# first, replace backslashes with even more backslashes (workaround for sed bug)
# then, do the actual sanitization, take whole expr as a hexstring and pass it on.
echo -n "$tr" | sed 's/\\/\\\\/g' | xxd -p | tr -d '\n' | sed 's/../\\x&/g'
}
_sed_sanitize_array() {
echo -n "$1" | xxd -p | tr -d '\n' | sed 's/../\\x&/g'
echo -n "$1" | sed 's/\\/\\\\/g' | xxd -p | tr -d '\n' | sed 's/../\\x&/g'
}
# _trim_control(string) -> $tr

View file

@ -88,6 +88,27 @@ notORM_replace_oldsyntax() {
}
}
notORM_backslashes() {
tst() {
a=('\0meow')
data_add "$store" a
a=('awawa')
data_add "$store" a
# checks whether data didn't get mangled and can be retrieved
data_get "$store" { '\0meow' } || return $?
# tries to delete the entry, then checks if it got matched
data_yeet "$store" { '\0meow' }
data_get "$store" { '\0meow' }
if [[ $? == 0 ]]; then
return 1
fi
return 0
}
}
subtest_list=(
notORM_add_get
notORM_get_multiline
@ -97,4 +118,5 @@ subtest_list=(
notORM_yeet
notORM_yeet_multiple_filters
notORM_replace_oldsyntax
notORM_backslashes
)