~emersion/mrsh-dev

mrsh_populate_env: unset COLUMNS v1 PROPOSED

Good catch! However this seems to be set by readline. Maybe there is a
way to prevent readline from setting it? If not, we could only unset it
in frontend/readline.c.
readline is a garbage library and I have no interest in relying on it
for almost anything, especially considering the possibility of libedit
being different. But I can totally move the unset to
frontend/readline.c.
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/7891/mbox | git am -3
Learn more about email & git

[PATCH] mrsh_populate_env: unset COLUMNS Export this patch

This fixes the ls problem
---
 shell/entry.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/shell/entry.c b/shell/entry.c
index 9bbcbfe..e4ed994 100644
--- a/shell/entry.c
+++ b/shell/entry.c
@@ -87,6 +87,11 @@ bool mrsh_populate_env(struct mrsh_state *state, char **environ) {
 	}
 
 	mrsh_env_set(state, "OPTIND", "1", MRSH_VAR_ATTRIB_NONE);
+
+	/* POSIX 8.3: If this variable is unset or null, the implementation
+	 * determines the number of columns */
+	mrsh_env_unset(state, "LINES");
+	mrsh_env_unset(state, "COLUMNS");
 	return true;
 }
 
-- 
2.23.0
Good catch! However this seems to be set by readline. Maybe there is a
way to prevent readline from setting it? If not, we could only unset it
in frontend/readline.c.
View this thread in the archives