Bug 147724 - tcsh $< operator fails when fed by pipe tcsh 6.14.00-2
Summary: tcsh $< operator fails when fed by pipe tcsh 6.14.00-2
Status: RESOLVED FIXED
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: unspecified
Hardware: i686 SuSE Linux 10.0
: P5 - None : Normal
Target Milestone: ---
Assignee: Dr. Werner Fink
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-02 17:33 UTC by Carsten Rieck
Modified: 2006-02-07 10:21 UTC (History)
1 user (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Rieck 2006-02-02 17:33:12 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
Comment 1 Dr. Werner Fink 2006-02-06 18:47:54 UTC
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 */
Comment 2 Dr. Werner Fink 2006-02-07 10:21:23 UTC
Fixed for next release of SuSE Linux.