Skip to contentSkip to conversation

dash 0.5.13.1: strange pipe behaviour

PATCH New [email protected] 2 participants 2 messages Oct 30, 2025 – Oct 31, 2025

lore
Share & tools
lore
#0 lore raw

With dash 0.5.13.1 together with your latest patch I got this:

$:~> echo date | /bin/sh
$:\w> Do 30. Okt 12:21:36 CET 2025
$:\w>
/bin/sh: 1: Cannot set tty process group (No such process) $:~>

with dash 0.5.12 and bash this works:

$:~> echo date | /bin/bash
Do 30. Okt 12:22:52 CET 2025
$:~>

Greetings
Juergen

#1 lore raw

PATCH 1/1 options: Call input_init before using stdin_istty

Quoted 8 lines · [email protected] wrote:

With dash 0.5.13.1 together with your latest patch I got this:

$:~> echo date | /bin/sh
$:\w> Do 30. Okt 12:21:36 CET 2025
$:\w>
/bin/sh: 1: Cannot set tty process group (No such process) $:~>

Quoted 5 lines

with dash 0.5.12 and bash this works:

$:~> echo date | /bin/bash
Do 30. Okt 12:22:52 CET 2025
$:~>

Oh yes, the input_init optimisation went a bit over the top:

---8<---
Call input_init before using stdin_istty as otherwise it will always be true.

Fixes 6abb589582c6 ("input: Call input_init on first use")
src/input.c +0 -2
index c36d120..c7236d0 100644
@@ -79,8 +79,6 @@ struct parsefile *parsefile = &basepf;	/* current input file */
 int whichprompt;		/* 1 == PS1, 2 == PS2 */
 int stdin_istty = -1;
 
-MKINIT void input_init(void);
-
 STATIC void pushfile(void);
 static void popstring(void);
 static int preadfd(void);
src/input.h +1 -0
index 706ac73..59dc5a1 100644
@@ -119,6 +119,7 @@ void unwindfiles(struct parsefile *);
 void popallfiles(void);
 void flush_input(void);
 void reset_input(void);
+void input_init(void);
 
 static inline int input_get_lleft(struct parsefile *pf)
 {
src/options.c +5 -2
index c318e0f..c4eedeb 100644
@@ -138,8 +138,11 @@ procargs(char **xargv)
 			sh_error("-c requires an argument");
 		sflag = 1;
 	}
-	if (iflag == 2 && sflag == 1 && stdin_istty && isatty(2))
-		iflag = 1;
+	if (iflag == 2 && sflag == 1) {
+		input_init();
+		if (stdin_istty && isatty(2))
+			iflag = 1;
+	}
 	if (mflag == 2)
 		mflag = iflag;
 	for (i = 0; i < NOPTS; i++)
Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt