Back Midas Rome Roody Rootana
  Midas DAQ System, Page 56 of 142  Not logged in ELOG logo
ID Date Author Topic Subjectdown
  1552   17 Jun 2019 Konstantin OlchanskiReleasebin and lib symlinks, mxml-2019-03-a, midas-2019-03-h
> 
> If i'm not mistaken the proper commands are
> 
> cd $MIDASSYS
> mkdir linux
> ln -s ../bin linux/bin
> ln -s ../lib linux/lib
> 

This is for making the new midas look like the old midas. My instructions were for making the old midas looking like the new midas.

Old midas:
packages/midas/linux/bin, linux/lib with symlinks for
packages/midas/bin -> linux/bin, etc

New midas:
packages/midas/bin, lib with symlinks for
packages/midas/linux/bin -> ../bin, etc.

K.O.
  261   30 May 2006 Konstantin OlchanskiBug Reportbadness with vxworks/ppc
It appears that the latest version of MIDAS malfunctions on PowerPC/VxWorks
machines, below are two problem reports. As reported, previous versions of MIDAS
work fine, I guess that reduces the probability of it being buggy user code. At
least one of the problems feels like a missing endian conversion somewhere, but
I am not aware of any recent changes in the MIDAS RPC code... We will be trying
to debug both problems, but any insight would be greatly appreciated.

K.O.


From suz@triumf.ca  Tue May 30 16:58:16 2006
Date: Tue, 30 May 2006 16:58:16 -0700 (PDT)
From: Suzannah Daviel <suz@triumf.ca>
To: konstantin olchanski <olchansk@triumf.ca>
Subject: rpc problems

Hi Konstantin,

Herewith a description of the problems,

Suzannah

Problem on system A:
--------------------

After upgrading the Linux operating system from RH9 to SL4, and installing
latest Midas software, the first time a manual trigger is issued, the VxWorks
frontend (running
on a PPC) crashes:


Output on PPC consol:

trigger histo event from status page

rpc_client_accept: starting with sock:11

program
Exception current instruction address: 0x01ac7388
Machine Status Register: 0x0008b030
Condition Register: 0x24000082
Task: 0x1b47908 "mfe"



The histo event is usually large so is fragmented. It is sent out by a
manual trigger and at end of run. When the run is ended (before an event
request using a manual trigger so program has not yet crashed) the histo
event is sent successfully.

After returning to the previous version of Midas but still running SL4,
this problem disappeared.




Problem on system B:
--------------------

Again, SL9 was installed, and the Midas software updated to the latest.
When sending a periodic (non-fragmented) event, after a while, one of the
parameters appears to become corrupted, and a lot of rpc_call error
messages appear. These continue while data is still successfully sent out
until the run is ended.



Tue May  9 05:20:29 2006 [Mdarc] *** data saved in file
/is01_data/bnmr/dlog/2006/040377.msr_v5 at Tue May  9 05:20:29
2006 (SN=5) ***
Tue May  9 05:21:30 2006 [Mdarc] *** data saved in file
/is01_data/bnmr/dlog/2006/040377.msr_v6 at Tue May  9 05:21:30
2006 (SN=6) ***
Tue May  9 05:22:31 2006 [Mdarc] *** data saved in file
/is01_data/bnmr/dlog/2006/040377.msr_v7 at Tue May  9 05:22:31
2006 (SN=7) ***

Tue May  9 05:23:12 2006 [feBNMR] [midas.c:9325:rpc_call] parameters
(1099059848) too large for network buffer
(524344); param_size=1099059808
Tue May  9 05:23:12 2006 [feBNMR] [midas.c:9325:rpc_call] parameters
(1099059848) too large for network buffer
(524344); param_size=1099059808
........................................
Tue May  9 05:23:31 2006 [feBNMR] [midas.c:9325:rpc_call] parameters
(1099059848) too large for network buffer
(524344); param_size=1099059808
Tue May  9 05:23:32 2006 [feBNMR] [midas.c:9325:rpc_call] parameters
(1099059848) too large for network buffer
(524344); param_size=1099059808

Tue May  9 05:23:32 2006 [Mdarc] *** data saved in file
/is01_data/bnmr/dlog/2006/040377.msr_v8 at Tue May  9 05:23:32
2006 (SN=8) ***

Tue May  9 05:23:32 2006 [feBNMR] [midas.c:9325:rpc_call] parameters
(1099059848) too large for network buffer
(524344); param_size=1099059808
Tue May  9 05:23:33 2006 [feBNMR] [midas.c:9325:rpc_call] parameters
(1099059848) too large for network buffer
(524344); param_size=1099059808
etc.

Another example showing that the corrupted parameter varies in size:

Thu Apr 13 19:00:00 2006 [mhttpd] Run #30005 started
Thu Apr 13 19:00:08 2006 [Mdarc] *** Saved data file
/is01_data/bnmr/dlog/2006/030005.msr_v1 at Thu Apr 13 19:00:08 2006 ***
Thu Apr 13 19:01:10 2006 [Mdarc] *** Saved data file
/is01_data/bnmr/dlog/2006/030005.msr_v2 at Thu Apr 13 19:01:10 2006 ***
Thu Apr 13 19:02:14 2006 [Mdarc] *** Saved data file
/is01_data/bnmr/dlog/2006/030005.msr_v3 at Thu Apr 13 19:02:14 2006 ***
Thu Apr 13 19:03:20 2006 [Mdarc] *** Saved data file
/is01_data/bnmr/dlog/2006/030005.msr_v4 at Thu Apr 13 19:03:20 2006 ***
Thu Apr 13 19:04:22 2006 [Mdarc] *** Saved data file
/is01_data/bnmr/dlog/2006/030005.msr_v5 at Thu Apr 13 19:04:22 2006 ***
Thu Apr 13 19:05:12 2006 [feBNMR] [midas.c:9323:rpc_call] parameters
(1077739560) too large for network buffer
(524344)
Thu Apr 13 19:05:13 2006 [feBNMR] [midas.c:9323:rpc_call] parameters
(1077739560) too large for network buffer
(524344)
etc.
  1252   17 Mar 2017 Pierre GorelBug Reportbadly managed case in history_schema.cxx: dat file empty
For an unknown reason, Logger died few days ago while writing the history. The
file mhf_1489577446_20170315_system.dat was created, but was empty.

When trying to restart Logger, I would get a seg fault without any special error
message.

I tracked the issue to the "read_file_schema" function in history_schema.cxx

* L4731, a pointer to HsFileSchema *s is declared.
* L4747, We enter a while(1) loop.
* L4749, get char on the filename.
In our case, the file was empty, so the variable "b" gets NULL and the loop breaks.

Problem: the memory allocation for "s" is later in the loop, L4768.
Upon exiting the loop, L4854, we try to access record_size on a NULL pointer ==>
SegFault. 

It would be nice to at least have a message before breaking the loop...
  1269   15 Apr 2017 Konstantin OlchanskiBug Reportbadly managed case in history_schema.cxx: dat file empty
> For an unknown reason, Logger died few days ago while writing the history. The
> file mhf_1489577446_20170315_system.dat was created, but was empty.

I ran into same problem installing new midas in the alpha experiment at cern. It should be fixed now:
https://bitbucket.org/tmidas/midas/commits/788021d9cb39a348a40e36f1b35b1440e06aa744

K.O.

> 
> When trying to restart Logger, I would get a seg fault without any special error
> message.
> 
> I tracked the issue to the "read_file_schema" function in history_schema.cxx
> 
> * L4731, a pointer to HsFileSchema *s is declared.
> * L4747, We enter a while(1) loop.
> * L4749, get char on the filename.
> In our case, the file was empty, so the variable "b" gets NULL and the loop breaks.
> 
> Problem: the memory allocation for "s" is later in the loop, L4768.
> Upon exiting the loop, L4854, we try to access record_size on a NULL pointer ==>
> SegFault. 
> 
> It would be nice to at least have a message before breaking the loop...
  89   30 Nov 2003 Konstantin Olchanski bad call to cm_cleanup() in fal.c
fal.c does not compile: it calls cm_cleanup() with one argument when there
should be two arguments. K.O.
  90   30 Nov 2003 Stefan Ritt bad call to cm_cleanup() in fal.c
> fal.c does not compile: it calls cm_cleanup() with one argument when there
> should be two arguments. K.O.

Fixed and committed.
  920   22 Oct 2013 Konstantin OlchanskiInfoaudit of db_get_record()
Record-oriented ODB functions db_create_record(), db_get_record(), db_check_record() and 
db_set_record() require special attention to the consistency between their "C struct"s (usually defined in 
midas.h), their initialization strings (usually defined in midas.h) and the contents of ODB.

When these 3 items become inconsistent, the corresponding midas functions tend to break.

Unlike ODB internal structures and event buffer internal structures, these record-oriented functions are 
not part of the midas binary-compatibility abi and they are not protected by db_validate_sizes().

From time to time, new items are added to some of these data structures. Usually this does not cause 
problems, but recently we had some difficulty with the runinfo and equipment structures, prompting this 
audit.

db_check_record: note: (C) means that this record is created there

alarm.c: alarm_odb_str(C)
mana.c: skipped
mfe.c: equipment_common_str, equipment_statistics_str(C), event_descrip(C), bank_list(C)
mhttpd.cxx: cgif_label_str(C), cgif_bar_str(C), runinfo_str(C), equipment_common_str(C)
mlogger.cxx: ch_settings_str(C)
sequencer.cxx: sequencer_str(C)

db_create_record:

alarm.c: alarm_odb_str, alarm_periodic_str, alarm_class_str
fal.c: skipped
mfe.c: equipment_common_str
midas.c: program_info_str (maybe)
odb.c: (maybe)
lazylogger.cxx: lazy_settings, lazy_statistics
mhttpd.cxx: runinfo_str
mlogger.cxx: chn_settings_str

db_get_record: (hard to do with grep, will have to check every db_get_record by hand)

alarm.c: alarm, class, program_info
fal.c: skipped
mana.c: skipped
midas.c: program_info
odb.c: (maybe)
lazylogger.cxx: lazyst
mhttpd.cxx: runinfo, equipment, ?hkeytemp?, chn_settings, chn_stats, ?label?, ?bar?
mlogger.cxx: ?, ?, chn_stats, chn, settings
sequencer.cxx: hkeyseq

db_set_record:

alarm.c: hkeyalarm, hkeyclass, ???, program_info
fal.c: skipped
mana.c: skipped
mfe.c: equipment_info, ?event structure?
odb.c: (maybe)
lazelogger.cxx: lazyst
mlogger.cxx: chn_stat
sequencer.cxx: seq

db_open_record: note: (W) means MODE_WRITE

fal.c: skipped
mana.c: skipped
mfe.c: equipment_info, equipment_stats(W)
midas.c: requested_transition
odbedit.c: key_update - generic test of hotlink
lazylogger.cxx: runstate, lazyst(W), lazy?
mlogger.cxx: history, chn_statistics, chn_settings
sequencer.cxx: seq

K.O.
  1498   16 Mar 2019 Gennaro TortoneForumassertion failed
Hi,
I'm developing a Slow Control equipment on a Linux board that send data on a remote server
running 'mserver'; the build goes fine, but  when I run the executable it seems that an assertion in 
midas.c failed:

[dfe01,INFO] Slow control equipment initialized
dfe: src/midas.c:838: cm_msg_flush_buffer: Assertion `rp[3]=='_'' failed.

if I remove line 838 from midas.c (fixing message length) the problem disappear...

Regards,
Gennaro
  1500   18 Mar 2019 Konstantin OlchanskiForumassertion failed
> [dfe01,INFO] Slow control equipment initialized
> dfe: src/midas.c:838: cm_msg_flush_buffer: Assertion `rp[3]=='_'' failed.
> if I remove line 838 from midas.c (fixing message length) the problem disappear...

Thank you for reporting this problem.

It is very strange, the check is for message start "MSG_", why "M", "S" and "G" are there
but "_" is missing? And you remove the check for "_" and the rest of the message is also okey?
Very odd.

I look at the code in midas.c and I also see is that the ring buffer has no protection against
overflow, it is created for max message length of around 1000 bytes, but I look at the code 
that feeds messages into it (cm_msg_format()) and it also has a buffer overrun
possibility (sprintf() instead snprintf()). Actually I just ran into this buffer overrun
myself when adding memory leak debugging code into mhttpd.

Anyhow, before this message that causes the crash, maybe perchance you have a long
message before it? Of length 1000 bytes of longer? (1000 bytes is 12 lines of 80 chars).

Or this is the very first message you generate? (other than the normal messages generated by mfe.c?)

Is there anything in midas.log around the time of the crash? (post it here or email it to me?) Also I would
like to see everything printed by your frontend from the start time all the way to the crash.

You can also add this code "assert(4+3*sizeof(int)+len < 1020)" in cm_msg_buffer() right before
rb_increment_wp() - it this assert fails, we definitely determine that we have a buffer overflow.

Thank in advance,
K.O.
  1502   19 Mar 2019 Gennaro TortoneForumassertion failed
> > [dfe01,INFO] Slow control equipment initialized
> > dfe: src/midas.c:838: cm_msg_flush_buffer: Assertion `rp[3]=='_'' failed.
> > if I remove line 838 from midas.c (fixing message length) the problem disappear...
> 
> Thank you for reporting this problem.
> 
> It is very strange, the check is for message start "MSG_", why "M", "S" and "G" are there
> but "_" is missing? And you remove the check for "_" and the rest of the message is also okey?
> Very odd.

if I remove the check for "_" then the first message is empty and next messages are ok...
If I don't remove the check the frontend fails at start and I find these lines in midas.log:

14:46:29.719 2019/03/19 [dfe01,INFO] Program dfe01 on host lxaria02 started
14:46:29.731 2019/03/19 [dfe01,INFO] Dome FE initialized
14:46:29.737 2019/03/19 [dfe01,ERROR] [system.c:4709:recv_tcp2,ERROR] unexpected connection closure
14:46:29.737 2019/03/19 [dfe01,ERROR] [midas.c:12814:recv_event_server,ERROR] recv_tcp2(header) returned -1
14:46:29.737 2019/03/19 [dfe01,ERROR] [midas.c:14699:rpc_server_receive,ERROR] recv_event_server() returned -1, abort
14:46:29.737 2019/03/19 [dfe01,TALK] Program 'dfe01' on host 'lxaria02' aborted
 
> You can also add this code "assert(4+3*sizeof(int)+len < 1020)" in cm_msg_buffer() right before
> rb_increment_wp() - it this assert fails, we definitely determine that we have a buffer overflow.

I added assert you suggested in cm_msg_buffer() function before rp_increment_wp() and 
result is always the same at same line:

[dfe01,INFO] Dome FE initialized
Dome0001-rc:
[dfe01,INFO] Slow control equipment initialized
dfe: src/midas.c:839: cm_msg_flush_buffer: Assertion `rp[3]=='_'' failed.
Aborted

Regards,
Gennaro
  1509   28 Mar 2019 Konstantin OlchanskiForumassertion failed
For the record, I am stumped by this problem. We have definitely ruled out any data overflow inside the midas message code (there are no 
long messages sent). My only guess is that the frontend itself is corrupting the midas message buffer, but this corruption
must be unlikely lucky to corrupt just the "_" character (and maybe what follows it) from the "MSG_" header inside the buffer.

If indeed this is memory corruption inside the frontend, to find and fix it, one would have to roll out valgrind and other malloc() debugging 
tools and good luck...

K.O.



> > > [dfe01,INFO] Slow control equipment initialized
> > > dfe: src/midas.c:838: cm_msg_flush_buffer: Assertion `rp[3]=='_'' failed.
> > > if I remove line 838 from midas.c (fixing message length) the problem disappear...
> > 
> > Thank you for reporting this problem.
> > 
> > It is very strange, the check is for message start "MSG_", why "M", "S" and "G" are there
> > but "_" is missing? And you remove the check for "_" and the rest of the message is also okey?
> > Very odd.
> 
> if I remove the check for "_" then the first message is empty and next messages are ok...
> If I don't remove the check the frontend fails at start and I find these lines in midas.log:
> 
> 14:46:29.719 2019/03/19 [dfe01,INFO] Program dfe01 on host lxaria02 started
> 14:46:29.731 2019/03/19 [dfe01,INFO] Dome FE initialized
> 14:46:29.737 2019/03/19 [dfe01,ERROR] [system.c:4709:recv_tcp2,ERROR] unexpected connection closure
> 14:46:29.737 2019/03/19 [dfe01,ERROR] [midas.c:12814:recv_event_server,ERROR] recv_tcp2(header) returned -1
> 14:46:29.737 2019/03/19 [dfe01,ERROR] [midas.c:14699:rpc_server_receive,ERROR] recv_event_server() returned -1, abort
> 14:46:29.737 2019/03/19 [dfe01,TALK] Program 'dfe01' on host 'lxaria02' aborted
>  
> > You can also add this code "assert(4+3*sizeof(int)+len < 1020)" in cm_msg_buffer() right before
> > rb_increment_wp() - it this assert fails, we definitely determine that we have a buffer overflow.
> 
> I added assert you suggested in cm_msg_buffer() function before rp_increment_wp() and 
> result is always the same at same line:
> 
> [dfe01,INFO] Dome FE initialized
> Dome0001-rc:
> [dfe01,INFO] Slow control equipment initialized
> dfe: src/midas.c:839: cm_msg_flush_buffer: Assertion `rp[3]=='_'' failed.
> Aborted
> 
> Regards,
> Gennaro
  452   07 Mar 2008 Randolf PohlBug Reportarray overflows and other bugs
Hi,

I have just compiled MIDAS svn 4132 on a fresh SuSE 10.3 x86_64 system and gcc 
found a bunch of bugs, I guess.

> uname -a
Linux pc 2.6.22.17-0.1-default #1 SMP 2008/02/10 20:01:04 UTC x86_64 x86_64 
x86_64 GNU/Linux

> gcc --version
gcc (GCC) 4.2.1 (SUSE Linux)

I see loads of warnings during compile, most of which I know from earlier 
compiles:
* warning: dereferencing type-punned pointer will break strict-aliasing rules
* warning: pointer targets in passing argument 3 of 'getsockname' differ in
           signedness

But then there is a new one (in fact lots of this one), and brief
inspection suggests this is a true bug with the possibility of truly
nasty consequences.

(1)=========================
src/midas.c:7398: warning: array subscript is above array bounds
Inspection of midas.c:

   if (i == MAX_DEFRAG_EVENTS) {
      /* no buffer available -> no first fragment received */
7398: free(defrag_buffer[i].pevent);
      memset(&defrag_buffer[i].event_id, 0, sizeof(EVENT_DEFRAG_BUFFER));
      cm_msg(MERROR, "bm_defragement_event",
             "Received fragment without first fragment (ID %d) Ser#:%d",
             pevent->event_id & 0x0FFF, pevent->serial_number);
      return;
   }

And midas.c line 7297:
EVENT_DEFRAG_BUFFER defrag_buffer[MAX_DEFRAG_EVENTS];

So, if(i==MAX_DEFRAG_EVENTS) free(defrag_buffer[i]).
I guess this is an off-by-one bug.

(2)==========================
src/midas.c:2958: warning: array subscript is above array bounds

   for (i = 0; i < 13; i++)
2958  if (trans_name[i].transition == transition)
         break;

Holy cow, hard-coded "13" in the code! Should be a #define, shouldn't it?

Now look at midas.c lines 94ff:
struct {
   int transition;
   char name[32];
} trans_name[] = {
   {
   TR_START, "START",}, {
   TR_STOP, "STOP",}, {
   TR_PAUSE, "PAUSE",}, {
   TR_RESUME, "RESUME",}, {
   TR_DEFERRED, "DEFERRED",}, {
0, "",},};

There is no trans_name[12].

The trans_name[12] shows up in line 2894 and 2790, too.

(3)=============================
mfe.c:
src/mfe.c:412: warning: array subscript is above array bounds
src/mfe.c:311: warning: array subscript is above array bounds
src/mfe.c:340: warning: array subscript is above array bounds

412: device_drv->dd(CMD_GET_DEMAND, device_drv->dd_info, i, 
          &device_drv->mt_buffer->channel[i].array[CMD_GET_DEMAND]);


   for (cmd = CMD_GET_FIRST; cmd <= CMD_GET_LAST; cmd++) {
 (..)
311:  device_drv->mt_buffer->channel[current_channel].array[cmd] = value;

   for (cmd = CMD_GET_FIRST; cmd <= CMD_GET_LAST; cmd++) {
 (..)
340:  device_drv->mt_buffer->channel[i].array[cmd] = value;


CMD_GET_DEMAND is in include/midas.h:
#define CMD_GET_DEMAND               CMD_GET_DIRECT  // = 20

I haven't even tried to understand mfe.c, nor did I read it. 
But I suspect the thing should always be something like
....array[cmd-CMD_GET_FIRST]
so array[] is indexed from [0], not from an arbitrary number that
depends on the number of commands you insert before line 698 in
midas.h. But please could the author of this check this very carefully?


(4)=========================
src/lazylogger.c:1957: warning: array subscript is below array bounds

if ((channel < 0) && (lazyinfo[channel].hKey != 0))

That is lazyinfo[something below zero].


(5)=============================
More warnings an expert might want to have a look at:

* warning: deprecated conversion from string constant to 'char*'

* src/fal.c:106: warning: non-local variable '<anonymous struct> out_info'
                 uses anonymous type
* src/fal.c:3064: warning: non-local variable '<anonymous struct> eb' uses
                  anonymous type

I attach the full output of make.
Could someone knowledgeable please have a look at these warnings and fix them?

They make me a bit nervous when thinking about data integrity, and
there are now so many that they actually start to hide serious stuff
like the ones I presented.

Oh, I got rid of the "dereferencing type-punned pointer" thing by adding
"-fno-strict-aliasing" as a compiler flag. Was suggested on the Web. Seemed to 
have worked during data taking (the data look reasonable :-). Is that a 
possible fix/workaround?


Cheers,

Randolf
Attachment 1: out.0.make
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/midas.o src/midas.c
src/midas.c: In function 'bm_open_buffer':
src/midas.c:4020: warning: dereferencing type-punned pointer will break strict-aliasing rules
src/midas.c: In function 'rpc_server_connect':
src/midas.c:8259: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
src/midas.c:8261: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
src/midas.c:8263: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
src/midas.c:8376: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
src/midas.c:8378: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
src/midas.c:8380: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
src/midas.c: In function 'rpc_register_server':
src/midas.c:10533: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
src/midas.c: In function 'rpc_server_accept':
src/midas.c:11230: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
src/midas.c:11239: warning: pointer targets in passing argument 3 of 'getpeername' differ in signedness
src/midas.c: In function 'rpc_client_accept':
src/midas.c:11493: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
src/midas.c: In function 'bm_defragment_event':
src/midas.c:7398: warning: array subscript is above array bounds
src/midas.c: In function 'cm_register_deferred_transition':
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c: In function 'cm_set_transition_sequence':
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c: In function 'cm_deregister_transition':
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c: In function 'cm_register_transition':
src/midas.c:2790: warning: array subscript is above array bounds
src/midas.c:2790: warning: array subscript is above array bounds
src/midas.c:2790: warning: array subscript is above array bounds
src/midas.c:2790: warning: array subscript is above array bounds
src/midas.c:2790: warning: array subscript is above array bounds
src/midas.c:2790: warning: array subscript is above array bounds
src/midas.c:2790: warning: array subscript is above array bounds
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/system.o src/system.c
src/system.c: In function 'ss_suspend_init_ipc':
src/system.c:2948: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
src/system.c: In function 'ss_suspend':
src/system.c:3416: warning: pointer targets in passing argument 6 of 'recvfrom' differ in signedness
src/system.c:3443: warning: pointer targets in passing argument 6 of 'recvfrom' differ in signedness
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/mrpc.o src/mrpc.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/odb.o src/odb.c
src/odb.c: In function 'db_open_database':
src/odb.c:891: warning: dereferencing type-punned pointer will break strict-aliasing rules
src/odb.c: In function 'db_lock_database':
src/odb.c:1441: warning: dereferencing type-punned pointer will break strict-aliasing rules
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/ybos.o src/ybos.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/ftplib.o src/ftplib.c
src/ftplib.c: In function 'ftp_data':
src/ftplib.c:288: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
src/ftplib.c:310: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/mxml.o ../mxml/mxml.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/history.o src/history.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/alarm.o src/alarm.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/elog.o src/elog.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/strlcpy.o ../mxml/strlcpy.c
rm -f linux/lib/libmidas.a
ar -crv linux/lib/libmidas.a linux/lib/midas.o linux/lib/system.o linux/lib/mrpc.o linux/lib/odb.o linux/lib/ybos.o linux/lib/ftplib.o linux/lib/mxml.o linux/lib/history.o linux/lib/alarm.o linux/lib/elog.o linux/lib/strlcpy.o
a - linux/lib/midas.o
a - linux/lib/system.o
a - linux/lib/mrpc.o
a - linux/lib/odb.o
a - linux/lib/ybos.o
a - linux/lib/ftplib.o
a - linux/lib/mxml.o
a - linux/lib/history.o
a - linux/lib/alarm.o
a - linux/lib/elog.o
a - linux/lib/strlcpy.o
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/mana.o src/mana.c
g++ -DUSE_ROOT -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -pthread -m64 -I/usr/local/packages/root/pro/include -o linux/lib/rmana.o src/mana.c
src/mana.c:186: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'void add_data_dir(char*, char*)':
src/mana.c:429: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'EVENT_DEF* db_get_event_definition(short int)':
src/mana.c:484: warning: deprecated conversion from string constant to 'char*'
src/mana.c:500: warning: deprecated conversion from string constant to 'char*'
src/mana.c:505: warning: deprecated conversion from string constant to 'char*'
src/mana.c:516: warning: deprecated conversion from string constant to 'char*'
src/mana.c:518: warning: deprecated conversion from string constant to 'char*'
src/mana.c:520: warning: deprecated conversion from string constant to 'char*'
src/mana.c:522: warning: deprecated conversion from string constant to 'char*'
src/mana.c:524: warning: deprecated conversion from string constant to 'char*'
src/mana.c:526: warning: deprecated conversion from string constant to 'char*'
src/mana.c:534: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'INT bor(INT, char*)':
src/mana.c:1745: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'INT process_event(ANALYZE_REQUEST*, EVENT_HEADER*)':
src/mana.c:3230: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'void register_requests()':
src/mana.c:3465: warning: deprecated conversion from string constant to 'char*'
src/mana.c:3479: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'TCutG* cut_book(const char*)':
src/mana.c:3562: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'INT bevid_2_mheader(EVENT_HEADER*, DWORD*)':
src/mana.c:3864: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'void odb_load(EVENT_HEADER*)':
src/mana.c:3910: warning: deprecated conversion from string constant to 'char*'
src/mana.c:3921: warning: deprecated conversion from string constant to 'char*'
src/mana.c:3932: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'MA_FILE* ma_open(char*)':
src/mana.c:4031: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'INT analyze_run(INT, char*, char*)':
src/mana.c:4252: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'int main(int, char**)':
src/mana.c:5618: warning: deprecated conversion from string constant to 'char*'
src/mana.c:5682: warning: deprecated conversion from string constant to 'char*'
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/cnaf_callback.o src/cnaf_callback.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/mfe.o src/mfe.c
src/mfe.c: In function 'scheduler':
src/mfe.c:1869: warning: pointer targets in passing argument 5 of 'db_get_value' differ in signedness
src/mfe.c:2042: warning: pointer targets in passing argument 5 of 'db_get_value' differ in signedness
src/mfe.c:2051: warning: pointer targets in passing argument 5 of 'db_get_value' differ in signedness
src/mfe.c: In function 'device_driver':
src/mfe.c:412: warning: array subscript is above array bounds
src/mfe.c: In function 'sc_thread':
src/mfe.c:311: warning: array subscript is above array bounds
src/mfe.c:340: warning: array subscript is above array bounds
g++ -Dextname -DMANA_LITE -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/fal.o src/fal.c
src/fal.c:65: warning: deprecated conversion from string constant to 'char*'
src/fal.c:106: warning: non-local variable '<anonymous struct> out_info' uses anonymous type
src/fal.c:118: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'void logger_init()':
src/fal.c:252: warning: deprecated conversion from string constant to 'char*'
src/fal.c:256: warning: deprecated conversion from string constant to 'char*'
src/fal.c:260: warning: deprecated conversion from string constant to 'char*'
src/fal.c:263: warning: deprecated conversion from string constant to 'char*'
src/fal.c:267: warning: deprecated conversion from string constant to 'char*'
src/fal.c:271: warning: deprecated conversion from string constant to 'char*'
src/fal.c:274: warning: deprecated conversion from string constant to 'char*'
src/fal.c:277: warning: deprecated conversion from string constant to 'char*'
src/fal.c:280: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'void odb_save(char*)':
src/fal.c:335: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT ftp_open(char*, FTP_CON**)':
src/fal.c:1048: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1052: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1056: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1056: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1061: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1066: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT midas_log_open(LOG_CHN*, INT)':
src/fal.c:1194: warning: dereferencing type-punned pointer will break strict-aliasing rules
src/fal.c: In function 'EVENT_DEF* db_get_event_definition(short int)':
src/fal.c:1321: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1337: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1347: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1349: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1351: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1353: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1355: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1357: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1365: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT dump_log_open(LOG_CHN*, INT)':
src/fal.c:1582: warning: dereferencing type-punned pointer will break strict-aliasing rules
src/fal.c: In function 'INT ascii_log_open(LOG_CHN*, INT)':
src/fal.c:1803: warning: dereferencing type-punned pointer will break strict-aliasing rules
src/fal.c: In function 'INT log_open(LOG_CHN*, INT)':
src/fal.c:2293: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2296: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2299: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2302: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2309: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT log_write(LOG_CHN*, EVENT_HEADER*)':
src/fal.c:2414: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2439: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2477: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2478: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT open_history()':
src/fal.c:2523: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2525: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2530: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2531: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2533: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2535: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2538: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2538: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2540: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2543: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2543: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2550: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2564: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2573: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2581: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2613: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2737: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2864: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'void close_history()':
src/fal.c:2878: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT log_callback(INT, void**)':
src/fal.c:2983: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2992: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3007: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3011: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3015: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3040: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3042: warning: deprecated conversion from string constant to 'char*'
src/fal.c: At global scope:
src/fal.c:3064: warning: non-local variable '<anonymous struct> eb' uses anonymous type
src/fal.c: In function 'INT tr_start(INT, char*)':
src/fal.c:3092: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3097: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3101: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3104: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3107: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3114: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3153: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3161: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3205: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3207: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3209: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3226: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3272: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT tr_stop(INT, char*)':
src/fal.c:3491: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3496: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'void add_data_dir(char*, char*)':
src/fal.c:3537: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT mana_init()':
src/fal.c:4395: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT register_equipment()':
src/fal.c:4657: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4660: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4683: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4687: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4694: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4696: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4761: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'void register_requests()':
src/fal.c:4924: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4934: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT scheduler()':
src/fal.c:5407: warning: deprecated conversion from string constant to 'char*'
src/fal.c:5496: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'int main(int, char**)':
src/fal.c:5616: warning: deprecated conversion from string constant to 'char*'
cc -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/bin/mserver src/mserver.c linux/lib/libmidas.a -lutil -lpthread -lz
cc -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/bin/mhttpd src/mhttpd.c src/mgd.c linux/lib/libmidas.a -lutil -lpthread -lz -lm
g++ -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/bin/mlogger src/mlogger.c linux/lib/libmidas.a -L/usr/local/packages/root/pro/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -pthread -lm -ldl -rdynamic -Wl,-rpath,/usr/local/packages/root/pro/lib  -lutil -lpthread -lz
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
... 156 more lines ...
  453   07 Mar 2008 Stefan RittBug Reportarray overflows and other bugs
> I have just compiled MIDAS svn 4132 on a fresh SuSE 10.3 x86_64 system and gcc 
> found a bunch of bugs, I guess.

Ahh, great! gcc is getting more and more clever. Each time gcc is updated, it finds
a few new issues.

Indeed some are real bugs, and I will work down the list as time permits. I see
however no immediate thread (you are not using fragmented events, a transition 12
never occurs, etc.). Issue #4 from your list has to be checked by Pierre-Andre. 
  462   10 Mar 2008 Stefan RittBug Reportarray overflows and other bugs
There were some trivial and some non-trivial issues. Glad the compiled picked up on
this!

> I see loads of warnings during compile, most of which I know from earlier 
> compiles:
> * warning: dereferencing type-punned pointer will break strict-aliasing rules
> * warning: pointer targets in passing argument 3 of 'getsockname' differ in
>            signedness

I ignore these for the moment until I have a gcc 4.2 myself (we use Scientific
Linux 5 which has gcc 4.1 for the moment). As Randolph pointed out correctly you
can make gcc shut up by a proper flag there. The warnings have no influence on the
stability of midas.

> (1)=========================
> src/midas.c:7398: warning: array subscript is above array bounds
> Inspection of midas.c:
> 
>    if (i == MAX_DEFRAG_EVENTS) {
>       /* no buffer available -> no first fragment received */
> 7398: free(defrag_buffer[i].pevent);
>       memset(&defrag_buffer[i].event_id, 0, sizeof(EVENT_DEFRAG_BUFFER));
>       cm_msg(MERROR, "bm_defragement_event",
>              "Received fragment without first fragment (ID %d) Ser#:%d",
>              pevent->event_id & 0x0FFF, pevent->serial_number);
>       return;
>    }

The free() was just wrong at that place, I removed it.

> (2)==========================
> src/midas.c:2958: warning: array subscript is above array bounds
> 
>    for (i = 0; i < 13; i++)
> 2958  if (trans_name[i].transition == transition)
>          break;

Fixed that by
     
     for (i=0 ;; i++)
        if (trans_name[i].name[0] == 0 || trans_name[i].transition == transition)
           break;

Since trans_name[i].name = "" indicates the end of the list.

> (3)=============================
> mfe.c:
> src/mfe.c:412: warning: array subscript is above array bounds
> src/mfe.c:311: warning: array subscript is above array bounds
> src/mfe.c:340: warning: array subscript is above array bounds
> 
> 412: device_drv->dd(CMD_GET_DEMAND, device_drv->dd_info, i, 
>           &device_drv->mt_buffer->channel[i].array[CMD_GET_DEMAND]);

The code at 412 was wrong there, the demand value is queried later by the device
driver directly. For the other two occurences (311 and 340) I had to really
increase the array size by one. This issue can cause segfaults if you have a slow
control front-end which uses multithreading (not many people use it except me).

> (4)=========================
> src/lazylogger.c:1957: warning: array subscript is below array bounds
> 
> if ((channel < 0) && (lazyinfo[channel].hKey != 0))
> 
> That is lazyinfo[something below zero].

This has to be fixed by Pierre. I guess an or instead of an and would do it, but
I'm not 100% sure.

> (5)=============================
> More warnings an expert might want to have a look at:
> 
> * warning: deprecated conversion from string constant to 'char*'
> 
> * src/fal.c:106: warning: non-local variable '<anonymous struct> out_info'
>                  uses anonymous type
> * src/fal.c:3064: warning: non-local variable '<anonymous struct> eb' uses
>                   anonymous type
> 
> I attach the full output of make.
> Could someone knowledgeable please have a look at these warnings and fix them?

Uahhh. Especially the "const char*" vs. "char*" is in principle right, but will
cause a major rework. Probably hundreds of occations have to be fixed. Many strings
must be declared const, others not. It will help the programmer to find some errors
during compile which would later show up only during runtime (like writing into a
fixed string), but I only will go through that when I have gcc 4.2 installed
myself, and have two free days to work on this ;-)

> They make me a bit nervous when thinking about data integrity, and
> there are now so many that they actually start to hide serious stuff
> like the ones I presented.

Except the slow control stuff (which only is an issue for multithreaded frontends)
none of the above things will have an influence on the data integrity. But I agree
that they should be fixed.

- Stefan
  377   22 May 2007 Randolf PohlBug Reportanalyzer_init called by odb_load
Hi,

I wonder why mana.c:odb_load() calls analyzer_init(). This way analyzer_init 
is called TWICE or more times:
first from mana.c:mana_init(), for each invocation of the analyzer, and 
second from mana.c:odb_load(), for each run to be analyzed

Isn't this a bug? It can mess up several things (like mallocs) if you don't 
take the necessary precautions. Other module_init functions are correctly 
called only once, before all runs are analyzed.

I have the feeling, that odb_load should NOT call analyzer_init. Or am I wrong 
(probably, but please explain to me)? Do I have to live with it and make sure 
that my beautiful global initialization in analyzer_init is only done once?
:-)

Cheers,

Randolf

And here is the annotated log using the ROOT example experiment 
(several modules changed/added to print their respective names)

:~/midas/examples/root> ./analyzer -e exa_root -i run%05d.mid -r 1 3
 
analyzer_init        <-- ok

Root server listening on port 9090...
adc_calib_init       <-- ok
adc_summing_init     <-- ok
scaler_init          <-- ok
Running analyzer offline. Stop with "!"
Set run number 1 in ODB
Load ODB from run 1...
analyzer_init        <-- not ok, or is it?

OK
run00001.mid:777  events, 0.00s
Set run number 2 in ODB
Load ODB from run 2...
analyzer_init        <-- not ok, or is it?

OK
run00002.mid:7227  events, 0.03s
Set run number 3 in ODB
Load ODB from run 3...
analyzer_init        <-- not ok, or is it?

OK
run00003.mid:13866  events, 0.06s
adc_calib_exit
adc_summing_exit
scaler_exit

analyzer_exit
  378   22 May 2007 Stefan RittBug Reportanalyzer_init called by odb_load
The reason to call analyzer_init in odb_load is the following:

Assume you run the analyzer offline, analyzing many files in series. Then assume
that you have /Experiment/Run Parameters, which is actively used by the analyzer
(like beam settings etc.). In this case you do a db_open_record() to map
/Experiment/Run Parameters to the exp_param C structure. For this mapping to work,
the ODB structure and the C structure have to be exactly the same. Now assume that
you changed your run parameters over time, like you added some comment later. Now
you want to analyzer several runs, some before and some after the modification.
Both sets have a different structure in /Experiment/Run Parameters, which is a
problem, since the compiled analyzer can only have a single C structure. My "poor"
solution was to call analyzer_init after each loading of the ODB from the *.mid
file. The db_create_record() call matches the C structure to the ODB structure by
modifying the ODB structure if necessary. So if you added one parameter later, this
(modified) structure gets loaded by odb_load, but then it gets adjusted in
analyzer_init().

I understand now that this case might not happen so often, and you are more
bothered by the fact that analyzer_init gets called several time. There must
however be a hook for offline analysis that the user code can correct the ODB
structure. So I propose to add a flag to analyzer_init, such as

INT analyzer_init(BOOL bFirst)
{
}

If bFirst equals TRUE, the function got called from mana_init(), if FALSE, it got
called from odb_load. Then you can put code like

INT analyzer_init(BOOL bFirst)
{
   if (bFirst) {
      p = malloc()
      ...
   }
}

If you agree, I will modify the code and commit the change.

- Stefan
  379   22 May 2007 Randolf PohlBug Reportanalyzer_init called by odb_load
Thanks for the quick reply, Stefan.

Please don't change anything in the code unless you find it really important. I guess 
changing the analyzer_init prototype will break a lot of code out there?

In fact, I think I do understand this behavior now.
And even without your suggested fix there is a simple workaround: I add a static 
variable to my analyzer_init.cxx file, and do something similar to your bFirst fix.

In conclusion, commit your fix if it does not harm others. Postpone this commit to a 
future new version of midas which breaks a lot of things anyway...

A last question, for me to understand: Why not call db_open_record in 
ana_begin_of_run then?

Cheers,

Randolf
  380   22 May 2007 Stefan RittBug Reportanalyzer_init called by odb_load
> Thanks for the quick reply, Stefan.
> 
> Please don't change anything in the code unless you find it really important.
I guess 
> changing the analyzer_init prototype will break a lot of code out there?
> 
> In fact, I think I do understand this behavior now.
> And even without your suggested fix there is a simple workaround: I add a static 
> variable to my analyzer_init.cxx file, and do something similar to your bFirst
fix.
> 
> In conclusion, commit your fix if it does not harm others. Postpone this
commit to a 
> future new version of midas which breaks a lot of things anyway...
> 
> A last question, for me to understand: Why not call db_open_record in 
> ana_begin_of_run then?

I fully agree with you that db_open_record would better go into ana_begin_of_run
(and
analyzer_init not being called in odb_load), and I fully agree with you that
changing the
code would break many experiments. ;-)

So I guess we leave it as it is right now as you suggested.
  1245   27 Feb 2017 William MooreSuggestionanalyzer failing to load ODB parameters
Hi,

I am attempting to compile and run analysis code on a completely different,
unconnected system than the DAQ computer for the experiment. The analyzer was
developed previously and my goal is to get it running and then update it to
achieve my needs. Before compiling the analyzer, I load a backup ODB file in
odbedit, and compile experim.h. I then compile the analyzer with that experim.h
file. When I run the analyzer I get the following output:

> MIDAS version 2.1ROOT version 5.34/36Root server listening on port 9090...
> Running analyzer offline. Stop with "!"
> Configuration file "/somedir/switches.odb" loaded
> [Analyzer,INFO] Set run number 1290 in ODB
> Load ODB from run 1290...[Analyzer,INFO] cannot load value "Client Notify":
write protected
> [Analyzer,INFO] cannot load value "Prompt": write protected
.
.
.
> [Analyzer,INFO] cannot load value "LANSCE-ops": write protected
> MIDAS version 2.1ROOT version 5.34/36OK
> Configuration file "/somedir/switches.odb" loaded
> Data_Raw/run01290.mid.gz:16355  Data_Analyzed/run01290.root:15208  events, 0.43s

I have confirmed all files being used have read/write access to all users. The
analyzer does populate a .root output file with filled histograms, however not
all histograms are filled. I believe this is because histograms that relied on
an ODB paramater that failed to load did not populate. Any idea as to what I am
doing wrong or how I could resolve this issue are greatly appreciated.

Thanks,
William Moore
  420   04 Feb 2008 Robert PattieForumanalyzer crashes at high rates
I'm using midas to read data from a waveform digitizer at event rates of
10-30kHz. To accomplish this the digitizer is read via Block transfers and the
raw data put into a single MIDAS event.  Thus a MIDAS event could contain upto
250 physical events and at maximum 350kBytes.  In the analyzer modules I had
been analyzing the first physics event contained in a MIDAS event with no
problem.  Recently I tried to analyze all the physical events.  At low rates,
100hz-1khz, this was no problem, 1-5 physical events in a MIDAS event.  At
higher rates 10-20kHz, where there are about 40physical events per MIDAS event,
 the analyzer keeps up for a  few seconds then seg faults with " 'shared object
read from target memory' has disappear; keeping it symbols".  Any suggestions as
to why the analyzer is crashing would be very helpful.

Thanks,

Robert     
ELOG V3.1.4-2e1708b5