Mailing List Archive

problems w/patch 40a under IRIX
Re: problems w/patch 40a under IRIX [ In reply to ]
> There's no member tm_zone in a tm struct under IRIX 5.3. The 40a patch should
> take this into account. IRIX already maintains a valid $TZ environment
> variable. Linux also used to not have tm_zone in its tm struct, but I'm not
> sure if that's different now. Here's a crude suggestion (derived from
> Randy's patch):

I suspected as much....

The alternative would be to call genenv(TZ) for these systems that
don't have it in the tm struct. Does anyone else know if this
is available somewhere else on these systems?


> *** util_script.c.orig Sun Nov 19 12:50:50 1995
> --- util_script.c Sun Nov 19 12:55:50 1995
> ***************
> *** 103,112 ****
> {
> array_header *env_arr = table_elts (t);
> table_entry *elts = (table_entry *)env_arr->elts;
> ! char **env = (char **)palloc (p, (env_arr->nelts + 1) *sizeof (char *));
> ! int i, j;
> !
> ! for (i = 0, j = 0; i < env_arr->nelts; ++i) {
> if (!elts[i].key) continue;
> env[j++] = pstrcat (p, elts[i].key, "=", elts[i].val, NULL);
> }
> --- 103,122 ----
> {
> array_header *env_arr = table_elts (t);
> table_entry *elts = (table_entry *)env_arr->elts;
> ! char **env = (char **)palloc (p, (env_arr->nelts + 2) *sizeof (char *));
> ! int i,j;
> ! char *tz;
> ! time_t ts;
> ! struct tm *lt;
> !
> ! ts = time(NULL);
> ! lt = localtime(&ts);
> !#if !defined(IRIX) && !defined(LINUX)
> ! tz = lt->tm_zone;
> !#endif
> ! j = 0;
> ! if (tz != NULL) env[j++] = pstrcat(p, "TZ=", tz, NULL);
> ! for (i = 0; i < env_arr->nelts; ++i) {
> if (!elts[i].key) continue;
> env[j++] = pstrcat (p, elts[i].key, "=", elts[i].val, NULL);
> }
>
> chuck
> Chuck Murcko Telebase Systems, Inc. Wayne PA chuck@telebase.com
> And now, on a lighter note:
> Minors in Kansas City, Missouri, are not allowed to purchase cap
> pistols; they may buy shotguns freely, however.
Re: problems w/patch 40a under IRIX [ In reply to ]
As it looks like there is more work to making a patch people are happy
with, 40_tz will stay on the vote list but 40a won't be added. Save it
for next time...

Brian

--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com brian@hyperreal.com http://www.[hyperreal,organic].com/
Re: problems w/patch 40a under IRIX [ In reply to ]
>
> There's no member tm_zone in a tm struct under IRIX 5.3. The 40a patch should
> take this into account. IRIX already maintains a valid $TZ environment
> variable. Linux also used to not have tm_zone in its tm struct, but I'm not
> sure if that's different now. Here's a crude suggestion (derived from
> Randy's patch):
>
> *** util_script.c.orig Sun Nov 19 12:50:50 1995
> --- util_script.c Sun Nov 19 12:55:50 1995
> ***************
> *** 103,112 ****
> {
> array_header *env_arr = table_elts (t);
> table_entry *elts = (table_entry *)env_arr->elts;
> ! char **env = (char **)palloc (p, (env_arr->nelts + 1) *sizeof (char *));
> ! int i, j;
> !
> ! for (i = 0, j = 0; i < env_arr->nelts; ++i) {
> if (!elts[i].key) continue;
> env[j++] = pstrcat (p, elts[i].key, "=", elts[i].val, NULL);
> }
> --- 103,122 ----
> {
> array_header *env_arr = table_elts (t);
> table_entry *elts = (table_entry *)env_arr->elts;
> ! char **env = (char **)palloc (p, (env_arr->nelts + 2) *sizeof (char *));
> ! int i,j;
> ! char *tz;
> ! time_t ts;
> ! struct tm *lt;
> !
> ! ts = time(NULL);
> ! lt = localtime(&ts);
> !#if !defined(IRIX) && !defined(LINUX)
> ! tz = lt->tm_zone;
> !#endif
> ! j = 0;
> ! if (tz != NULL) env[j++] = pstrcat(p, "TZ=", tz, NULL);

Oops! tz is uninitialized at this point under Irix/Linux. Core dumps loom.

> ! for (i = 0; i < env_arr->nelts; ++i) {
> if (!elts[i].key) continue;
> env[j++] = pstrcat (p, elts[i].key, "=", elts[i].val, NULL);
> }

Cheers,

Ben.

--
Ben Laurie Phone: +44 (181) 994 6435
Freelance Consultant Fax: +44 (181) 994 6472
and Technical Director Email: ben@algroup.co.uk
A.L. Digital Ltd, URL: http://www.algroup.co.uk
London, England.
Re: problems w/patch 40a under IRIX [ In reply to ]
>
> There's no member tm_zone in a tm struct under IRIX 5.3. The 40a patch should
> take this into account. IRIX already maintains a valid $TZ environment
> variable. Linux also used to not have tm_zone in its tm struct, but I'm not
> sure if that's different now. Here's a crude suggestion (derived from
> Randy's patch):
>
> *** util_script.c.orig Sun Nov 19 12:50:50 1995
> --- util_script.c Sun Nov 19 12:55:50 1995
> ***************
> *** 103,112 ****
> {
> array_header *env_arr = table_elts (t);
> table_entry *elts = (table_entry *)env_arr->elts;
> ! char **env = (char **)palloc (p, (env_arr->nelts + 1) *sizeof (char *));
> ! int i, j;
> !
> ! for (i = 0, j = 0; i < env_arr->nelts; ++i) {
> if (!elts[i].key) continue;
> env[j++] = pstrcat (p, elts[i].key, "=", elts[i].val, NULL);
> }
> --- 103,122 ----
> {
> array_header *env_arr = table_elts (t);
> table_entry *elts = (table_entry *)env_arr->elts;
> ! char **env = (char **)palloc (p, (env_arr->nelts + 2) *sizeof (char *));
> ! int i,j;
> ! char *tz;
> ! time_t ts;
> ! struct tm *lt;
> !
> ! ts = time(NULL);
> ! lt = localtime(&ts);
> !#if !defined(IRIX) && !defined(LINUX)
> ! tz = lt->tm_zone;
> !#endif
> ! j = 0;
> ! if (tz != NULL) env[j++] = pstrcat(p, "TZ=", tz, NULL);
> ! for (i = 0; i < env_arr->nelts; ++i) {
> if (!elts[i].key) continue;
> env[j++] = pstrcat (p, elts[i].key, "=", elts[i].val, NULL);
> }
>

SCO doesn't have tm_zone, either, but it does have tm_name, or __tm_name.

Also, this code surely doesn't belong in create_environment() ... its rightful
place must be in add_common_vars() (or similar).

Cheers,

Ben.

--
Ben Laurie Phone: +44 (181) 994 6435
Freelance Consultant Fax: +44 (181) 994 6472
and Technical Director Email: ben@algroup.co.uk
A.L. Digital Ltd, URL: http://www.algroup.co.uk
London, England.
Re: problems w/patch 40a under IRIX [ In reply to ]
Re: problems w/patch 40a under IRIX [ In reply to ]
>
> Ben Laurie liltingly intones:
> >
> > >
> > > There's no member tm_zone in a tm struct under IRIX 5.3. The 40a patch should
> > > take this into account. IRIX already maintains a valid $TZ environment
> > > variable. Linux also used to not have tm_zone in its tm struct, but I'm not
> > > sure if that's different now. Here's a crude suggestion (derived from
> > > Randy's patch):
> > >
> > > *** util_script.c.orig Sun Nov 19 12:50:50 1995
> > > --- util_script.c Sun Nov 19 12:55:50 1995
> > > ***************
> > > *** 103,112 ****
> > > {
> > > array_header *env_arr = table_elts (t);
> > > table_entry *elts = (table_entry *)env_arr->elts;
> > > ! char **env = (char **)palloc (p, (env_arr->nelts + 1) *sizeof (char *));
> > > ! int i, j;
> > > !
> > > ! for (i = 0, j = 0; i < env_arr->nelts; ++i) {
> > > if (!elts[i].key) continue;
> > > env[j++] = pstrcat (p, elts[i].key, "=", elts[i].val, NULL);
> > > }
> > > --- 103,122 ----
> > > {
> > > array_header *env_arr = table_elts (t);
> > > table_entry *elts = (table_entry *)env_arr->elts;
> > > ! char **env = (char **)palloc (p, (env_arr->nelts + 2) *sizeof (char *));
> > > ! int i,j;
> > > ! char *tz;
> > > ! time_t ts;
> > > ! struct tm *lt;
> > > !
> > > ! ts = time(NULL);
> > > ! lt = localtime(&ts);
> > > !#if !defined(IRIX) && !defined(LINUX)
> > > ! tz = lt->tm_zone;
> > > !#endif
> > > ! j = 0;
> > > ! if (tz != NULL) env[j++] = pstrcat(p, "TZ=", tz, NULL);
> >
> > Oops! tz is uninitialized at this point under Irix/Linux. Core dumps loom.
>
> Modern compilers will init tz to NULL. Were this an actual patch I would
> do it explicitly in the tz declaration, to be safe.

Really? I very much doubt it. It is not in the spec (in fact, it is explicitly
not in the spec), and _none_ of my compilers do it, nor would I expect them
to. Only statics (in the widest sense) are initialized to NULL.

> >
> > > ! for (i = 0; i < env_arr->nelts; ++i) {
> > > if (!elts[i].key) continue;
> > > env[j++] = pstrcat (p, elts[i].key, "=", elts[i].val, NULL);
> > > }
> >
>
> chuck
> Chuck Murcko Telebase Systems, Inc. Wayne PA chuck@telebase.com
> And now, on a lighter note:
> You have the body of a 19 year old. Please return it before it gets
> wrinkled.

--
Ben Laurie Phone: +44 (181) 994 6435
Freelance Consultant Fax: +44 (181) 994 6472
and Technical Director Email: ben@algroup.co.uk
A.L. Digital Ltd, URL: http://www.algroup.co.uk
London, England.
Re: problems w/patch 40a under IRIX [ In reply to ]
>
> Ben Laurie liltingly intones:
> >
> > >
> > > There's no member tm_zone in a tm struct under IRIX 5.3. The 40a patch should
> > > take this into account. IRIX already maintains a valid $TZ environment
> > > variable. Linux also used to not have tm_zone in its tm struct, but I'm not
> > > sure if that's different now. Here's a crude suggestion (derived from
> > > Randy's patch):
> > >
> > > *** util_script.c.orig Sun Nov 19 12:50:50 1995
> > > --- util_script.c Sun Nov 19 12:55:50 1995
> > > ***************
> > > *** 103,112 ****
> > > {
> > > array_header *env_arr = table_elts (t);
> > > table_entry *elts = (table_entry *)env_arr->elts;
> > > ! char **env = (char **)palloc (p, (env_arr->nelts + 1) *sizeof (char *));
> > > ! int i, j;
> > > !
> > > ! for (i = 0, j = 0; i < env_arr->nelts; ++i) {
> > > if (!elts[i].key) continue;
> > > env[j++] = pstrcat (p, elts[i].key, "=", elts[i].val, NULL);
> > > }
> > > --- 103,122 ----
> > > {
> > > array_header *env_arr = table_elts (t);
> > > table_entry *elts = (table_entry *)env_arr->elts;
> > > ! char **env = (char **)palloc (p, (env_arr->nelts + 2) *sizeof (char *));
> > > ! int i,j;
> > > ! char *tz;
> > > ! time_t ts;
> > > ! struct tm *lt;
> > > !
> > > ! ts = time(NULL);
> > > ! lt = localtime(&ts);
> > > !#if !defined(IRIX) && !defined(LINUX)
> > > ! tz = lt->tm_zone;
> > > !#endif
> > > ! j = 0;
> > > ! if (tz != NULL) env[j++] = pstrcat(p, "TZ=", tz, NULL);
> >
> > Oops! tz is uninitialized at this point under Irix/Linux. Core dumps loom.
>
> Modern compilers will init tz to NULL. Were this an actual patch I would
> do it explicitly in the tz declaration, to be safe.

Really? I very much doubt it. It is not in the spec (in fact, it is explicitly
not in the spec), and _none_ of my compilers do it, nor would I expect them
to. Only statics (in the widest sense) are initialized to NULL.

> >
> > > ! for (i = 0; i < env_arr->nelts; ++i) {
> > > if (!elts[i].key) continue;
> > > env[j++] = pstrcat (p, elts[i].key, "=", elts[i].val, NULL);
> > > }
> >
>
> chuck
> Chuck Murcko Telebase Systems, Inc. Wayne PA chuck@telebase.com
> And now, on a lighter note:
> You have the body of a 19 year old. Please return it before it gets
> wrinkled.

--
Ben Laurie Phone: +44 (181) 994 6435
Freelance Consultant Fax: +44 (181) 994 6472
and Technical Director Email: ben@algroup.co.uk
A.L. Digital Ltd, URL: http://www.algroup.co.uk
London, England.
Re: problems w/patch 40a under IRIX [ In reply to ]