-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmds:output: fix quoted defs not stripped #5932
base: master
Are you sure you want to change the base?
Conversation
a28ba37
to
dc515f7
Compare
Doesn't the issue also apply to commands that aren't output commands? Like this for instance:
|
By The following works for me:
and records in the debug output:
Similarly, the following works in the config because the quotes are handled later in config_command:
What doesn't work:
because then the quotes are never stripped. We would want to specify the value with a trailing space and no extra quotes, but in this example the value of
I'd say the real bug is:
Stripping quotes around device identifiers in input/output doesn't technically address either of these issues, but it might still be a decent idea to change those commands under the assumption a real device identifier will never contain quotes. |
Thanks! I was hoping exactly for this kind of insight from someone in the know.
Indeed! My bad.
I'll try and investigate if there's a way to validate that assumption somehow if I can. That or strip quotes from the output name too. I won't delve into addressing the real bugs you're mentioning though. |
With the following config: set $abc "wayland wayland " set $def "0:0:wayland-seat0" The following command would fail to be executed: swaymsg -- output '$abc' scale 2 swaymsg -- input '$def' repeat_rate 2 The definition `$abc` is replaced with its content, including the quotes, which fails to match real output names. Same for `$def` We now strip quotes early in the output command. The behaviour was inconsistent between config_command() and execute_command(). * config_command() strips quotes before do_var_replacement() and also after, under some conditions. * execute_command() strips them only before. execute_command() is run after receiving swaymsg command hence the failing example mentioned above. Since we now strip quotes in cmd_output and cmd_input we prevent config_command() from stripping them twice.
Might as well use that function in case it needs handling special cases in the future.
dc515f7
to
289e5e7
Compare
The latest changes don't address the "real bug" you have mentioned. I have updated the commit message for better details. It's an attempt at keeping a consistent behaviour for Thanks for the pointer about Let me know if you'd do it any differently. @emersion : stripping quotes for |
Well, |
In other words: I'd prefer to see a patch that fixes the underlying issue rather than add a workaround for each command argument that might contain spaces. |
Yes, we should address the swaymsg issue and i3 compatibility first. Basically, input/output commands don't exist in i3, so I figure there is a chance that using strict i3-style parsing may make them cumbersome to use, or render previously reasonably quoted commands in users' configs unusable. That is undesirable and we have the freedom to change the command to avoid that, if needed/wanted. But we should fix these issues first. The "wayland wayland " display is a potential example. Requiring the user to keep a trailing space on their set line seems pretty lame, but that's how set works in i3 so that's how set should work in sway. Changing the definition of an input/output identifier to strip quotes is just one possible remedy to consider, if we want. |
Someone found the issue on here: https://www.reddit.com/r/swaywm/comments/kr2b42/use_variable_in_swaymsg/
After investigating:
With the following config:
The following command would fail to be executed:
The definition
$abc
is replaced with it content, including the quotes,which fails to match real output names.
We now strip quotes early in the output command.