Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#55242 closed defect (fixed)

gnupg2 @2.2.1 does not build on PPC Tiger, Mac OS X 10.4.11, because it assumes that unsetenv() returns an int

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: Mihai Moldovan <ionic@…>
Priority: Normal Milestone:
Component: ports Version: 2.4.2
Keywords: tiger Cc: jann@…
Port: gnupg2

Description

/opt/local/bin/gcc-apple-4.2 -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/opt/local/share/locale\" -DGNUPG_BINDIR="\"/opt/local/bin\"" -DGNUPG_LIBEXECDIR="\"/opt/local/libexec\"" -DGNUPG_LIBDIR="\"/opt/local/lib/gnupg\"" -DGNUPG_DATADIR="\"/opt/local/share/gnupg\"" -DGNUPG_SYSCONFDIR="\"/opt/local/etc/gnupg\"" -DGNUPG_LOCALSTATEDIR="\"/opt/local/var\""  -DGNUPG_DEFAULT_PINENTRY="\"/opt/local/bin/pinentry\""     -I/opt/local/include -I/opt/local/include -I/opt/local/include -I/opt/local/include -I/opt/local/include -DWITHOUT_NPTH=1 -Wall -Wno-pointer-sign -Wpointer-arith  -pipe -Os -arch ppc -MT libcommon_a-sysutils.o -MD -MP -MF .deps/libcommon_a-sysutils.Tpo -c -o libcommon_a-sysutils.o `test -f 'sysutils.c' || echo './'`sysutils.c
sysutils.c: In function 'gnupg_unsetenv':
sysutils.c:987: error: void value not ignored as it ought to be
make[3]: *** [libcommon_a-sysutils.o] Error 1
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_mail_gnupg2/gnupg2/work/gnupg-2.2.1/common'

The code in sysutil.c is:

  965	int
  966	gnupg_unsetenv (const char *name)
  967	{
  968	#ifdef HAVE_W32CE_SYSTEM
  969	  (void)name;
  970	  return 0;
  971	#else /*!W32CE*/
  972	# ifdef HAVE_W32_SYSTEM
  973	  /*  Windows maintains (at least) two sets of environment variables.
  974	      One set can be accessed by GetEnvironmentVariable and
  975	      SetEnvironmentVariable.  This set is inherited by the children.
  976	      The other set is maintained in the C runtime, and is accessed
  977	      using getenv and putenv.  We try to keep them in sync by
  978	      modifying both sets.  */
  979	  if (!SetEnvironmentVariable (name, NULL))
  980	    {
  981	      gpg_err_set_errno (EINVAL); /* (Might also be ENOMEM.) */
  982	      return -1;
  983	    }
  984	# endif /*W32*/
  985	
  986	# ifdef HAVE_UNSETENV
  987	  return unsetenv (name);
  988	# else /*!HAVE_UNSETENV*/
  989	  {
  990	    char *buf;
  991	
  992	    if (!name)
  993	      {
  994	        gpg_err_set_errno (EINVAL);
  995	        return -1;
  996	      }
  997	    buf = xtrystrdup (name);
  998	    if (!buf)
  999	      return -1;
 1000	#  if __GNUC__
 1001	#   warning no unsetenv - trying putenv but leaking memory.
 1002	#  endif
 1003	    return putenv (buf);
 1004	  }
 1005	# endif /*!HAVE_UNSETENV*/
 1006	#endif /*!W32CE*/
 1007	}

Tiger has setenv() and unsetenv(), but both return nothing, they are voids.

Attachments (2)

main.log (46.5 KB) - added by ballapete (Peter "Pete" Dyballa) 7 years ago.
main.log from PPC Tiger
stdlib.h (9.6 KB) - added by ballapete (Peter "Pete" Dyballa) 7 years ago.
/usr/include/stdlib.h 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 Ionic (Mihai Moldovan)

I'll try to fix this another way tomorrow. Can you provide me with the content of /usr/include/stdlib.h?

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

there is a #define that usually gives you the new behavior on Tiger. __DARWIN_UNIX03. I often use this to fix newer software on Tiger.

Someone has posted up almost all the Mac SDK's, so I forked it here <https://github.com/kencu/MacOSX-SDKs> if you're looking for them.

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

Attachment: stdlib.h added

/usr/include/stdlib.h from PPC Tiger

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

See: [461d698f63ee63bcf3a229c785eeaa3ed5b88012/macports-ports] for a fix for the same issue on a different port.

Last edited 7 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:4 in reply to:  2 Changed 7 years ago by Ionic (Mihai Moldovan)

Replying to kencu:

there is a #define that usually gives you the new behavior on Tiger. __DARWIN_UNIX03. I often use this to fix newer software on Tiger.

Yes, I was thinking along those lines.

Someone has posted up almost all the Mac SDK's, so I forked it here <https://github.com/kencu/MacOSX-SDKs> if you're looking for them.

Thanks, that's very useful to have!

comment:5 Changed 7 years ago by Mihai Moldovan <ionic@…>

Owner: set to Mihai Moldovan <ionic@…>
Resolution: fixed
Status: newclosed

In 0d7e9f2c5496c3058850712fc96567a4bcbfca34/macports-ports:

mail/gnupg2: use modern unsetenv() version on 10.4.

Fixes: #55242

comment:6 Changed 7 years ago by Ionic (Mihai Moldovan)

Cc: ionic@… removed

Remove CC. Owner is already set correctly.

comment:7 in reply to:  5 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Replying to Mihai Moldovan <ionic@…>:

It built here.

Note: See TracTickets for help on using tickets.