~emersion/mrsh-dev

Fix SIGABRT when sourcing profile/env v1 PROPOSED

Drew DeVault: 1
 Fix SIGABRT when sourcing profile/env

 1 files changed, 3 insertions(+), 0 deletions(-)
I could reduce the test case to:

   echo a
   echo a

And then sourcing it in an interactive shell.

ie. as long as two commands are run, it aborts.

This happens only when executing more than one command at once in an
interactive shell. This also reproduces the issue when run in an
interactive shell:

   echo a; echo b

The issue is that jobs that have terminated may still be in foreground.
This is fixed by putting them in the background when we're notified
about a process status change:

https://git.sr.ht/~emersion/mrsh/commit/8be67f96f9a14b22700643c81b2ba002324d417c

Thanks for investigating!
Thanks for the fix!
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/mrsh-dev/patches/4450/mbox | git am -3
Learn more about email & git

[PATCH] Fix SIGABRT when sourcing profile/env Export this patch

---
Not sure if this is getting at the problem exactly but it seems close.
 shell/entry.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/shell/entry.c b/shell/entry.c
index d12c54f..3d02c6b 100644
--- a/shell/entry.c
+++ b/shell/entry.c
@@ -94,8 +94,11 @@ static void source_file(struct mrsh_state *state, char *path) {
	if (access(path, F_OK) == -1) {
		return;
	}
	bool interactive = state->interactive;
	state->interactive = false;
	char *env_argv[] = { ".", path };
	mrsh_run_builtin(state, sizeof(env_argv) / sizeof(env_argv[0]), env_argv);
	state->interactive = interactive;
}

void mrsh_source_profile(struct mrsh_state *state) {
-- 
2.21.0
View this thread in the archives