Experimental Physics and Industrial Control System
Output links that write double (or float) values into string fields are
seriously broken (and have probably always been).
The call stack is:
dbPutLink() -> dbDbPutValue() -> dbPut() ->
dbFastPutConvertRoutine[DBF_DOUBLE][DBF_STRING]() = cvt_d_st() ->
cvtDoubleToString()
Similar for float.
The conversion is done using the .PREC field of the target record (if
any, else 6) instead of the .PREC field of the source record and it does
not check the target string size.
Try this:
record(ao, "R1") {
field(VAL, "123.456789")
field(PREC, "3")
field(OUT, "R2.EGU")
field(PINI, "YES")
}
record(ao, "R2") {
field(PREC, "20")
}
It uses the wrong PREC field
$ caget R2.EGU
R2.EGU 1.234567890000
and happily overwrites R2.ROFF (which follows EGU) and following fields
$ caget R2.ROFF
R2.ROFF 8.25242e+08
One problem is that cvtDoubleToString() has no argument for the target
field size.
The other problem is that one cannot pass meaningful precision
information to dbFastPutConvertRoutine[][](). As only the target dbAddr
is passed, one cannot use source.PREC.
Also conversions from integer to string do not check the target field
size. Luckily there is no DBF_STRING field in any standard record too
short for the maximum int 32 value.
Only string to string checks the target field size.
The only place where I can see how to fix this quickly is in dbPut()
where dbFastPutConvertRoutine[][]() must not be used for DBF_DOUBLE or
DBF_FLOAT to DBF_STRING conversions.
Dirk
- Replies:
- Re: Serious bug in conversions to string Dirk Zimoch
- Navigate by Date:
- Prev:
Jenkins build is back to normal : epics-base-3.15-win64 #341 APS Jenkins
- Next:
Re: Serious bug in conversions to string Dirk Zimoch
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
<2018>
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: Crash on IOC exit Mark Rivers
- Next:
Re: Serious bug in conversions to string Dirk Zimoch
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
<2018>
2019
2020
2021
2022
2023
2024