Re: To 'C' or not to 'C' ... now what the hell to I do?
- From: "Craig A. Berry" <craigberry@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 21 Jan 2008 22:49:40 -0600
In article <4794f341$0$90263$14726298@xxxxxxxxxxxxxxx>,
Arne Vajhøj <arne@xxxxxxxxxx> wrote:
VAXman- @SendSpamHere.ORG wrote:
It does and I found it! It wasn't in the application but in the program
used to generate the regression data and the problem is already document-
ed in the release notes of the VMS83A_ACRTL-V0400 patch:
5.2.5 Function mktime() Fix
5.2.5.1 Problem Description:
Modules compiled under OpenVMS version 7.3-2 use the
short version of struct tm when making a call to mktime()
on an OpenVMs version 8.3 system. The mktime() API
internally creates a temporary copy of a struct tm then
calls localtime_r(). In our environment, the module
containing the mktime() function was compiled using 8.3
semantics. This resulted in a longer struct tm.
At the end of the mktime() function the temporary struct
tm is copied onto the input struct tm. This results in
copying a longer struct tm over a short struct tm.
I needed to find it first before applying any patch. I changed the code
in the regression test to add some padding after the tm struct where it
is called out. The bug in the mktime() was writing over a variable that
was eventually used in the length of a descriptor. The code was actually
compiled well before V7.3-2. The tm struct was 36 bytes in length and the
new tm is 44 bytes -- 2 longwords longer.
That is a really bad thing they did there.
In reality it means that any program that uses struct tm need to be
rebuild when moved from VMS 7.3-2 to 8.3 !
Very non-VMSish !
Well, this goof apparently consisted of merely compiling one module in
the CRTL with the standard headers. Look at the following sections from
time.h:
** - Future VMS releases will get a longer tm structure possibly with
** changed/filler names, to make all objects of tm the same length,
** which may force recompilation of all modules using tm.
** - Macro _TM_SHORT will force short tm
** - Macro _TM_LONG will force long tm
**
[and later]
# if __CRTL_VER >= 80300000 || defined _TM_LONG || \
defined __TM_CXX_NEED_FILLER_NAMES
/* Longer tm, but non-polluting BSD member names */
# define __TM_DEF_BSD_FILLER_NAMES
[and later still]
#elif defined __TM_DEF_BSD_FILLER_NAMES
/* BSD tm member extensions, non-polluting namespace */
long __tm_gmtoff; /* offset from UTC in seconds */
char *__tm_zone; /* timezone abbreviation */
So clearly compiling under v8.3 gives you a couple more structure
members than you would have had before, at least unless you had
explicitly defined the _TM_LONG macro before.
I suspect that it's much harder, if not impossible, to build a v8.3
CRTL on older VMS versions than has been the case in some eras. So
many of the new goodies depend on OS features, RMS features, etc. They
did make a mistake in not preserving upward compatibility, but I can
see how it happened. I was hoping that this meant the 2038 bug had
been fixed for anything compiled on v8.3 and later, but that appears to
be unrelated and will be another compatibility rat's nest in our
future.
--
Posted via a free Usenet account from http://www.teranews.com
.
- Follow-Ups:
- Re: To 'C' or not to 'C' ... now what the hell to I do?
- From: yyyc186
- Re: To 'C' or not to 'C' ... now what the hell to I do?
- From: Arne Vajhøj
- Re: To 'C' or not to 'C' ... now what the hell to I do?
- References:
- Re: To 'C' or not to 'C' ... now what the hell to I do?
- From: Hein RMS van den Heuvel
- Re: To 'C' or not to 'C' ... now what the hell to I do?
- From: David Weatherall
- Re: To 'C' or not to 'C' ... now what the hell to I do?
- From: Arne Vajhøj
- Re: To 'C' or not to 'C' ... now what the hell to I do?
- From: Arne Vajhøj
- Re: To 'C' or not to 'C' ... now what the hell to I do?
- Prev by Date: Re: Send mail without a file
- Next by Date: Re: F$UNIQUE library function
- Previous by thread: Re: To 'C' or not to 'C' ... now what the hell to I do?
- Next by thread: Re: To 'C' or not to 'C' ... now what the hell to I do?
- Index(es):
Relevant Pages
|