smug icon indicating copy to clipboard operation
smug copied to clipboard

Name Conflict Resolution

Open ReiFan49 opened this issue 2 years ago • 3 comments

Describe the bug If there are two or more smug config with name prefixed from one of them, and then the prefix of the name itself is running last (as it uses $(smug config)

To get the situation here:

  • Running a smug config will give you a list, with prefixer to come later from prefixed name. image
  • Executing whole batch using for VAR in $(smug config) will execute everything except the last one, due to prefixing issue. On the picture it's yohane-irc vs yohane which is shadowed by yohane-irc upon doing smug start yohane until the yohane-irc window got stopped.

However:

  • If I decide to smug config | sort, or at least sorting the naming order from smug config output, which happens to give different output from just smug config. Things works normally.
  • Execution order changed from yohane to yohane-irc instead vice versa. No naming conflict like what happened above.

Smug config smug config does not matter

Expected behavior

  • Both yohane-irc and yohane should be executed alongside in any order of execution.

Output of cat ~/.config/smug/smug.log output log does not matter.

Smug version 0.2.7

OS you're using Linux

ReiFan49 avatar Apr 23 '22 03:04 ReiFan49

Hey. Can you provide more details on the expected behavior? I'm not sure I understand the issue. Also, what do you mean by smug config? There is no such command.

ivaaaan avatar Jun 10 '22 07:06 ivaaaan

Hey. Can you provide more details on the expected behavior? I'm not sure I understand the issue. Also, what do you mean by smug config? There is no such command.

He mean smug list might be typo

troke12 avatar Jun 17 '22 05:06 troke12

It seems I have the same problem, so I can try to explain it in a simple way. Let's say that we have two configuration files like these:

$cat aaa.yml 
session: testa

root: ~/

windows:
  - name: test
    commands:
      - true
$cat bbb.yml 
session: test

root: ~/

windows:
  - name: test
    commands:
      - true
$

If I start in this order

$smug start aaa
Starting a new session...
[detached (from session testa)]
$smug start bbb
Starting a new session...
[detached (from session testa)]
$

only aaa will start.

$
$tmux ls
testa: 1 windows (created Tue Jan 30 07:42:31 2024)
$

On the other hand, if I start in this order

$
$smug start bbb
Starting a new session...
[detached (from session test)]
$smug start aaa
Starting a new session...
[detached (from session testa)]
$

both will start.

$
$tmux ls
test: 1 windows (created Tue Jan 30 07:47:15 2024)
testa: 1 windows (created Tue Jan 30 07:47:23 2024)
$

I have done some testing and it seems to be related to the session names. In this case testmatches the beginning, or prefix, of testa.

I hope this clarifies the problem.

zmarta-atall avatar Jan 30 '24 06:01 zmarta-atall