[openbox] Stop! Don't nest the ForEach loops!

Parke parke.nexus at gmail.com
Tue Feb 16 21:12:06 EST 2021


I have discovered that the Stop action is rather quirky.

The wiki currently says:

"[The Stop] action can be used to stop execution of the ForEach
action, for example to search all clients for a given set of
conditions, but then only run the actions on the first one. It takes
no arguments. It will both stop the current list of actions from being
run and break out of one level of ForEach."

http://openbox.org/wiki/Help:Actions#Stop

Based on my experimentation, either the wiki is incorrect or the
implementation is buggy (or both).  Based on observed behavior with
Openbox 3.6.1, I would document the Stop action as follows.

----

The Stop action will do all of the following:

1.  Execution of the current list (clause) of actions will cease.  If
there is a parent list (clause) of actions (due to an If or ForEach
action), then execution will resume with the next action in the parent
list (clause).

2.  If the Stop action occurs inside a ForEach action, then that
ForEach action will stop iterating.  (Note:  If a ForEach contains an
If, and the If contains a Stop, then the Stop will break out of the
If, but it will not break out of the ForEach.  The current iteration
of ForEach will complete, and only then will the ForEach loop stop
iterating and exit.)

3.  If an outer ForEach loop contains an inner ForEach loop, and if
the inner ForEach loop contains a Stop, then execution will indeed
stop as Openbox will permanently freeze.  Additionally, it may then be
impossible to change which client has focus and/or Xorg may also stop
processing input events altogether.

----

I don't know what the purpose of nesting ForEach loops would be (other
than examining Stop's behavior inside nested ForEach loops), but the
current wiki documentation sort of implies such nesting is possible.

I can replace the current wiki text with the above, if appropriate.
But given that Openbox also freezes, I figured I would mention this on
the mailing list.

I have tested the freezing at least twice.  Attached is a test case.
I would test it more, but killing and restarting Xorg and all my
client programs is a hassle.

Cheers,

Parke
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openbox_stop_n_freeze.xml
Type: text/xml
Size: 3770 bytes
Desc: not available
URL: <http://icculus.org/pipermail/openbox/attachments/20210216/8dfeeb7c/attachment.xml>


More information about the openbox mailing list