While trying to cleanup some cross system files, I found this problem while debugging.
The problem is an an unrestricted read into the REXX system buffer. I told the program
LINEIN( xxxxx) and grabbed something. No simple errors. When the interpreter
tries to substring this buffer, REXX dies hard. If my system allowed. REXX would core.
I know that I am readiing something ugly into the input buffer. However, I was
processing large strings like my text, which is separated wth ^P. I meant to replace
The ^P with ^J,^M,. I can send both the data file (modula2 compiler segment) and
the little program I ran and found this fault.
I realize there are other methods of picking up data. The trace program would abort
if I picked up this variable and tried to substring it. So the fix would seem to be a change
in the processing of extreme objects. I could make this change but I am sure that you
would prefer a fix, if you think it worth the effort, ... that fix to be in your source tree.
the version I compiled was pulled from this site, last week (Jan 15) or so.
I am running SLACKWARE 7.0.
Logged In: YES
user_id=262734
I can't rebuild the error with either 2.2, 3.0 or 3.1.
I checked both changestr and a softcoded one, see below.
Does anyone have got a similar error?
/*
* try "rexx thisscript /usr/lib/STAR" with STAR = *
* This will produce some work.
*/
parse version v
say "This is" v
say ""
lines = 0
total = 0
do i = 1 to words( arg( 1 ) )
lines = lines + process( word(arg(1), i) )
end
say ""
say lines "lines changed"
return 0
process: procedure expose total
retval = 0
fn = arg( 1 )
FF = d2c( 15 )
CRLF = d2c( 13 ) || d2c( 10 )
call charout , d2c( 13 ) || copies( " ", 79 ) || ,
d2c( 13 ) || "processing" fn ""
signal on notready name endproc
do forever
l = linein( fn )
occurs = countstr( FF, l )
total = total + occurs
o = changestr2( FF, l, CRLF )
if l \= o then do
retval = retval + 1
if length( l ) + occurs \= length( o ) ,
| occurs = 0 then
say ": oops, changestr don't work properly"
end
else do
if occurs \= 0 then
say ": oops, changestr don't work properly"
end
end
endproc:
return retval
changestr2: procedure
needle = arg( 1 )
haystack = arg( 2 )
newneedle = arg( 3 )
retval = ""
start = 1
npos = pos( needle, haystack )
do while npos > 0
retval = retval || substr( haystack, start, npos - start )
retval = retval || newneedle
start = npos + length( needle )
npos = pos( needle, haystack, start )
end
retval = retval || substr( haystack, start )
return retval