Bug 919703

Summary: Review Request: libgap - libGAP -- a C library version of the GAP kernel
Product: [Fedora] Fedora Reporter: Paulo Andrade <paulo.cesar.pereira.de.andrade>
Component: Package ReviewAssignee: Jerry James <loganjerry>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: i, loganjerry, notting, package-review, paulo.cesar.pereira.de.andrade, vbraun.name
Target Milestone: ---Flags: loganjerry: fedora-review+
gwync: fedora-cvs+
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libgap-4.6.5-3.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-15 06:37:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Fixed spec file. none

Description Paulo Andrade 2013-03-09 17:19:12 UTC
Spec URL: http://pcpa.fedorapeople.org/libgap.spec
SRPM URL: http://pcpa.fedorapeople.org/libgap-4.5.7-1.fc19.src.rpm
Description: LibGAP -- a C library version of the GAP kernel (http://www.gap-system.org)

LibGAP is essentially a fork of the upstream GAP kernel. It is developed
in its own repository at https://bitbucket.org/vbraun/libgap. This is
also where the spkg metadata is tracked.
Fedora Account System Username: pcpa

Comment 1 Christopher Meng 2013-05-08 16:09:49 UTC
1)Source0 URL is unreachable;

2)Summary is not good, try this:

"Summary:	A C library version of the GAP kernel"

3)Is there any doc for devel package?

4)In %install section I often use this:

find %{buildroot} -name '*.la' -exec rm -f {} ';'

Comment 2 Paulo Andrade 2013-05-20 20:00:45 UTC
Adding Volker Braun (libgap author) and Jerry James (gap Fedora maintainer)
to CC. Actually, I was expecting them to maintain it when I found that
it would require coordinating with the gap package (but I can try work
on it again shortly also).

About missing tarball, upstream is now the sagemath spkg:
https://bitbucket.org/vbraun/libgap/issue/1/please-make-tarball-downloads-available

Currently I have two patches in the sagemath package, one, default,
to disable libgap:
http://pkgs.fedoraproject.org/cgit/sagemath.git/tree/sagemath-nolibgap.patch
and another to "correct" build/runtime with libgap:
http://pkgs.fedoraproject.org/cgit/sagemath.git/tree/sagemath-libgap.patch

Comment 3 Jerry James 2013-05-31 21:15:10 UTC
Sorry, Real Life has been extremely busy lately, leaving me little time to work on all of my unfinished Fedora projects.

Issues, in no particular order:
1. This package mimics GAP itself by using a configure script that assumes
   that sigsetjmp() is a function.  Since it is a macro, the configure test
   fails.  A variation on the sed expression I used for GAP fixes this
   problem, although you may prefer a patch.  Better yet would be to get the
   two upstreams to fix their configure scripts.

   sed -i '/sigsetjmp/,/_ACEOF/s/^ac_fn_c_check_func.*/if [ $ac_func = sigsetjmp ]; then\nac_fn_c_check_func "$LINENO" "__sigsetjmp" "$as_ac_var";\nelse\n&\nfi/' -i src/configure

2. I supply a value for SYS_DEFAULT_PATHS for GAP.  Would that be appropriate
   here, too?  (Grep for SYS_DEFAULT_PATHS in the libgap sources.)  If so, you
   perhaps want to pass -DSYS_DEFAULT_PATHS=%{_gap_dir}.

3. I also see lots of code guarded by #if HAVE_LIBREADLINE, but no configure
   test for readline.  Should this package BR libreadline-devel and pass
   -DHAVE_LIBREADLINE to the compiler?

4. Upstream needs to add #include <stdio.h> to libgap.c and error_handler.c:

libgap.c: In function 'libgap_call_error_handler':
libgap.c:156:5: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
libgap.c:156:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]

error_handler.c: In function 'handler':
error_handler.c:8:3: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
error_handler.c:8:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]

5. This happens because LIBGAP_SIGNALS is not defined:

sysfiles.c:3268:39: warning: 'func2' is used uninitialized in this function [-Wuninitialized]
sysfiles.c:3249:27: note: 'func2' was declared here

6. Some tests are failing with a segfault, but since the test program returns
   0 in every case, %check doesn't notice.  Can you find some way of causing
   %check to fail if some of the tests fail?

make[2]: Entering directory `/builddir/build/BUILD/libgap-4.5.7/src/test'
--------------------
Input: 1 + CyclicGroup(2);
Error: Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `+' on 2 arguments
Caught signal 11
signal caught
...
Input: 1/0;
Error: Error, Rational operations: <divisor> must not be zero
Caught signal 11
signal caught
...
Input: if 4>3 then
Print("hi
");
 fi;
Caught signal 11
signal caught

7. There is 1 download on the libGAP web page, "libGAP (2).pdf", which
   contains a slideshow about libGAP.  Is that worth including as %doc?

8. The actual license covering this project is in doubt.  It includes a
   COPYING file that contains the text of the GPLv3, but there is no statement
   anywhere in the code or on the web site that identifies that license, at
   least not that I have been able to find.  The project incorporates code
   from GAP, which is GPLv2+.  According to the "GNU General Public License
   (no version)" entry in this table:

   https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses

   the lack of a statement means that the project is covered by any version of
   the GPL.  However, since it incorporates known GPLv2+ code, I think the
   correct license for this project is also GPLv2+.  Upstream should clarify
   this.

9. This package is for version 4.5.7, which is needed for Fedora 18.  However,
   for F-19 and later, a version that supports GAP 4.6 is needed.  On 25 Apr
   2013, a commit was made upstream to support gap 4.6.3.

10. The package summary should not repeat the name of the package.  In this
    case, I suggest "C library version of the GAP kernel".  If you change it,
    be sure to update the name of the bug also.

11. The undefined non-weak symbols reported at the end of this report show
    that the library needs to be linked with -lm.  This can be accomplished
    like this:

    %configure --enable-shared --disable-static LIBS="-lm"

12. The unused direct shlib dependency on libgmp reported at the end shows
    another problem: GMP is detected, but not actually used.  I think you need
    to add -DUSE_GMP to CFLAGS for that to happen.  This smells like an
    upstream bug to me, but upstream may differ. :-)

Package Review
==============

Legend:
[x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated
[ ] = Manual review needed



===== MUST items =====

C/C++:
[x]: Package does not contain kernel modules.
[x]: Package contains no static executables.
[x]: Header files in -devel subpackage, if present.
[x]: ldconfig called in %post and %postun if required.
[x]: Package does not contain any libtool archives (.la)
[x]: Rpath absent or only used for internal libs.
[x]: Development (unversioned) .so files in -devel subpackage, if present.

Generic:
[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[x]: %build honors applicable compiler flags or justifies otherwise.
[x]: Package contains no bundled libraries without FPC exception.
[x]: Changelog in prescribed format.
[x]: Sources contain only permissible code or content.
[x]: Package contains desktop file if it is a GUI application.
[x]: Development files must be in a -devel package
[x]: Package requires other packages for directories it uses.
[x]: Package uses nothing in %doc for runtime.
[x]: Package is not known to require ExcludeArch.
[x]: Package complies to the Packaging Guidelines
[!]: License field in the package spec file matches the actual license.
     See issue #8 above.
[x]: License file installed when any subpackage combination is installed.
[x]: Package consistently uses macro is (instead of hard-coded directory
     names).
[x]: Package is named according to the Package Naming Guidelines.
[x]: Package does not generate any conflict.
[x]: Package obeys FHS, except libexecdir and /usr/target.
[x]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[x]: Package must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[x]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[x]: Package contains systemd file(s) if in need.
[x]: Useful -debuginfo package or justification otherwise.
[x]: Large documentation must go in a -doc subpackage.
     Note: Documentation size is 40960 bytes in 2 files.
[x]: All build dependencies are listed in BuildRequires, except for any that
     are listed in the exceptions section of Packaging Guidelines.
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Each %files section contains %defattr if rpm < 4.4
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Fully versioned dependency in subpackages, if present.
[x]: If (and only if) the source package includes the text of the license(s)
     in its own file, then that file, containing the text of the license(s)
     for the package is included in %doc.
[x]: Package use %makeinstall only when make install' ' DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package do not use a name that already exist
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as provided
     in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: Packages must not store files under /srv, /opt or /usr/local
[x]: Package successfully compiles and builds into binary rpms on at least one
     supported primary architecture.
[x]: Package installs properly.
[x]: Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).

===== SHOULD items =====

Generic:
[!]: Sources can be downloaded from URI in Source: tag
     Note: Could not download Source0
[x]: If the source package does not include license text(s) as a separate file
     from upstream, the packager SHOULD query upstream to include it.
[x]: Final provides and requires are sane (see attachments).
[?]: Package functions as described.
[!]: Latest version is packaged.
     See issue #9 above.
[x]: Package does not include license text files separate from upstream.
[x]: Patches link to upstream bugs/comments/lists or are otherwise justified.
[x]: Scriptlets must be sane, if used.
[x]: Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[x]: Package should compile and build into binary rpms on all supported
     architectures.
[!]: %check is present and all tests pass.
     See issue #6 above.
[x]: Packages should try to preserve timestamps of original installed files.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Reviewer should test that the package builds in mock.
[x]: Buildroot is not present
[x]: Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
[x]: Dist tag is present.
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Uses parallel make.
[x]: SourceX tarball generation or download is documented.
[x]: SourceX is a working URL.
[x]: Spec use %global instead of %define.

===== EXTRA items =====

Generic:
[x]: Large data in /usr/share should live in a noarch subpackage if package is
     arched.
[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).
[x]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
Checking: libgap-4.5.7-1.fc18.x86_64.rpm
          libgap-devel-4.5.7-1.fc18.x86_64.rpm
libgap.x86_64: W: summary-not-capitalized C libGAP -- a C library version of the GAP kernel
libgap.x86_64: W: name-repeated-in-summary C libGAP
libgap.x86_64: W: spelling-error %description -l en_US spkg -> pkg, s pkg
libgap.x86_64: W: spelling-error %description -l en_US metadata -> meta data, meta-data, metatarsi
libgap-devel.x86_64: W: no-documentation
2 packages and 0 specfiles checked; 0 errors, 5 warnings.




Rpmlint (installed packages)
----------------------------
# rpmlint libgap-devel libgap
libgap-devel.x86_64: W: no-documentation
libgap.x86_64: W: summary-not-capitalized C libGAP -- a C library version of the GAP kernel
libgap.x86_64: W: name-repeated-in-summary C libGAP
libgap.x86_64: W: spelling-error %description -l en_US spkg -> pkg, s pkg
libgap.x86_64: W: spelling-error %description -l en_US metadata -> meta data, meta-data, metatarsi
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 ceil
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 atan2
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 fmod
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 acos
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 sin
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 rint
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 atan
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 asin
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 hypot
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 exp
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 tan
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 cos
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 log
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 pow
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 sqrt
libgap.x86_64: W: undefined-non-weak-symbol /usr/lib64/libgap.so.0.0.0 floor
libgap.x86_64: W: unused-direct-shlib-dependency /usr/lib64/libgap.so.0.0.0 /lib64/libgmp.so.10
2 packages and 0 specfiles checked; 0 errors, 22 warnings.
# echo 'rpmlint-done:'



Requires
--------
libgap-devel (rpmlib, GLIBC filtered):
    libgap(x86-64)
    libgap.so.0()(64bit)

libgap (rpmlib, GLIBC filtered):
    /sbin/ldconfig
    libc.so.6()(64bit)
    libgmp.so.10()(64bit)
    rtld(GNU_HASH)



Provides
--------
libgap-devel:
    libgap-devel
    libgap-devel(x86-64)

libgap:
    libgap
    libgap(x86-64)
    libgap.so.0()(64bit)



Generated by fedora-review 0.4.1 (b2e211f) last change: 2013-04-29
Buildroot used: fedora-18-x86_64
Command line :/usr/bin/fedora-review -b 919703 -m fedora-18-x86_64

Comment 4 Volker Braun 2013-06-03 20:40:37 UTC
Thanks for the review! I'll try to answer the issues that concern me as libgap upstream:

1. I have raised the sigsetjmp configure test issue with upstream
   (http://tracker.gap-system.org/issues/406, requires login)

2. Concerns the libGAP rpm only

3. LibGAP doesn't need readline (there is no command prompt in the
   library version)

4. Fixed

5. Fixed

6. I fixed the tests, should not segfault any more

7. The slides are a bit out of date now, I'll try to write some actual
   documentation since the whole design has now settled.

8. Both GPLv2+ and v3+ are fine with me. For simplicity I'll go with
   the same as GAP, so that is v2+ right now.

9. I made an update for gap-4.6.4 at 
   http://boxen.math.washington.edu/home/vbraun/spkg/libgap-4.6.4.p0.spkg 

10. Concerns the libGAP rpm only

11. Fixed (I added -lm to libgap_la_LDFLAGS)

12. Currently LibGAP is using GAP's own (old) software integer
    implementation. I'll switch libGAP to GMP eventually, but its not
    finished yet (=segfaults).

Comment 5 Volker Braun 2013-06-04 13:19:01 UTC
Now the GAP symbol prefixing is done in the dist-hook. In particular its now easy to make tarballs available, and the current one is

http://boxen.math.washington.edu/home/vbraun/spkg/libgap-4.6.4.tar.gz

I also changed the tests to use SYS_DEFAULT_PATHS for the GAP root
directory, if available. So you shouldn't have to patch the tests any more.

Comment 6 Christopher Meng 2013-07-17 07:21:46 UTC
News?

Comment 7 Paulo Andrade 2013-09-14 21:51:50 UTC
Sorry for the delay. Real life, job, personal projects, etc :-)
I just did look at it again as I would need to add an
even uglier patch to disable libgap in sagemath 5.11.

Now it apparently needs to be updated again to match gap in rawhide:

$ rpm -q gap
gap-4.6.5-1.fc20.x86_64

Running the test cases I see:

$ libtool --mode=execute gdb shell
...
(gdb) r
Starting program: /home/pcpa/rpmbuild/BUILD/libgap-4.6.4.p0/src/test/.libs/lt-shell 
ebp = 0x7fffffffdeb0
&i = 0x7fffffffde94
frame addres = 0x7fffffffdeb0
ebp = 0x7fffffffdeb0
&i = 0x7fffffffde94
frame addres = 0x7fffffffdeb0
Initialized
Input:
1+2+3;
Output:
6
Input:
g:=FreeGroup(2);

Program received signal SIGSEGV, Segmentation fault.
libGAP_RNamName (name=name@entry=0x7ffff7970314 "context") at records.c:94
94          pos = (pos % libGAP_SizeRNam) + 1;
#0  libGAP_RNamName (name=name@entry=0x7ffff7970314 "context") at records.c:94
#1  0x00007ffff791046b in libGAP_CallErrorInner (
    msg=msg@entry=0x7ffff795af08 "Variable: <<unknown>> must have an assigned value", arg1=arg1@entry=0, arg2=arg2@entry=0, justQuit=justQuit@entry=1, 
    mayReturnVoid=mayReturnVoid@entry=0, mayReturnObj=mayReturnObj@entry=0, 
    lateMessage=0x7ffef7785728, printThisStatement=printThisStatement@entry=1)
    at gap.c:1433
#2  0x00007ffff791064b in libGAP_ErrorQuit (
    msg=msg@entry=0x7ffff795af08 "Variable: <<unknown>> must have an assigned value", arg1=arg1@entry=0, arg2=arg2@entry=0) at gap.c:1451
#3  0x00007ffff7843974 in libGAP_ErrorMustHaveAssObjHandler (
    self=<optimized out>, args=<optimized out>) at gvars.c:156
#4  0x00007ffff79105a2 in libGAP_CallErrorInner (
    msg=msg@entry=0x7ffff795af08 "Variable: <<unknown>> must have an assigned value", arg1=arg1@entry=0, arg2=arg2@entry=0, justQuit=justQuit@entry=1, 
    mayReturnVoid=mayReturnVoid@entry=0, mayReturnObj=mayReturnObj@entry=0, 
    lateMessage=0x7ffef7785728, printThisStatement=printThisStatement@entry=1)
    at gap.c:1443
#5  0x00007ffff791064b in libGAP_ErrorQuit (
    msg=msg@entry=0x7ffff795af08 "Variable: <<unknown>> must have an assigned value", arg1=arg1@entry=0, arg2=arg2@entry=0) at gap.c:1451
#6  0x00007ffff7843974 in libGAP_ErrorMustHaveAssObjHandler (
    self=<optimized out>, args=<optimized out>) at gvars.c:156
#7  0x00007ffff79105a2 in libGAP_CallErrorInner (
    msg=msg@entry=0x7ffff795af08 "Variable: <<unknown>> must have an assigned value", arg1=arg1@entry=0, arg2=arg2@entry=0, justQuit=justQuit@entry=1, 
    mayReturnVoid=mayReturnVoid@entry=0, mayReturnObj=mayReturnObj@entry=0, 
    lateMessage=0x7ffef7785728, printThisStatement=printThisStatement@entry=1)
    at gap.c:1443
<<<< stack overflow in recursive calls >>>>


libtool --mode=execute gdb error_handler
(gdb) r
Starting program: /home/pcpa/rpmbuild/BUILD/libgap-4.6.4.p0/src/test/.libs/lt-error_handler 

Program received signal SIGSEGV, Segmentation fault.
libGAP_RNamName (name=name@entry=0x7ffff7970314 "context") at records.c:94
94          pos = (pos % libGAP_SizeRNam) + 1;
<<<< same stack overflow >>>>

$ libtool --mode=execute test
(gdb) r
Starting program: /home/pcpa/rpmbuild/BUILD/libgap-4.6.4.p0/src/test/.libs/lt-test 
--------------------
Input: 0;
Output follows...
0
--------------------
Input: 1 + CyclicGroup(2);

Program received signal SIGSEGV, Segmentation fault.
libGAP_RNamName (name=name@entry=0x7ffff7970314 "context") at records.c:94
94          pos = (pos % libGAP_SizeRNam) + 1;
<<<< same stack overflow >>>>


  I still think it would be better if Jerry and Volker maintained the package.
Perfect solution probably would be to have it integrated in upstream gap...

Comment 8 Volker Braun 2013-10-05 18:49:40 UTC
Updated tarball at https://bitbucket.org/vbraun/libgap/downloads

Comment 9 Paulo Andrade 2013-10-05 19:56:21 UTC
(In reply to Volker Braun from comment #8)
> Updated tarball at https://bitbucket.org/vbraun/libgap/downloads

  Thanks, but it still fails with a stack overflow.

$ rpm -q gap
gap-4.6.5-1.fc20.x86_64

$ libtool --mode=execute gdb test
[...]
(gdb) r
Starting program: /home/pcpa/rpmbuild/BUILD/libgap-4.6.5/test/.libs/lt-test 
--------------------
Input: 0;
Output follows...
0
--------------------
Input: 1 + CyclicGroup(2);

Program received signal SIGSEGV, Segmentation fault.
libGAP_RNamName (name=name@entry=0x7ffff7970354 "context") at records.c:94
94          pos = (pos % libGAP_SizeRNam) + 1;
Missing separate debuginfos, use: debuginfo-install glibc-2.18.90-5.fc21.x86_64 gmp-5.1.2-2.fc20.x86_64
#0  libGAP_RNamName (name=name@entry=0x7ffff7970354 "context") at records.c:94
#1  0x00007ffff79104ab in libGAP_CallErrorInner (
    msg=msg@entry=0x7ffff795af48 "Variable: <<unknown>> must have an assigned value", arg1=arg1@entry=0, arg2=arg2@entry=0, justQuit=justQuit@entry=1, 
    mayReturnVoid=mayReturnVoid@entry=0, mayReturnObj=mayReturnObj@entry=0, 
    lateMessage=0x7ffef7785728, printThisStatement=printThisStatement@entry=1)
    at gap.c:1433
#2  0x00007ffff791068b in libGAP_ErrorQuit (
    msg=msg@entry=0x7ffff795af48 "Variable: <<unknown>> must have an assigned value", arg1=arg1@entry=0, arg2=arg2@entry=0) at gap.c:1451
#3  0x00007ffff7843974 in libGAP_ErrorMustHaveAssObjHandler (
    self=<optimized out>, args=<optimized out>) at gvars.c:156
#4  0x00007ffff79105e2 in libGAP_CallErrorInner (
    msg=msg@entry=0x7ffff795af48 "Variable: <<unknown>> must have an assigned value", arg1=arg1@entry=0, arg2=arg2@entry=0, justQuit=justQuit@entry=1, 
    mayReturnVoid=mayReturnVoid@entry=0, mayReturnObj=mayReturnObj@entry=0, 
    lateMessage=0x7ffef7785728, printThisStatement=printThisStatement@entry=1)
    at gap.c:1443
[...]

After binary searching the start of the frames:

(gdb) frame 92466
#0  0x0000000000000000 in ?? ()

(gdb) frame 92465
#92465 0x0000000000400d1f in main () at test.c:142
142       eval("1 + CyclicGroup(2);\n");

(gdb) frame 92464
#92464 0x00000000004011a4 in eval (
    input=input@entry=0x40149f "1 + CyclicGroup(2);\n") at test.c:103
103       status = libGAP_ReadEvalCommand(libGAP_BottomLVars);

(gdb) frame 92463
#92463 0x00007ffff784c6d0 in libGAP_ReadEvalCommand (context=0x7ffef7783c70)
    at read.c:2285
2285        else                           { libGAP_ReadExpr(   libGAP_S_SEMICOLON|libGAP_S_EOF, 'r' ); }

(gdb) frame 92462
#92462 0x00007ffff7848c52 in libGAP_ReadExpr (follow=follow@entry=3221225472, 
    mode=mode@entry=114 'r') at read.c:1637
1637        libGAP_ReadAnd( follow, mode );

(gdb) frame 92461
#92461 0x00007ffff7848b92 in libGAP_ReadAnd (follow=follow@entry=3221225472, 
    mode=mode@entry=114 'r') at read.c:1611
1611        libGAP_ReadRel( follow, mode );

(gdb) frame 92460
#92460 0x00007ffff7848a0b in libGAP_ReadRel (follow=follow@entry=3221225472, 
    mode=mode@entry=114 'r') at read.c:1572
1572        libGAP_ReadAri( follow, (isNot == 0 ? mode : 'r') );

(gdb) frame 92459
#92459 0x00007ffff784891d in libGAP_ReadAri (follow=follow@entry=3221225472, 
    mode=<optimized out>) at read.c:1539
1539            libGAP_ReadTerm( follow, 'r' );

(gdb) frame 92458
#92458 0x00007ffff7848813 in libGAP_ReadTerm (follow=follow@entry=3221225472, 
    mode=mode@entry=114 'r') at read.c:1500
1500        libGAP_ReadFactor( follow, mode );

(gdb) frame 92457
#92457 0x00007ffff78485ed in libGAP_ReadFactor (
    follow=follow@entry=3221225472, mode=mode@entry=114 'r') at read.c:1449
1449        libGAP_ReadAtom( follow, (sign1 == 0 ? mode : 'r') );

(gdb) frame 92456
#92456 0x00007ffff7848521 in libGAP_ReadAtom (follow=follow@entry=3221225472, 
    mode=<optimized out>) at read.c:1387
1387            libGAP_ReadCallVarAss( follow, mode );

(gdb) frame 92455
#92455 0x00007ffff784af3a in libGAP_ReadCallVarAss (follow=3221225472, 
    mode=<optimized out>) at read.c:395
395             else if ( type == 'g' ) { libGAP_IntrRefGVar( var );           level=0; }

(gdb) frame 92454
#92454 0x00007ffff7890351 in libGAP_IntrRefGVar (gvar=1016) at intrprtr.c:2961
2961            libGAP_ErrorQuit(

(gdb) frame 92453
#92453 0x00007ffff791068b in libGAP_ErrorQuit (msg=<optimized out>, 
    arg1=<optimized out>, arg2=<optimized out>) at gap.c:1451
1451      libGAP_CallErrorInner(msg, arg1, arg2, 1, 0, 0, libGAP_False, 1);

(gdb) frame 92452
#92452 0x00007ffff79105e2 in libGAP_CallErrorInner (msg=<optimized out>, 
    arg1=140733055102272, arg2=<optimized out>, justQuit=justQuit@entry=1, 
    mayReturnVoid=mayReturnVoid@entry=0, mayReturnObj=mayReturnObj@entry=0, 
    lateMessage=0x7ffef7785728, printThisStatement=printThisStatement@entry=1)
    at gap.c:1443
1443      return libGAP_CALL_2ARGS(libGAP_ErrorInner,r,l);  

(gdb) frame 92451
#92451 0x00007ffff7843974 in libGAP_ErrorMustHaveAssObjHandler (
    self=<optimized out>, args=<optimized out>) at gvars.c:156
156         libGAP_ErrorQuit(

(gdb) frame 92450
#92450 0x00007ffff791068b in libGAP_ErrorQuit (
    msg=msg@entry=0x7ffff795af48 "Variable: <<unknown>> must have an assigned value", arg1=arg1@entry=0, arg2=arg2@entry=0) at gap.c:1451
1451      libGAP_CallErrorInner(msg, arg1, arg2, 1, 0, 0, libGAP_False, 1);

(gdb) frame 92450
#92450 0x00007ffff791068b in libGAP_ErrorQuit (
    msg=msg@entry=0x7ffff795af48 "Variable: <<unknown>> must have an assigned value", arg1=arg1@entry=0, arg2=arg2@entry=0) at gap.c:1451
1451      libGAP_CallErrorInner(msg, arg1, arg2, 1, 0, 0, libGAP_False, 1);

(gdb) frame 92449
#92449 0x00007ffff79105e2 in libGAP_CallErrorInner (
    msg=msg@entry=0x7ffff795af48 "Variable: <<unknown>> must have an assigned value", arg1=arg1@entry=0, arg2=arg2@entry=0, justQuit=justQuit@entry=1, 
    mayReturnVoid=mayReturnVoid@entry=0, mayReturnObj=mayReturnObj@entry=0, 
    lateMessage=0x7ffef7785728, printThisStatement=printThisStatement@entry=1)
    at gap.c:1443
1443      return libGAP_CALL_2ARGS(libGAP_ErrorInner,r,l);  

(gdb) frame 92448
#92448 0x00007ffff7843974 in libGAP_ErrorMustHaveAssObjHandler (
    self=<optimized out>, args=<optimized out>) at gvars.c:156
156         libGAP_ErrorQuit(

(gdb) frame 92447
#92447 0x00007ffff791068b in libGAP_ErrorQuit (
    msg=msg@entry=0x7ffff795af48 "Variable: <<unknown>> must have an assigned value", arg1=arg1@entry=0, arg2=arg2@entry=0) at gap.c:1451
1451      libGAP_CallErrorInner(msg, arg1, arg2, 1, 0, 0, libGAP_False, 1);


So, the error should be in frame #92454

I do not understand the code, only extra help I can give on a first look
is that at the point of failure I see this as the starting point to debug,
and should be trivial for the code author :-)

(gdb) frame 92454
#92454 0x00007ffff7890351 in libGAP_IntrRefGVar (gvar=1016) at intrprtr.c:2961
2961            libGAP_ErrorQuit(
(gdb) p libGAP_PtrGVars[gvar]
$19 = (libGAP_Bag) 0x0
(gdb) p libGAP_ExprGVars[gvar]
$20 = (libGAP_UInt *) 0x7ffef7baa6b0

Comment 10 Volker Braun 2013-10-05 20:13:31 UTC
Hmm works for me in a standalone build. Where can I get your current spec file?

Comment 11 Paulo Andrade 2013-10-05 20:38:50 UTC
(In reply to Volker Braun from comment #10)
> Hmm works for me in a standalone build. Where can I get your current spec
> file?

Sorry for not uploading it earlier.

Spec: http://pcpa.fedorapeople.org/libgap.spec
Srpm: http://pcpa.fedorapeople.org/libgap-4.6.5-1.fc21.src.rpm

Comment 12 Volker Braun 2013-10-05 21:18:15 UTC
It should be

BuildRequires:	gap-libs

which is used by the testsuite. The gap-devel rpm is not used.

Also, CFLAGS should be a configure argument... my fault, should be documented better. This is what caused the segfault, since the testsuite wasn't pointed at the gap install.

I also added %doc README, that the main source of information...

Comment 13 Volker Braun 2013-10-05 21:19:33 UTC
Created attachment 808275 [details]
Fixed spec file.

Comment 14 Paulo Andrade 2013-10-05 22:17:55 UTC
Many thanks. I change to use CFLAGS as an environment
variable, and added gap-libs to build requires. gap-devel
is required due to having it defining the rpm macro(s).

Scratch build fails on arm:
http://koji.fedoraproject.org/koji/taskinfo?taskID=6028254

So, I made it exclusivearch x86 for now.
In case build log is lost, the failure is:

---%<---
In file included from shell.c:10:0:
../src/vars.h: In function 'libGAP_SwitchToNewLvars':
../src/vars.h:163:3: warning: implicit declaration of function 'libGAP_BODY_FUNC' [-Wimplicit-function-declaration]
   libGAP_PtrBody = (libGAP_Stat*)libGAP_PTR_BAG(libGAP_BODY_FUNC(libGAP_CURR_FUNC));
   ^
shell.c: In function 'eval':
shell.c:44:3: warning: implicit declaration of function 'libgap_set_error' [-Wimplicit-function-declaration]
   libgap_enter();
   ^
shell.c:46:3: warning: implicit declaration of function 'libGAP_ViewObjHandler' [-Wimplicit-function-declaration]
   libGAP_ViewObjHandler(libGAP_ReadEvalResult);
   ^
shell.c: In function 'print_stack_start':
shell.c:23:18: error: invalid register name for 'ebp'
   register void* ebp asm("ebp");     
                  ^
---%<---

Jerry, you may want to comment on it now :-)
libgap is not optional to package sagemath 5.11.

Spec URL: http://pcpa.fedorapeople.org/libgap.spec
SRPM URL: http://pcpa.fedorapeople.org/libgap-4.6.5-1.fc21.src.rpm

Comment 15 Volker Braun 2013-10-06 01:15:46 UTC
I'm not surprised that there is trouble on arm... I don't have an arm machine to test on. I'll see if I can get a koji scratch build working.

Comment 16 Jerry James 2013-10-08 01:09:27 UTC
It's trying to print the value of the ebp register, which only exists on x86.  I don't see why that is even necessary.  It doesn't seem to be checked or used in any way.  Perhaps print_stack_start() could be made conditional on x86 platforms, something like this:

#if defined(__i686__) || defined(__x86_64__)
void print_stack_start()
{
...
}
#else
void print stack_start()
{
  int i;
  printf("&i = %p\n", &i);
  printf("frame addres = %p\n", __builtin_frame_address(0));
}
#endif

I will comment more on the current spec file in a couple of hours.

Comment 17 Jerry James 2013-10-08 03:13:36 UTC
The comments below apply to the spec file from comment 13.

According to comment 4, gmp is not used at the moment.  However, it is being linked in.  A new run of fedora-review reports only one error:

libgap.x86_64: W: unused-direct-shlib-dependency /usr/lib64/libgap.so.0.0.0 /lib64/libgmp.so.10

Can we prevent linking libgap against libgmp until such time as that makes sense?

All of the other issues I raised have been fixed, so if we can just fix this one and the problem with the x86-specific test, we're ready to go.

Comment 18 Paulo Andrade 2013-10-08 18:25:29 UTC
This should address the issues. Scratch build:
http://koji.fedoraproject.org/koji/taskinfo?taskID=6037201

- Only run x86 specific asm code on x86 (#919703#c17)
- Do not link to gmp as gmp interface is disabled (#919703#c17)

Spec URL: http://pcpa.fedorapeople.org/libgap.spec
SRPM URL: http://pcpa.fedorapeople.org/libgap-4.6.5-3.fc21.src.rpm

Comment 19 Volker Braun 2013-10-08 18:36:12 UTC
The GAP garbage collector searches through the stack, so thats where it comes from. But at least for gcc the default is via __builtin_frame_address, which also works on arm. The x86 asm in test/shell.c is just leftover from debugging in the testsuite and can be removed.

Comment 20 Jerry James 2013-10-08 21:00:37 UTC
Okay, this is acceptable.  This package is APPROVED.

Paulo, I will apply to be comaintainer so I can build and push gap and libgap updates at the same time.  I agree that the best solution would be for upstream gap to absorb libgap, though.

Comment 21 Paulo Andrade 2013-10-08 21:10:42 UTC
Thanks! At first I do not want to backport sagemath 5.11 to
f19 or earlier, but it should not be too difficult for f20.

Comment 22 Paulo Andrade 2013-10-08 21:12:06 UTC
New Package SCM Request
=======================
Package Name: libgap
Short Description: C library version of the GAP kernel
Owners: pcpa
Branches: f20
InitialCC:

Comment 23 Gwyn Ciesla 2013-10-09 12:05:10 UTC
Git done (by process-git-requests).

Comment 24 Fedora Update System 2013-10-09 17:31:48 UTC
libgap-4.6.5-3.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/libgap-4.6.5-3.fc20

Comment 25 Fedora Update System 2013-10-10 14:47:16 UTC
libgap-4.6.5-3.fc20 has been pushed to the Fedora 20 testing repository.

Comment 26 Fedora Update System 2013-10-15 06:37:54 UTC
libgap-4.6.5-3.fc20 has been pushed to the Fedora 20 stable repository.