--0-2078824251-1301106925=:36147
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
ACE VERSION: 6.0.1
HOST MACHINE and OPERATING SYSTEM:
=A0=A0 =A0DELL precision 690 running CentOS 4.9. Kernel 2.6.9-100.ELsmp #1 =
SMP Fri Feb 18 02:12:11 EST 2011 x86_64
TARGET MACHINE and OPERATING SYSTEM, if different from HOST:=A0 Same as hos=
t
COMPILER NAME AND VERSION (AND PATCHLEVEL):=A0=A0 g++4 (GCC) 4.1.2 20080704=
(Red Hat 4.1.2-44)
THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform-
=A0=A0=A0 specific file, simply state which one]:=A0=A0 config.h -> config-=
linux.h
=A0=A0=A0 THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if yo=
u
=A0=A0=A0 use a link to a platform-specific file, simply state which one
=A0=A0=A0 (unless this isn't used in this case, e.g., with Microsoft Visual
=A0=A0=A0 C++)]:=A0=A0 =A0=A0=A0 =A0platform_macros.GNU -> platform_linux.G=
NU
BUILD METHOD USED:
[Experimental ./configure or traditional makefile/project file?]=A0=A0 trad=
itional makefile
CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features
=A0=A0=A0 (used by MPC when you generate your own makefiles):
=A0=A0=A0 AREA/CLASS/EXAMPLE AFFECTED:=A0 ACE logging
=A0=A0=A0 DOES THE PROBLEM AFFECT:
=A0=A0=A0=A0=A0=A0=A0 COMPILATION?=A0=A0 =A0No
=A0=A0=A0=A0=A0=A0=A0 LINKING?=A0=A0 =A0No
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 On Unix systems, did you run make realcle=
an first?=A0=A0 =A0Yes
=A0=A0=A0=A0=A0=A0=A0 EXECUTION?=A0=A0 =A0Yes
=A0=A0=A0=A0=A0=A0=A0 OTHER (please specify)?
[Please indicate whether ACE, your application, or both are affected.]
SYNOPSIS: ACE_DEBUG macro truncates the last character in the message if th=
e message is ACE_MAXLOGMSGLEN
characters long
DESCRIPTION:=A0 If message of size is ACE_MAXLOGMSGLEN is logged, the last =
character is is not logged.=A0 Some history.=A0 We currently use ACE 5.60 r=
an into the logging issue in a different way.=A0 With the older version of =
ACE, the program would crash with the message
The following logged message is too long!
Abort (core dumped)
Once we upgraded to 6.0.1, the program no longer crashed, but the last char=
acter in the message was dropped
=A0=A0=A0 REPEAT BY: Compile and run the program=20
=A0=A0 =A0char cArray[ACE_MAXLOGMSGLEN + 1] =3D { 0 };
=A0 =A0=A0=A0 =A0for (int var =3D 0; var < (ACE_MAXLOGMSGLEN - 1); ++var)
=A0 =A0=A0=A0 =A0{
=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0cArray[var] =3D 'h';
=A0 =A0=A0=A0 =A0}
=A0 =A0=A0=A0 =A0cArray[ACE_MAXLOGMSGLEN - 1] =3D 'd';
=A0 =A0=A0=A0 =A0cArray[ACE_MAXLOGMSGLEN] =3D 0x0;
=A0 =A0=A0=A0 =A0ACE_DEBUG((LM_DEBUG, "%s\n", cArray));
=A0=A0 =A0The character d will be missing in the log output
=A0=A0=A0 SAMPLE FIX/WORKAROUND:
=A0=A0 =A0Change the line
=A0=A0 =A0size_t bspace =3D ACE_MAXLOGMSGLEN;=A0 // Leave room for Nul term=
.. to
=A0=A0 =A0size_t bspace =3D ACE_Log_Record::MAXLOGMSGLEN;=A0 // Leave room =
for Nul term. as it was on ACE 5.6 and=20
=A0=A0 =A0Change the line
=A0=A0 =A0while (*format_str !=3D '\0' && bspace > 0) to
=A0=A0 =A0while (*format_str !=3D '\0' && bspace > 1)
=A0=A0 =A0
=A0=A0 =A0On the Linux version we use, snprintf and by extension vsnprintf =
return the number that would have been written had the =A0=A0 =A0array been=
suffciently large excluding the null byte.=A0 So when bspace was changed f=
rom 4097 (ACE_Log_Record::MAXLOGMSGLEN) =A0=A0 =A0=A0=A0 =A0to 4096 (ACE_MA=
XLOGMSGLEN), the last character was dropped to create space for null
=A0=A0 =A0To prevent the crash and to leave room for null the while loop sh=
ould terminate when one space left in the array msg_. =A0
=A0=A0 =A0These changes pass the sample code.
=0A=0A=0A
--0-2078824251-1301106925=:36147
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
<table cellspacing=3D"0" cellpadding=3D"0" border=3D"0" ><tr><td valign=3D"=
top" style=3D"font: inherit;">ACE VERSION: 6.0.1<br><br>HOST MACHINE and OP=
ERATING SYSTEM:<br> DELL precision 690 running CentOS 4.9=
.. Kernel 2.6.9-100.ELsmp #1 SMP Fri Feb 18 02:12:11 EST 2011 x86_64<br><br>=
TARGET MACHINE and OPERATING SYSTEM, if different from HOST: Same as =
host<br><br>COMPILER NAME AND VERSION (AND PATCHLEVEL): g++4 (G=
CC) 4.1.2 20080704 (Red Hat 4.1.2-44)<br><br>THE $ACE_ROOT/ace/config.h FIL=
E [if you use a link to a platform-<br> specific file, si=
mply state which one]: config.h -> config-linux.h<br><br>&nb=
sp; THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE =
[if you<br> use a link to a platform-specific file, simpl=
y state which one<br> (unless this isn't used in this cas=
e, e.g., with Microsoft Visual<br> C++)]:
platform_macros.GNU -> platform_linux.GNU<br><=
br>BUILD METHOD USED:<br>[Experimental ./configure or traditional makefile/=
project file?] traditional makefile<br><br>CONTENTS OF $ACE_ROO=
T/bin/MakeProjectCreator/config/default.features<br> (use=
d by MPC when you generate your own makefiles):<br><br> A=
REA/CLASS/EXAMPLE AFFECTED: ACE logging<br><br> DOE=
S THE PROBLEM AFFECT:<br> COMPILA=
TION? No<br> LI=
NKING? No<br> &n=
bsp; On Unix systems, did you run make realclean first?&n=
bsp; Yes<br> EXECUTIO=
N? Yes<br> OTHE=
R (please specify)?<br>[Please indicate whether ACE, your
application, or both are affected.]<br><br>SYNOPSIS: ACE_DEBUG macro trunc=
ates the last character in the message if the message is ACE_MAXLOGMSGLEN<b=
r>characters long<br><br>DESCRIPTION: If message of size is ACE_MAXLO=
GMSGLEN is logged, the last character is is not logged. Some history.=
We currently use ACE 5.60 ran into the logging issue in a different =
way. With the older version of ACE, the program would crash with the =
message<br><br>The following logged message is too long!<br>Abort (core dum=
ped)<br><br>Once we upgraded to 6.0.1, the program no longer crashed, but t=
he last character in the message was dropped<br><br><br> =
REPEAT BY: Compile and run the program <br><br> char cArr=
ay[ACE_MAXLOGMSGLEN + 1] =3D { 0 };<br><br> =
for (int var =3D 0; var < (ACE_MAXLOGMSGLEN - 1); ++var)<br>  =
; {<br>
cArray[var] =3D 'h';<br> =
}<br> cArray[ACE_MAXLOGMSGLEN - 1] =
=3D 'd';<br> cArray[ACE_MAXLOGMSGLEN] =3D 0x=
0;<br> ACE_DEBUG((LM_DEBUG, "%s\n", cArray))=
;<br><br> The character d will be missing in the log outp=
ut<br><br> SAMPLE FIX/WORKAROUND:<br><br> &nb=
sp;Change the line<br> size_t bspace =3D ACE_MAXLOGMSGLEN=
; // Leave room for Nul term. to<br> size_t bspace =
=3D ACE_Log_Record::MAXLOGMSGLEN; // Leave room for Nul term. as it w=
as on ACE 5.6 and <br><br> Change the line<br>  =
; while (*format_str !=3D '\0' && bspace > 0) to<br> =
while (*format_str !=3D '\0' && bspace > 1)<br>&nbs=
p; <br> On the Linux version we use, snprintf=
and by
extension vsnprintf return the number that would have been written had the=
array been suffciently large excluding the null byte.&n=
bsp; So when bspace was changed from 4097 (ACE_Log_Record::MAXLOGMSGLEN) &n=
bsp; to 4096 (ACE_MAXLOGMSGLEN), the last ch=
aracter was dropped to create space for null<br><br> To p=
revent the crash and to leave room for null the while loop should terminate=
when one space left in the array msg_. <br><br> Th=
ese changes pass the sample code.<br><br></td></tr></table><br>=0A=0A
--0-2078824251-1301106925=:36147--
|