cucumber-sp / yandex-music-linux

Linux client of Yandex Music
Other
222 stars 5 forks source link

Multiple arguments in $ELECTRON_ARGS #71

Closed Turbid closed 2 months ago

Turbid commented 3 months ago

If add another argument to the file ~/.config/yandex-music.conf to the variable $ELECTRON_ARGS, for example:

ELECTRON_ARGS="--no-sandbox --proxy-server=127.0.0.1:8080"

then we get:

$ bash -x /usr/bin/yandex-music 
...
...
+ CONFIG_HOME=/home/user/.config
+ CONFIG_FILE=/home/user/.config/yandex-music.conf
+ echo 'Using config file: /user/.config/yandex-music.conf'
Using config file: /home/user/.config/yandex-music.conf
+ '[' '!' -f /home/user/.config/yandex-music.conf ']'
+ source /home/user/.config/yandex-music.conf
++ ELECTRON_CUSTOM_BIN=
++ ELECTRON_ARGS='--no-sandbox --proxy-server=127.0.0.1:8080'
+ WAYLAND_FLAGS=
+ '[' x11 == wayland ']'
+ ELECTRON_BIN=/usr/lib/yandex-music/electron/electron
+ exec /usr/lib/yandex-music/electron/electron /usr/lib/yandex-music/yandex-music.asar '--no-sandbox --proxy-server=127.0.0.1:8080' ''
[2072952:0410/092020.062654:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /usr/lib/yandex-music/electron/chrome-sandbox is owned by root and has mode 4755.
Ловушка трассировки/останова
[2072954:0100/000000.087864:ERROR:zygote_linux.cc(664)] write: Обрыв канала (32)

If remove the double quotes around the variable $ELECTRON_ARGS in the file /usr/bin/yandex-music, then everything is fine.

Need an explanation of how to safely frame variables.

Turbid commented 2 months ago

Unfortunately, the problem is not resolved.

exec "${ELECTRON_BIN}" "/usr/lib/yandex-music/yandex-music.asar" "${ELECTRON_ARGS} ${WAYLAND_FLAGS}":

+ source /home/user/.config/yandex-music.conf
++ ELECTRON_CUSTOM_BIN=
++ ELECTRON_ARGS='--no-sandbox --proxy-server=127.0.0.1:8080'
+ WAYLAND_FLAGS=
+ '[' x11 == wayland ']'
+ ELECTRON_BIN=/usr/lib/yandex-music/electron/electron
+ exec /usr/lib/yandex-music/electron/electron /usr/lib/yandex-music/yandex-music.asar '--no-sandbox --proxy-server=127.0.0.1:8080 '
[2133567:0410/165210.319199:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /usr/lib/yandex-music/electron/chrome-sandbox is owned by root and has mode 4755.

but

exec "${ELECTRON_BIN}" "/usr/lib/yandex-music/yandex-music.asar" ${ELECTRON_ARGS} ${WAYLAND_FLAGS}:

+ source /home/user/.config/yandex-music.conf
++ ELECTRON_CUSTOM_BIN=
++ ELECTRON_ARGS='--no-sandbox --proxy-server=127.0.0.1:8080'
+ WAYLAND_FLAGS=
+ '[' x11 == wayland ']'
+ ELECTRON_BIN=/usr/lib/yandex-music/electron/electron
+ exec /usr/lib/yandex-music/electron/electron /usr/lib/yandex-music/yandex-music.asar --no-sandbox --proxy-server=127.0.0.1:8080
16:54:42.629 (Application)             › Version: 5.0.18
16:54:42.635 (Application)             › Build: 5.0.18 (release-beta-18/3fe4298a)
16:54:42.639 (SingleInstance)          › Single instance

But I don’t know how safe it is and I don’t know how to do it right.

cucumber-sp commented 2 months ago

Update works for me with multiple flags. What shell do you use?

Turbid commented 2 months ago

GNU bash, version 4.4.23(1)-release (x86_64-alt-linux-gnu)

Turbid commented 2 months ago

I tested version 5.0.20 - now it works as it should. Thank you!