[i3king] errors? #207

Closed
opened 2023-08-02 21:51:35 +00:00 by gmardom · 7 comments
gmardom commented 2023-08-02 21:51:35 +00:00 (Migrated from github.com)

before anything else, try to reproduce the bug with the wiki config

still occurs... (not relevant)

Describe the bug
This issue does not break the behavior of the i3king but script reports:

/usr/bin/i3king: line 359: unset: [-1]: bad array subscript
/usr/bin/i3king: line 360: unset: [-1]: bad array subscript

each time new window spawns included in DEFAULT rule.

To Reproduce
Steps to reproduce the behavior:

  1. Run i3king with i3king --verbose --config /path/to/minimal/config
  2. Spawn terminal with instance/role auto, eg: i3term --autotile using i3term
  3. Observe i3king's output.

Minimal i3king config:

DEFAULT \
  class=(URxvt|XTerm|st-256color) instance=auto, \
  class=Xfce4-terminal role=auto, \
    floating enable

Expected behavior
i3king works as expected, but the errors pop up.

Screenshots

Full output after spawning the terminal:

i3king start
class:(URxvt|XTerm|st-256color):instance:auto:title:.*:window_type:.*:window_role:.*:
class:.*:instance:.*:title:.*:window_type:.*:window_role:.*:
/usr/bin/i3king: line 359: unset: [-1]: bad array subscript
/usr/bin/i3king: line 360: unset: [-1]: bad array subscript
/usr/bin/i3king: line 359: unset: [-1]: bad array subscript
/usr/bin/i3king: line 360: unset: [-1]: bad array subscript

Desktop (please complete the following information):

  • OS: Linux
  • Distro: Arch btw

Post the output of the command i3ass

i3flip   | 0.105   | 2022-05-21 | /usr/bin/i3flip
i3fyra   | 1.4.2   | 2023-07-22 | /usr/bin/i3fyra
i3get    | 0.83    | 2022-07-19 | /usr/bin/i3get
i3gw     | 0.999   | 2022-05-21 | /usr/bin/i3gw
i3king   | 0.4.2   | 2023-07-13 | /usr/bin/i3king
i3Kornhe | 0.7     | 2023-07-22 | /usr/bin/i3Kornhe
i3list   | 0.53    | 2023-07-12 | /usr/bin/i3list
i3var    | 0.050   | 2022-05-21 | /usr/bin/i3var
i3viswiz | 0.56    | 2023-07-22 | /usr/bin/i3viswiz
i3zen    | 0.2     | 2023-07-29 | /usr/bin/i3zen

-------------------------------------------

i3 version 4.22 (2023-01-02) © 2009 Michael Stapelberg and contributors
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
GNU Awk 5.2.2, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.2.0-p12, GNU MP 6.2.1)
xdotool version 3.20211022.1

-------------------------------------------

Additional context
Tried both release and -git versions available on aur.

### before anything else, try to reproduce the bug with the [wiki config](https://github.com/budlabs/i3ass/wiki/i3-config-example) still occurs... (not relevant) **Describe the bug** This issue does not break the behavior of the `i3king` but script reports: ``` /usr/bin/i3king: line 359: unset: [-1]: bad array subscript /usr/bin/i3king: line 360: unset: [-1]: bad array subscript ``` each time new window spawns included in DEFAULT rule. **To Reproduce** Steps to reproduce the behavior: 1. Run `i3king` with `i3king --verbose --config /path/to/minimal/config` 2. Spawn terminal with instance/role `auto`, eg: `i3term --autotile` using [i3term](https://github.com/budlabs/i3term) 3. Observe `i3king`'s output. Minimal `i3king` config: ``` DEFAULT \ class=(URxvt|XTerm|st-256color) instance=auto, \ class=Xfce4-terminal role=auto, \ floating enable ``` **Expected behavior** `i3king` works as expected, but the errors pop up. **Screenshots** Full output after spawning the terminal: ``` i3king start class:(URxvt|XTerm|st-256color):instance:auto:title:.*:window_type:.*:window_role:.*: class:.*:instance:.*:title:.*:window_type:.*:window_role:.*: /usr/bin/i3king: line 359: unset: [-1]: bad array subscript /usr/bin/i3king: line 360: unset: [-1]: bad array subscript /usr/bin/i3king: line 359: unset: [-1]: bad array subscript /usr/bin/i3king: line 360: unset: [-1]: bad array subscript ``` **Desktop (please complete the following information):** - OS: Linux - Distro: Arch btw **Post the output of the command `i3ass`** ``` i3flip | 0.105 | 2022-05-21 | /usr/bin/i3flip i3fyra | 1.4.2 | 2023-07-22 | /usr/bin/i3fyra i3get | 0.83 | 2022-07-19 | /usr/bin/i3get i3gw | 0.999 | 2022-05-21 | /usr/bin/i3gw i3king | 0.4.2 | 2023-07-13 | /usr/bin/i3king i3Kornhe | 0.7 | 2023-07-22 | /usr/bin/i3Kornhe i3list | 0.53 | 2023-07-12 | /usr/bin/i3list i3var | 0.050 | 2022-05-21 | /usr/bin/i3var i3viswiz | 0.56 | 2023-07-22 | /usr/bin/i3viswiz i3zen | 0.2 | 2023-07-29 | /usr/bin/i3zen ------------------------------------------- i3 version 4.22 (2023-01-02) © 2009 Michael Stapelberg and contributors GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) GNU Awk 5.2.2, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.2.0-p12, GNU MP 6.2.1) xdotool version 3.20211022.1 ------------------------------------------- ``` **Additional context** Tried both release and `-git` versions available on aur.
gmardom commented 2023-08-02 22:03:33 +00:00 (Migrated from github.com)

After short investigation it appears, that this happens only if DEFAULT rule is present.

Also when I change DEFAULT to GLOBAL similar issue pops up somewhere else:

/usr/bin/i3king: line 383: execute: bad array subscript

Without those, i3king has no other issues like that.

After short investigation it appears, that this happens only if DEFAULT rule is present. Also when I change DEFAULT to GLOBAL similar issue pops up somewhere else: ``` /usr/bin/i3king: line 383: execute: bad array subscript ``` Without those, `i3king` has no other issues like that.
budRich commented 2023-08-04 01:06:09 +00:00 (Migrated from github.com)

big thanks for reporting this. I will try to fix the issue tomorrow.

big thanks for reporting this. I will try to fix the issue tomorrow.
budRich commented 2023-08-04 12:57:55 +00:00 (Migrated from github.com)

i think the problem is that the configuration has some typos:

DEFAULT \
  class=(URxvt|XTerm|st-256color) instance=auto, \
  class=Xfce4-terminal role=auto, \
    floating enable

The syntax definition is like this:

RULE
  COMMAND

So, RULE on line 1, COMMAND on line 2, with COMMAND indented.
Backslash can be used to escape newlines. The last \ (and ,) in the minimal default makes it invalid:

DEFAULT class=(URxvt|XTerm|st-256color) instance=auto, class=Xfce4-terminal role=auto, floating enable

what we want:

DEFAULT class=(URxvt|XTerm|st-256color) instance=auto, class=Xfce4-terminal role=auto
  floating enable

can be written like this:

DEFAULT \
  class=(URxvt|XTerm|st-256color) instance=auto, \
  class=Xfce4-terminal role=auto
    floating enable

I will try to catch these types of errors in the i3king parser, and print useful error messages. That fits perfect with the other patches to the next release which is about stricter commandline parsing.

i think the problem is that the configuration has some typos: ``` DEFAULT \ class=(URxvt|XTerm|st-256color) instance=auto, \ class=Xfce4-terminal role=auto, \ floating enable ``` The syntax definition is like this: ``` RULE COMMAND ``` So, RULE on line 1, COMMAND on line 2, with COMMAND indented. Backslash can be used to escape newlines. The last `\` (and `,`) in the minimal default makes it invalid: ``` DEFAULT class=(URxvt|XTerm|st-256color) instance=auto, class=Xfce4-terminal role=auto, floating enable ``` what we want: ``` DEFAULT class=(URxvt|XTerm|st-256color) instance=auto, class=Xfce4-terminal role=auto floating enable ``` can be written like this: ``` DEFAULT \ class=(URxvt|XTerm|st-256color) instance=auto, \ class=Xfce4-terminal role=auto floating enable ``` --- I will try to catch these types of errors in the i3king parser, and print useful error messages. That fits perfect with the other patches to the next release which is about stricter commandline parsing.
budRich commented 2023-08-04 14:50:57 +00:00 (Migrated from github.com)

with #208 , the output will look like this:

002 ~/g/i/s/i > i3king --verbose --config ~/git/bud/dotfiles/i3/minimal 
>>> i3king 
i3king start
class:(URxvt|XTerm|st-256color):instance:auto:title:.*:window_type:.*:window_role:.*:
class:Xfce4-terminal:instance:.*:title:.*:window_type:.*:window_role:auto:
[WARNING] 'DEFAULT    class=(URxvt|XTerm|st-256color) instance=auto,    class=Xfce4-terminal role=auto,      floating enable' 
 Expected criteria, got ('      floating enable') A missplaced command? maybe.

and when a window matching a broken rule it will result in this:

WINDOW:  class:Pidgin:instance:Pidgin:title:#c:window_type:normal:window_role:conversation:

DEFAULT: -
	nop SYNTAX ERROR in i3king file

EXECUTE:
	nop SYNTAX ERROR in i3king file
[{"success":true}]

@gmardom again thanks for reporting, even if it was broken config that triggered the issue, i bet it was just the top of iceberg of issues that this caused. I never tested but i would guess, that the list of commands would be wrong for all other rules as well, when this happened, because it caused a mismatch between command_counter and rule_counter.

with #208 , the output will look like this: ``` 002 ~/g/i/s/i > i3king --verbose --config ~/git/bud/dotfiles/i3/minimal >>> i3king i3king start class:(URxvt|XTerm|st-256color):instance:auto:title:.*:window_type:.*:window_role:.*: class:Xfce4-terminal:instance:.*:title:.*:window_type:.*:window_role:auto: [WARNING] 'DEFAULT class=(URxvt|XTerm|st-256color) instance=auto, class=Xfce4-terminal role=auto, floating enable' Expected criteria, got (' floating enable') A missplaced command? maybe. ``` and when a window matching a broken rule it will result in this: ``` WINDOW: class:Pidgin:instance:Pidgin:title:#c:window_type:normal:window_role:conversation: DEFAULT: - nop SYNTAX ERROR in i3king file EXECUTE: nop SYNTAX ERROR in i3king file [{"success":true}] ``` @gmardom again thanks for reporting, even if it was *broken* config that triggered the issue, i bet it was just the top of iceberg of issues that this caused. I never tested but i would guess, that the list of commands would be wrong for all other rules as well, when this happened, because it caused a mismatch between `command_counter` and `rule_counter`.
1ntronaut commented 2023-08-04 16:42:26 +00:00 (Migrated from github.com)

@budRich
Hi bud, I have too encountered this error some time ago. I assumed (incorrectly it seems now) that it was my own doing and kept editing the config for i3king until the error message no longer appeared. Admittedly, I find/found the syntax for i3king's config quite hard to grasp.

I did discover that it was related to GLOBAL and DEFAULT, but couldn't make sense of it ; and eventually ended up with a significantly slimmed down config file, having removed the majority of my i3king rule statements.

Sorry for not reporting this.

in other news: last night, I was writing another lengthy reply to your suggestions and work on i3ass... but accidentally killed my X session before submitting it ;p. Real busy with real life stuff right now.. but will reply to you in due time

@budRich Hi bud, I have too encountered this error some time ago. I assumed (incorrectly it seems now) that it was my own doing and kept editing the config for i3king until the error message no longer appeared. Admittedly, I find/found the syntax for i3king's config quite hard to grasp. I _did_ discover that it was related to GLOBAL and DEFAULT, but couldn't make sense of it ; and eventually ended up with a significantly slimmed down config file, having removed the majority of my i3king rule statements. Sorry for not reporting this. > in other news: last night, I was writing another lengthy reply to your suggestions and work on i3ass... but accidentally killed my X session before submitting it ;p. Real busy with real life stuff right now.. but will reply to you in due time
gmardom commented 2023-08-04 17:27:03 +00:00 (Migrated from github.com)

I'm glad that my inability to copy/paste config from i3term's readme helped in some way ;P

I'm glad that my inability to copy/paste config from i3term's readme helped in some way ;P
budRich commented 2023-08-04 17:41:45 +00:00 (Migrated from github.com)

copy what i mean, not what i paste

copy what i mean, not what i paste
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bud/i3ass#207
No description provided.