Skip to content
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

on_info_replace getting called with not enough arguments #15

Closed
mtfurlan opened this issue Jun 5, 2019 · 7 comments
Closed

on_info_replace getting called with not enough arguments #15

mtfurlan opened this issue Jun 5, 2019 · 7 comments

Comments

@mtfurlan
Copy link

mtfurlan commented Jun 5, 2019

I updated to WeeChat 2.4 [compiled on Feb 17 2019 08:49:01] from the weechat debian repo, and started getting a lot of the following message in the weechat buffer:

autosort: usage: ${info:autosort_replace,old,new,text}

on_info_replace is getting called with one argument, #.
I only have one other plugin, wee-slack.

So does anyone else see this?
If not, I'll try purging my settings and reinstalling.
If it's a general problem I can try to help debug.

@de-vri-es
Copy link
Owner

de-vri-es commented Jun 5, 2019

Thanks for reporting the issue here. I haven't seen this before.

There is #13, which indicates commas in arguments cause issues. However, that would cause too many arguments rather than too little. Still, do you have any buffers with commas in the name?

How did you figure out which arguments are passed to on_info_replace?

@de-vri-es
Copy link
Owner

If this was indeed the same as #13, I think I fixed it on the current master branch. Could you test it out?

After updating, you will need to reset the rules to the new default, or manually add ${info:autosort_escape,...} around the offending part.

@mtfurlan
Copy link
Author

mtfurlan commented Jun 5, 2019

I do have commas in some of my buffer names.
Example of buffer that breaks it (from /buffer list):

16:44   [86] python.tomeinc.slack.com.massimo,mark,Mehmed,phil (notify: all)

I figured out what argumens were passed poorly, it is a case of too many args not too few because I can't read.
I had just added print statements right below the instances of log('usage: ..., but hadn't looked at rest, and printed out arguments[1] twice, which was empty.

So I have now pulled your commit, and moved autosort.conf to autosort.bak.
When I reloaded the plugin, these are the rules I have:

16:38     0: ${core_first}
16:38     1: ${irc_last}
16:38     2: ${buffer.plugin.name}
16:38     3: ${irc_raw_first}
16:38     4: ${if:${plugin}==irc?${server}}
16:38     5: ${if:${plugin}==irc?${info:autosort_order,${type},server,*,channel,private}}
16:38     6: ${if:${plugin}==irc?${hashless_name}}
16:38     7: ${buffer.full_name}

It still has issues with the buffer above.
I put

log('arg[{}] 0: "{}" 1: "{}" 2: "{} rest: {}"'.format(len(arguments), arguments[0], arguments[1], arguments[2], rest));

below the log('usage ... in on_info_replace and it puts out:

autosort: arg[3] 0: "#" 1: "" 2: "tomeinc.slack.com.massimo rest: mark,Mehmed,phil

@de-vri-es
Copy link
Owner

Ah yeah, my bad, the culprit is in the hashless_name helper, not in the rules themselves. So it's the helpers that need to be reset, not the rules.

@mtfurlan
Copy link
Author

mtfurlan commented Jun 5, 2019

Manually setting that to the new helper fixed it, thank you!
Any idea why deleting autosort.conf didn't reset the helpers?

@mtfurlan mtfurlan closed this as completed Jun 5, 2019
@de-vri-es
Copy link
Owner

Hmm, that's a good question actually. Maybe it only works if you rename the configuration file while weechat isn't running?

Anyway, thanks for testing, and thanks again for reporting :)

@de-vri-es
Copy link
Owner

PR to scripts repo submitted: weechat/scripts#341

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants