Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix messed up libgcrypt package #6758

Closed
sagetrac-drkirkby mannequin opened this issue Aug 16, 2009 · 9 comments
Closed

fix messed up libgcrypt package #6758

sagetrac-drkirkby mannequin opened this issue Aug 16, 2009 · 9 comments

Comments

@sagetrac-drkirkby
Copy link
Mannequin

sagetrac-drkirkby mannequin commented Aug 16, 2009

I tried to use the Sun compiler to build Sage. Since it's more fussy that gcc, it is showing as an error


Making all in src
make[4]: Entering directory `/export/home/drkirkby/sage/suncc/sage-4.1.1/spkg/build/libgcrypt-1.4.3.p1/src/src'
source='visibility.c' object='libgcrypt_la-visibility.lo' libtool=yes \
DEPDIR=.deps depmode=none /bin/bash ../depcomp \
/bin/bash ../libtool --tag=CC   --mode=compile /opt/sunstudio12.1/bin/cc -DHAVE_CONFIG_H -I. -I..   -I/export/home/drkirkby/sage/suncc/sage-4.1.1/local/include -I/export/home/drkirkby/sage/suncc/sage-4.1.1/local/include -g -c -o libgcrypt_la-visibility.lo `test -f 'visibility.c' || echo './'`visibility.c
mkdir .libs
 /opt/sunstudio12.1/bin/cc -DHAVE_CONFIG_H -I. -I.. -I/export/home/drkirkby/sage/suncc/sage-4.1.1/local/include -I/export/home/drkirkby/sage/suncc/sage-4.1.1/local/include -g -c visibility.c  -KPIC -DPIC -o .libs/libgcrypt_la-visibility.o
"visibility.c", line 702: void function cannot return value
"visibility.c", line 851: void function cannot return value
cc: acomp failed for visibility.c

The dodgy bits of code are:

void
gcry_md_hash_buffer (int algo, void *digest,
                     const void *buffer, size_t length)
{
  return _gcry_md_hash_buffer (algo, digest, buffer, length);
}

and

void
gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
                    gcry_ac_io_type_t type, va_list ap)
{
  return _gcry_ac_io_init_va (ac_io, mode, type, ap);
}

The Sun compiler will not accept this, and so exits, aborting the build of Sage.

Note there are license issues with libgcrypt too - it is GPL 3. See #6757

Dave

CC: @sagetrac-mvngu @sagetrac-drkirkby

Component: cryptography

Author: David Kirkby, Minh Van Nguyen

Issue created by migration from https://trac.sagemath.org/ticket/6758

@sagetrac-drkirkby sagetrac-drkirkby mannequin added this to the sage-4.1.2 milestone Aug 16, 2009
@sagetrac-drkirkby
Copy link
Mannequin Author

sagetrac-drkirkby mannequin commented Aug 16, 2009

comment:1

By looking at the latest source code for libgcrypt this code has been changed. It would appear the intension was to just execute the functions _gcry_md_hash_buffer and _gcry_ac_io_init_va, but not return their value. Here are the relevant functions from the latest release (1.4.4):

void
gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
                    gcry_ac_io_type_t type, va_list ap)
{
  _gcry_ac_io_init_va (ac_io, mode, type, ap);
}

The code for function gcry_md_hash_buffer has changed a little more, but it is obvious the intension here two was to execute _gcry_md_hash_buffer and not return the value.


void
gcry_md_hash_buffer (int algo, void *digest,
                     const void *buffer, size_t length)
{
  if (!fips_is_operational ())
    {
      (void)fips_not_operational ();
      fips_signal_error ("called in non-operational state");
    }
  _gcry_md_hash_buffer (algo, digest, buffer, length);
}

So I removed the 'return' from the code in Sage, and made a patch. Since this is just buggy code, and not-Solaris specific, I've made the patch on all platforms. It is only seen on Solaris with the Sun compiler, as the Sun compiler is more fussy than gcc.

See: http://sage.math.washington.edu/home/kirkby/Solaris-fixes/libgcrypt-1.4.3.p2/

Sinve there are some license issues here, I have not updated the package. This code currently in Sage is GPL3 - see #6757

Dave

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 2, 2009

comment:2

After uncompressing the spkg

http://sage.math.washington.edu/home/kirkby/Solaris-fixes/libgcrypt-1.4.3.p2/libgcrypt-1.4.3.p2.spkg

I see that it contains two copies of libgcrypt: one in the src (version 1.4.0) directory and another copy in src/libgcrypt-1.4.3. Any reason why we need two different versions in the spkg?

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 17, 2009

comment:3

This needs work as the updated libgcrypt spkg is seriously messed up --- it has two different versions of libgcrypt.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 18, 2009

comment:4

An updated spkg is up at

http://sage.math.washington.edu/home/mvngu/release/spkg/standard/libgcrypt-1.4.3.p2.spkg

This package incorporates David Kirkby's changes in

http://sage.math.washington.edu/home/kirkby/Solaris-fixes/libgcrypt-1.4.3.p2/libgcrypt-1.4.3.p2.spkg

but leaves out the fixes for the dodgy bits of code since these have been fixed in libgcrypt 1.4.3. I deleted the patches/ directory. Changes have been committed in David's name.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 18, 2009

Author: David Kirkby, Minh Van Nguyen

@sagetrac-mvngu sagetrac-mvngu mannequin changed the title visibility.c in libgcrypt attempts to return value from void function. fix messed up libgcrypt package Sep 18, 2009
@sagetrac-drkirkby
Copy link
Mannequin Author

sagetrac-drkirkby mannequin commented Sep 27, 2009

comment:6

Minh

Something is wrong here. Your revised version will not build with the Sun compiler. It gives the errors:

"visibility.c", line 702: void function cannot return value
"visibility.c", line 851: void function cannot return value

as it does not contain my fixes. (I appreciate I screwed up the package first).

I believe the best solution is to forget about 1.4.3.p2 entirely, and produce a 1.4.4. Despite the web site saying 1.4.4 is GPL3, the code clearly has a GPL2 'COPYING' file.

Dave

@sagetrac-drkirkby
Copy link
Mannequin Author

sagetrac-drkirkby mannequin commented Sep 28, 2009

comment:7

#7045 has an update to the 1.4.4 release. No changes to the source were necessary for this to build with Sun Studio 12.1

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 28, 2009

comment:8

Replying to @sagetrac-drkirkby:

Something is wrong here. Your revised version will not build with the Sun compiler. It gives the errors:

"visibility.c", line 702: void function cannot return value
"visibility.c", line 851: void function cannot return value

as it does not contain my fixes.

Greatly appreciated that you caught this issue!

(I appreciate I screwed up the package first).

I believe you didn't mess up the package. It was messed up even before the start of the 4.x series.

I believe the best solution is to forget about 1.4.3.p2 entirely, and produce a 1.4.4. Despite the web site saying 1.4.4 is GPL3, the code clearly has a GPL2 'COPYING' file.

Yes, that sounds reasonable. I usually go for the license file in the source tarball myself and also check on the project website.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 28, 2009

comment:9

We should upgrade to libgcrypt 1.4.4 and not worry about libgcrypt 1.4.3 any longer. See ticket #7045 for this.

@sagetrac-mvngu sagetrac-mvngu mannequin added r: wontfix and removed p: major / 3 labels Sep 28, 2009
@sagetrac-mvngu sagetrac-mvngu mannequin removed this from the sage-4.1.2 milestone Sep 28, 2009
@sagetrac-mvngu sagetrac-mvngu mannequin removed the s: needs review label Sep 28, 2009
@sagetrac-mvngu sagetrac-mvngu mannequin closed this as completed Sep 28, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants