If they didn't notice that 2 HDDs had failed in their RAID, would you be surprised if I told you that they also didn't notice that their backup had fallen over 2 months ago?
It's called WTF for a reason ;)
If they didn't notice that 2 HDDs had failed in their RAID, would you be surprised if I told you that they also didn't notice that their backup had fallen over 2 months ago?
It's called WTF for a reason ;)
Say you have crucial, business data, that absolutely has to be safe.
So you do the right thing, and invest in a RAID6 system with double parity.
Which works great. So great that you don't even notice when the first hard drive fails.
And not even when the second hard drive fails.
Unfortunately you do notice when the third hard disk fails.
I work with scientists. They are usually very smart, unfortunately they are not necessarily very good programmers. But the snippet below made me post this here.
It is FORTRAN (scientists, you see?), and what it does is... well, it is part of the routine to read in a NetCDF file.
if (nvar.eq.5) then
do i=1,nvar
call nf_inq_varname(ncid,i,name)
var(i) = name
if (i.eq.1) call nf_inq_varid(ncid,var(i),lon_varid)
if (i.eq.2) call nf_inq_varid(ncid,var(i),lat_varid)
if (i.eq.3) call nf_inq_varid(ncid,var(i),lvl_varid)
if (i.eq.4) call nf_inq_varid(ncid,var(i),rec_varid)
if (i.eq.5) call nf_inq_varid(ncid,var(i),dat_varid)
enddo
endif
For those unfamiliar with NetCDF files: Data is stored in named variables. Internally, these variables have an integer varid, by which they can be called.
Inside the loop, it first asks the netCDF library to return the name of the variable with the varid i. And then, it asks for the varid of the variable with that name.
The following would have done the same, but less complex:
DO i = 1, 5
call nf_inq_varname(ncid,i,var(i))
ENDDO
lon_varid=1
lat_varid=2
lvl_varid=3
rec_varid=4
dat_varid=5
That would have also made me realise far quicker that the netCDF file needs to have the varids in a specific order, which it shouldn't have to.
My wife once told me about an error she found in the code that she is working on. Apparently that error had been in the production system for the better part of 7 years.
enum Status
{
NoErr = 0x000000,
Flag1 = 0x000001,
Flag2 = 0x000002,
Flag3 = 0x000004,
Flag4 = 0x000008,
Flag5 = 0x000016,
Flag6 = 0x000032
};
If there is a syntax error in the snippet above, it's because I am not good at C, and she told me about that error years ago.
(Using Fortran 90/95)
If you first define a fixed size array,
INTEGER i_array(i_var_1 * i_var_2 * 8)
then assign values to it,
index = 0
Do i = 1, i_var_3
If ( some_boolean_expression ) Then
index = index + 1
i_array(index) = some_integer_expression
EndIf
EndDo
And only then check for array bounds violations
If ( index > i_var_1 * i_var_2 * 8 ) Then
ErrorStatus = 10
Call Ereport("********", ErrorStatus, "over-writing due to index size")
EndIf
Chances are, the program crashes before you even get to that check.