Bugzilla – Bug 147724
tcsh $< operator fails when fed by pipe tcsh 6.14.00-2
Last modified: 2006-02-07 10:21:23 UTC
consider this script #! /bin/tcsh -f while (1) set i = $< echo "input: $i" if ("${i}x" != "x") then echo hej else echo exit exit 0 endif end and run alluser@mte-perjar:~> echo "fsdfdsf" |./test input: fsdfdsf hej input: j hej input: j hej input: j hej input: j hej input: j hej input: j hej input: j hej input: j hej input: j hej input: j ... and goes on forever !!! this just happens if you use a pipe ! alluser@mte-perjar:~> ./test afdsa input: afdsa hej input: exit alluser@mte-perjar:~> it works fine in 6.08.00, 6.11.00, 6.12.00 (all SUSE) I have not found anything reported yet and I am not sure if this is a tcsh problem or something else. well, if you have some feedback on this I would be glad to here it. Carsten Rieck
Just found the bug and the solution: --- sh.dol.c +++ sh.dol.c 2006-02-06 18:41:05.000000000 +0000 @@ -486,6 +486,8 @@ char cbuf[MB_LEN_MAX]; size_t cbp = 0; + memset(&cbuf[0], 0, sizeof(cbuf)); + #ifdef BSDSIGS sigmask_t omask = sigsetmask(sigblock(0) & ~sigmask(SIGINT)); #else /* !BSDSIGS */
Fixed for next release of SuSE Linux.