EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: camonitor bug for string as array of chars
From: Andrew Johnson <[email protected]>
To: Mark Rivers <[email protected]>
Cc: EPICS Tech Talk <[email protected]>
Date: Mon, 10 Sep 2012 18:08:50 -0500
Hi Mark,

On 2012-09-10 Mark Rivers wrote:
> > Maybe camonitor should be \0-terminating the array that it gets from CA
> > too,
> 
> Yes, I think it should.  It knows it's printing a string, and it knows how
>  long the array actually is, since camonitor without -S prints the correct
>  values.

If you don't include the \0 then CA clients which were expecting it will break 
in the way you've found camonitor -S does.  I don't believe any CA client that 
handles C strings will have any problem with a terminating \0 byte.  Bear in 
mind that before R3.14.12 CA didn't support variable length arrays at all, and 
every waveform array was transported at its full NELM length, with zero values 
inserted following the NORD elements of data, so older clients *had* to cope 
with trailing zero bytes anyway.

>  Is it documented anywhere that a
>  waveform record containing a string should include the \0, and include it
>  in the element count?

It was not officially documented anywhere that I know of that a waveform 
record could be used to transport strings, until we added the long string 
support to Base.

- Andrew
-- 
Never interrupt your enemy when he is making a mistake.
-- Napoleon Bonaparte

References:
caput off-by-one bug for string as array of chars J. Lewis Muir
Re: camonitor bug for string as array of chars Andrew Johnson
RE: camonitor bug for string as array of chars Mark Rivers

Navigate by Date:
Prev: RE: How to profile an EPICS application on Linux Mark Rivers
Next: Re: How to profile an EPICS application on Linux Guy Jennings
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: camonitor bug for string as array of chars Mark Rivers
Next: Re: camonitor bug for string as array of chars Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·