Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#55145 closed defect (fixed)

gawk @4.2.0 fails to build on PPC Tiger, Mac OS X 10.4.11, because void unsetenv() does not return an integer value for comparison

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: Schamschula (Marius Schamschula)
Priority: Normal Milestone:
Component: ports Version: 2.4.2
Keywords: tiger Cc:
Port: gawk

Description

This is the failure:

/opt/local/bin/gcc-apple-4.2 -std=gnu99 -DDEFPATH='".:/opt/local/share/awk"' -DDEFLIBPATH="\"/opt/local/lib/gawk\"" -DSHLIBEXT="\"so"\" -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR='"/opt/local/share/locale"' -I"./support" -I.   -I/opt/local/include -I/opt/local/include  -pipe -Os -arch ppc -DNDEBUG -MT builtin.o -MD -MP -MF .deps/builtin.Tpo -c -o builtin.o builtin.c
builtin.c: In function 'mktime_tz':
builtin.c:2068: error: void value not ignored as it ought to be
make[2]: *** [builtin.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_lang_gawk/gawk/work/gawk-4.2.0'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_lang_gawk/gawk/work/gawk-4.2.0'
make: *** [all] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_lang_gawk/gawk/work/gawk-4.2.0'

builtin.c has here:

 2049	static time_t
 2050	mktime_tz(struct tm *tm, const char *tzreq)
 2051	{
 2052		time_t ret;
 2053		char *tz = getenv("TZ");
 2054	
 2055		if (tz)
 2056			tz = estrdup(tz, strlen(tz));
 2057		if (setenv("TZ", tzreq, 1) < 0) {
 2058			warning(_("setenv(TZ, %s) failed (%s)"), tzreq, strerror(errno));
 2059			return -1;
 2060		}
 2061		tzset();
 2062		ret = mktime(tm);
 2063		if (tz) {
 2064			if (setenv("TZ", tz, 1) < 0)
 2065				fatal(_("setenv(TZ, %s) restoration failed (%s)"), tz, strerror(errno));
 2066			free(tz);
 2067		} else {
 2068			if (unsetenv("TZ") < 0)
 2069				fatal(_("unsetenv(TZ) failed (%s)"), strerror(errno));
 2070		}
 2071		tzset();
 2072		return ret;
 2073	}

The function unsetenv is defined in Tiger as:

void unsetenv(const char *);

Since tz obviously is empty (if (tz) is false, because mktime() or tzset() do not set "TZ"?), why try to unsetenv() it? Or what else is the purpose?

Attachments (1)

main.log (36.4 KB) - added by ballapete (Peter "Pete" Dyballa) 7 years ago.
Main.log from PPC Tiger

Download all attachments as: .zip

Change History (9)

Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Tiger

comment:1 Changed 7 years ago by Schamschula (Marius Schamschula)

According to the Leopard man page we have int unsetenv(const char *). I'm open to any suggestions of how to fix this for Tiger. Needless to say, I have no way of testing any such change.

comment:2 Changed 7 years ago by kencu (Ken)

will need a patch for tiger, if there is not already one out there.

here's how one project handled it <https://github.com/krb5/krb5/commit/83ef046b405dfad26538eeccc117e1ab178bdd91>

comment:3 Changed 7 years ago by kencu (Ken)

also worth looking at the Tiger headers, because sometimes you can get the newer definition by #defining an env var

comment:5 Changed 7 years ago by mf2k (Frank Schima)

Cc: mps@… removed
Owner: set to Schamschula
Status: newassigned

comment:6 Changed 7 years ago by ken-cunningham-webuse

Resolution: fixed
Status: assignedclosed

In 461d698f63ee63bcf3a229c785eeaa3ed5b88012/macports-ports:

gawk: fix build on Tiger

use newer definition of unsetenv
closes: #55145

comment:7 Changed 7 years ago by ken-cunningham-webuse

In 461d698f63ee63bcf3a229c785eeaa3ed5b88012/macports-ports:

gawk: fix build on Tiger

use newer definition of unsetenv
closes: #55145

comment:8 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Gawk built today.

Note: See TracTickets for help on using tickets.