YunoHost-Apps / synapse_ynh

Matrix server (synapse) package for YunoHost
https://matrix.org/
GNU General Public License v3.0
79 stars 42 forks source link

\n prepended to coturn configuration during upgrade #341

Closed MayeulC closed 1 year ago

MayeulC commented 1 year ago

Describe the bug

I think this is not the first time this happens. It's probably an issue in some yunohost helper.

In coturn.conf:

-external-ip=XX.XX.XX.XX
+\nexternal-ip=XX.XX.XX.XX

I also had the same issue in homeserver.yaml, in client whitelist, although it was present before the upgrade as well:

client_whitelist:
-        - https://sub.domain.tld\n        - https://sub2.example.com\n        - https://sub3.example.com\n

Note that the client whitelist doesn't even have line breaks.

Context

Steps to reproduce

Expected behavior

No \n gets prepended.

Logs

2022-10-19 11:09:19,832: INFO - [#############.......] > Updating coturn config...
2022-10-19 11:09:19,833: DEBUG - ++ curl -s ip.yunohost.org^M
2022-10-19 11:09:19,880: DEBUG - + public_ip4=XX.XX.XX.XX^M
2022-10-19 11:09:19,881: DEBUG - ++ curl -s ipv6.yunohost.org^M
2022-10-19 11:09:19,911: DEBUG - + public_ip6=^M
2022-10-19 11:09:19,912: DEBUG - + true^M
2022-10-19 11:09:19,912: DEBUG - + turn_external_ip=^M
2022-10-19 11:09:19,912: DEBUG - + '[' -n XX.XX.XX.XX ']'^M
2022-10-19 11:09:19,913: DEBUG - + ynh_validate_ip4 --ip_address=XX.XX.XX.XX^M
2022-10-19 11:09:19,913: DEBUG - + local legacy_args=i^M
2022-10-19 11:09:19,913: DEBUG - + args_array=(['i']='ip_address=')^M
2022-10-19 11:09:19,913: DEBUG - + local -A args_array^M
2022-10-19 11:09:19,913: DEBUG - + local ip_address^M
2022-10-19 11:09:19,913: DEBUG - + ynh_handle_getopts_args --ip_address=XX.XX.XX.XX^M
2022-10-19 11:09:19,913: DEBUG - + set +o xtrace^M
2022-10-19 11:09:19,925: DEBUG - + ynh_validate_ip --family=4 --ip_address=XX.XX.XX.XX^M
2022-10-19 11:09:19,926: DEBUG - + local legacy_args=fi^M
2022-10-19 11:09:19,926: DEBUG - + args_array=(['f']='family=' ['i']='ip_address=')^M
2022-10-19 11:09:19,926: DEBUG - + local -A args_array^M
2022-10-19 11:09:19,926: DEBUG - + local family^M
2022-10-19 11:09:19,927: DEBUG - + local ip_address^M
2022-10-19 11:09:19,927: DEBUG - + ynh_handle_getopts_args --family=4 --ip_address=XX.XX.XX.XX^M
2022-10-19 11:09:19,927: DEBUG - + set +o xtrace^M
2022-10-19 11:09:19,967: DEBUG - + '[' 4 == 4 ']'^M
2022-10-19 11:09:19,967: DEBUG - + python3 /dev/stdin^M
2022-10-19 11:09:20,028: DEBUG - + turn_external_ip+='\nexternal-ip=XX.XX.XX.XX'^M
2022-10-19 11:09:20,028: DEBUG - + '[' -n '' ']'^M
2022-10-19 11:09:20,028: DEBUG - + ynh_add_config --template=turnserver.conf --destination=/etc/matrix-synapse/coturn.conf^M

Note how the \n suddenly appears line end-3.

Full log: https://paste.yunohost.org/raw/abeyayojoq

Josue-T commented 1 year ago

332 should fix the issue about the homeserver.yaml, still need to fix the coturn config. I think it was probably a regression or a breaking change in the helper as I think it worked when it was created.

Thatoo commented 4 months ago

I got almoist the same issue updating to v1.98.0~ynh1. The difference is that I got%\n at the end of line, not at the beginning. external-ip=xxx.xxx.xxx.xxx%\n

It is weird it happens randomly, isn't it? By the way, for thoose facing the same issue, the file to modify is /etc/matrix-synapse/coturn.conf