9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Michael Forney <mforney@mforney.org>
To: 9front@9front.org
Subject: [9front] rc interrupt regression
Date: Mon, 07 Mar 2022 13:19:06 -0800	[thread overview]
Message-ID: <2Z2GAIQLXW88G.24294JTWIM6TD@mforney.org> (raw)

For a little while, I've noticed unexpected behavior with rc in rio
involving interrupts.

The issue can be reproduced fairly easily by cating a file with
enough lines to fill the window, then pressing del just enough times
so that the rc prompt is written. The next command you run is
dropped, with no indication in $status that it didn't succeed.

When rc is blocked on writing its prompt, the del press causes rio
to first scroll to the end of the window and then start a new proc
to send the interrupt. Scrolling the window unblocks the write of
the prompt, which succeeds. The interrupt then arrives, setting the
interrupt trap in rc.

At this point, rc has written the prompt, has a pending interrupt,
and now is waiting on the next line of input. If we type a command
such as `echo hello`, the command is parsed successfully, and then
pushed onto the runq.  Xrdcmds returns, then dotrap() finally detects
the interrupt and the command is dropped, without setting $status.

This behavior was introduced in commit
189731aad01e09db1807c78af421c615ed3a3242 rc: make it portable (for UNIX)

Specifically, the following hunk:

@@ -995,7 +1032,6 @@ Xrdcmds(void)
 			p->lex = 0;
 		} else
 			--p->pc;	/* re-execute Xrdcmds after codebuf runs */
-		ntrap = 0;	/* avoid double-interrupts during blocked writes */
 		start(codebuf, 2, p->local, p->redir);
 	}
 	lex = 0;

Adding back this line fixes the issue for me. Was this a deliberate
change needed for the unix port? If so, is there some other way to
solve this problem?

             reply	other threads:[~2022-03-07 21:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 21:19 Michael Forney [this message]
2022-03-18 23:33 ` [9front] " Michael Forney
2022-03-21 18:08   ` cinap_lenrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2Z2GAIQLXW88G.24294JTWIM6TD@mforney.org \
    --to=mforney@mforney.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).