~sircmpwn/aerc

* Compose: Don't rely on existence of /bin/sh v1 PROPOSED

Zach DeCook: 1
 * Compose: Don't rely on existence of /bin/sh

 1 files changed, 7 insertions(+), 1 deletions(-)
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/~sircmpwn/aerc/patches/13108/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] * Compose: Don't rely on existence of /bin/sh Export this patch

From e19db616644ba52e38b0bf35ecacc9ada35a63a3 Mon Sep 17 00:00:00 2001
Date: Fri, 4 Sep 2020 08:03:49 -0400

---
Termux (Android terminal emulator) is one example
of a non-FHS Compliant system which has no /bin/sh.

 widgets/compose.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/widgets/compose.go b/widgets/compose.go
index 03c9175..68e54a9 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -603,7 +603,13 @@ func (c *Composer) ShowTerminal() {
	if editorName == "" {
		editorName = "vi"
	}
	editor := exec.Command("/bin/sh", "-c", editorName+" "+c.email.Name())
	var editor *exec.Cmd
	if _, err := os.Stat("/bin/sh"); err == nil {
		editor = exec.Command("/bin/sh", "-c", editorName+" "+c.email.Name())
	} else {
		split := strings.Split(editorName, " ")
		editor = exec.Command(split[0], append(split[1:], c.email.Name())...)
	}
	c.editor, _ = NewTerminal(editor) // TODO: handle error
	c.editor.OnEvent = c.termEvent
	c.editor.OnClose = c.termClosed
-- 
2.28.0
Why not? Any sane Unix system needs to have a shell available at this
path.
Hi,
please try to keep the thread intact when you reply to a comment.

I don't think that we should work around non FHS respecting "distros".

There's a reason that things are put in the same place everywhere.
We'd end up with a whole bunch of special snowflake cases which would make it harder to reason about things if we started doing that.

Greetings 
Reto