fix regex in ynh_write_var_in_file/ynh_read_var_in_file #1880
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem
https://ci-apps-dev.yunohost.org/ci/logs/17223.log
In this case, the file
settings.yml
looks likewhen we try to get the conf:
ynh_read_var_in_file --file=/etc/yunohost/apps/borg/settings.yml --key=conf
is called. The variablevar_part
is:^\s*((const|var|let)\s+)?\$?(\w+(\[\s*["']?\w+["']?\])*(->|\.|\[))*\s*["']?conf["']?\s*\]?\s*(=>|:|=)\s*
which match both
checksum__var_www_borg__2_logging.conf:
andconf:
while we only needconf :
Solution
var_part
is:^\s*((const|var|let)\s+)?\$?((\[\s*["']?\w+["']?\])*(->|\.|\[))*\s*["']?conf["']?\s*\]?\s*(=>|:|=)\s*
instead ofvar_part
is:^\s*((const|var|let)\s+)?\$?(\w+(\[\s*["']?\w+["']?\])*(->|\.|\[))*\s*["']?conf["']?\s*\]?\s*(=>|:|=)\s*
This seems to fix it, but how can we be sure it will not create regressions?
PR Status
...
How to test
Install borg in testing:
sudo yunohost app install https://github.com/YunoHost-Apps/borg_ynh/tree/testing --debug
Try to get the config of the app:
yunohost app config get borg