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

With -x, kirc just hangs #144

Open
for-coursera opened this issue Nov 5, 2024 · 3 comments
Open

With -x, kirc just hangs #144

for-coursera opened this issue Nov 5, 2024 · 3 comments

Comments

@for-coursera
Copy link

kirc just hangs with no output whatsoever when trying to use -x argument, like this:

kirc -s irc.libera.chat -n MyNick "privmsg NickServ :identify MyNick MyPass"

or even like this:

kirc -n MyNick -x 'whois MyNick'

v.0.3.2 (cb595c5)

@stefan11111
Copy link
Contributor

@for-coursera
This is why it hangs:

	if (cmds > 0) {
		int flag = 0;
		for (int i = 0; i < CBUF_SIZ && flag > -1; i++) {
			flag = read(STDIN_FILENO, &cbuf[i], 1);
		}
	}

It doesn't really hang, it waits for user input.
This was added in 5f8bab4

I'm not sure how this is meant to be used, maybe @mcpcpc can help here.

At any rate, removing that code fixed the 'hang', and the trivial kirc -n MyNick -x 'whois MyNick' works:

diff --git a/kirc.c b/kirc.c
index decbc8d..b32ad78 100644
--- a/kirc.c
+++ b/kirc.c
@@ -1877,12 +1877,14 @@ int main(int argc, char **argv)
     if (dcc) {
         sigaction(SIGPIPE, &(struct sigaction){.sa_handler = SIG_IGN}, NULL);
     }
+#if 0
     if (cmds) {
         int flag = 0;
         for (int i = 0; i < CBUF_SIZ && flag > -1; i++) {
             flag = read(STDIN_FILENO, &cbuf[i], 1);
         }
     }
+#endif
     if (!nick) {
         fputs("Nick not specified\n", stderr);
         usage();

@for-coursera
Copy link
Author

for-coursera commented Nov 5, 2024

@stefan11111

Thanks!

Indeed, that removes the block, and with libera.chat this simple example -x 'whois MyNick' does work. The funny thing is, it doesn't work with some other server for some reason... Probably, they have something configured the other way :(

@mcpcpc
Copy link
Owner

mcpcpc commented Nov 6, 2024

@for-coursera, thanks for reporting this.

@stefan11111, I am guessing the suspect lines are residual from early troubleshooting/testing. None the less, it should be safe to remove. I'll create a PR in the next week or so to address.

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

3 participants