Bug 2061077 - Review Request: libsonata - A Python and C++ interface to the SONATA format
Summary: Review Request: libsonata - A Python and C++ interface to the SONATA format
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jerry James
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: fedora-neuro, NeuroFedora
TreeView+ depends on / blocked
 
Reported: 2022-03-05 16:00 UTC by Ankur Sinha (FranciscoD)
Modified: 2022-03-18 10:53 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
If this bug requires documentation, please select an appropriate Doc Type value.
Last Closed: 2022-03-18 10:53:28 UTC
Type: ---
Embargoed:
loganjerry: fedora-review+


Attachments (Terms of Use)

Description Ankur Sinha (FranciscoD) 2022-03-05 16:00:23 UTC
Spec URL: https://ankursinha.fedorapeople.org/libsonata.spec
SRPM URL: https://ankursinha.fedorapeople.org/libsonata-0.1.11-1.fc37.src.rpm

Description:
C++ / Python reader for SONATA circuit files. SONATA guide:
https://github.com/AllenInstitute/sonata/blob/master/docs/SONATA_DEVELOPER_GUIDE.md

Fedora Account System Username: ankursinha

Comment 1 Ankur Sinha (FranciscoD) 2022-03-05 16:00:25 UTC
This package built on koji:  https://koji.fedoraproject.org/koji/taskinfo?taskID=83656500

Comment 2 Jerry James 2022-03-08 21:35:30 UTC
Package Review
==============

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

Issues:
=======
- I'm a bit confused by the %autorelease definition at the top of the spec
  file.  Is that there for spec file development purposes, and will be removed
  on import (with, presumably, %autochangelog replacing the current changelog)?

  Aha, now I see the diff at the bottom between the spec file and the spec file
  inside the srpm.  Now I understand. :-)

- The build logs shows that some tests aborted.  This raises two issues:
  1. The %check script should have failed, but didn't because of the "|| true"
     after the test invocation.
  2. The aborted tests were triggered by -Wp,-D_GLIBCXX_ASSERTIONS.  It's
     important to know if the code flaws are just in the tests, or in the
     library itself.  In the latter case, these same failures are going to
     happen to poor hapless users at runtime.

     I have fixed lots of packages with this particular kind of flaw.  If you
     would like help tracking this down, I'm happy to do so.

- There doesn't seem to be anything useful in the python shared object.  It
  seems to consist entirely of startup and teardown code.  In the build log,
  I see it created correctly with g++ at the 97% mark during the cmake build,
  but then it is built *again* 64 lines below that, with gcc and no input
  files, in the expansion of %pyproject_wheel.

- Regarding the license, this file carries a license other than LGPLv3:
  Boost: include/bbp/sonata/optional.hpp

- The license file is not in the main package, but should be.

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

C/C++:
[x]: Package does not contain kernel modules.
[x]: Package contains no static executables.
[x]: Development (unversioned) .so files in -devel subpackage, if present.
     Note: Unversioned so-files in private %_libdir subdirectory (see
     attachment). Verify they are not in ld path.
[x]: If your application is a C or C++ application you must list a
     BuildRequires against gcc, gcc-c++ or clang.
[x]: Header files in -devel subpackage, if present.
[x]: ldconfig not called in %post and %postun for Fedora 28 and later.
[x]: Package does not contain any libtool archives (.la)
[x]: Rpath absent or only used for internal libs.

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.
[!]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "Unknown or generated", "GNU Lesser General Public License,
     Version 3", "*No copyright* GNU Lesser General Public License, Version
     3", "BSD 3-Clause License", "MIT License", "Boost Software License
     1.0". 67 files have unknown license.

     See issue above.

[!]: License file installed when any subpackage combination is installed.

     See issue above.

[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.
[-]: Package contains desktop file if it is a GUI application.
[x]: Development files must be in a -devel package
[x]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (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.
[-]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[x]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[x]: Useful -debuginfo package or justification otherwise.
[x]: Package is not known to require an ExcludeArch tag.
[x]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 20480 bytes in 2 files.
[x]: Package complies to the Packaging Guidelines
[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).
[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 %license.
[x]: Package requires other packages for directories it uses.
[x]: Package must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[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]: Package must not depend on deprecated() packages.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[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

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

Generic:
[-]: 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).
[x]: Fully versioned dependency in subpackages if applicable.
     Note: No Requires: %{name}%{?_isa} = %{version}-%{release} in
     python3-libsonata
[?]: Package functions as described.
[x]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[!]: Patches link to upstream bugs/comments/lists or are otherwise
     justified.

     There are no links or justification comments.     

[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
     Note: gpgverify is not used.
[-]: 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.
[x]: Packages should try to preserve timestamps of original installed
     files.
[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]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Sources can be downloaded from URI in Source: tag
[x]: SourceX is a working URL.
[x]: Spec use %global instead of %define unless justified.

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

Generic:
[!]: Spec file according to URL is the same as in SRPM.
     Note: Spec file as given by url is not the same as in SRPM (see
     attached diff).
     See: (this test has no URL)
[x]: Rpmlint is run on debuginfo package(s).
     Note: There are rpmlint messages (see attachment).
[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).
[x]: Large data in /usr/share should live in a noarch subpackage if package
     is arched.


Rpmlint
-------
================================================ rpmlint session starts ================================================
rpmlint: 2.2.0
configuration:
    /usr/lib/python3.10/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/licenses.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 32, packages: 7

libsonata-debuginfo.x86_64: W: unstripped-binary-or-object /usr/lib/debug/usr/lib64/libsonata.so.0.1.11-0.1.11-1.fc37.x86_64.debug
python3-libsonata-debuginfo.x86_64: W: unstripped-binary-or-object /usr/lib/debug/usr/lib64/python3.10/site-packages/libsonata/_libsonata.cpython-310-x86_64-linux-gnu.so-0.1.11-1.fc37.x86_64.debug
libsonata.src: W: strange-permission libsonata.spec 600
libsonata-debuginfo.x86_64: E: shared-library-without-dependency-information /usr/lib/debug/usr/lib64/libsonata.so.0.1.11-0.1.11-1.fc37.x86_64.debug
python3-libsonata.x86_64: E: shared-library-without-dependency-information /usr/lib64/python3.10/site-packages/libsonata/_libsonata.cpython-310-x86_64-linux-gnu.so
python3-libsonata-debuginfo.x86_64: E: shared-library-without-dependency-information /usr/lib/debug/usr/lib64/python3.10/site-packages/libsonata/_libsonata.cpython-310-x86_64-linux-gnu.so-0.1.11-1.fc37.x86_64.debug
libsonata.src: E: description-line-too-long https://github.com/AllenInstitute/sonata/blob/master/docs/SONATA_DEVELOPER_GUIDE.md
libsonata.x86_64: E: description-line-too-long https://github.com/AllenInstitute/sonata/blob/master/docs/SONATA_DEVELOPER_GUIDE.md
libsonata-devel.x86_64: E: description-line-too-long https://github.com/AllenInstitute/sonata/blob/master/docs/SONATA_DEVELOPER_GUIDE.md
python3-libsonata.x86_64: E: description-line-too-long https://github.com/AllenInstitute/sonata/blob/master/docs/SONATA_DEVELOPER_GUIDE.md
libsonata-debuginfo.x86_64: W: dangling-relative-symlink /usr/lib/debug/.build-id/3b/2527f1ae0f776d592704a9bc398e25a23ebd1b ../../../.build-id/3b/2527f1ae0f776d592704a9bc398e25a23ebd1b
python3-libsonata-debuginfo.x86_64: W: dangling-relative-symlink /usr/lib/debug/.build-id/0c/9364f1be8a5f92e7743e5250c8fd72a3290687 ../../../.build-id/0c/9364f1be8a5f92e7743e5250c8fd72a3290687
================= 7 packages and 0 specfiles checked; 7 errors, 5 warnings, 7 badness; has taken 6.2 s =================



Rpmlint (installed packages)
----------------------------
================================================ rpmlint session starts ================================================
rpmlint: 2.2.0
configuration:
    /usr/lib/python3.10/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/licenses.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 32, packages: 3

python3-libsonata.x86_64: E: shared-library-without-dependency-information /usr/lib64/python3.10/site-packages/libsonata/_libsonata.cpython-310-x86_64-linux-gnu.so
libsonata.x86_64: E: description-line-too-long https://github.com/AllenInstitute/sonata/blob/master/docs/SONATA_DEVELOPER_GUIDE.md
libsonata-devel.x86_64: E: description-line-too-long https://github.com/AllenInstitute/sonata/blob/master/docs/SONATA_DEVELOPER_GUIDE.md
python3-libsonata.x86_64: E: description-line-too-long https://github.com/AllenInstitute/sonata/blob/master/docs/SONATA_DEVELOPER_GUIDE.md
================= 3 packages and 0 specfiles checked; 4 errors, 0 warnings, 4 badness; has taken 0.5 s =================



Unversioned so-files
--------------------
python3-libsonata: /usr/lib64/python3.10/site-packages/libsonata/_libsonata.cpython-310-x86_64-linux-gnu.so

Source checksums
----------------
https://github.com/BlueBrain/libsonata/archive/v0.1.11/libsonata-0.1.11.tar.gz :
  CHECKSUM(SHA256) this package     : 8f16f893c267b3bf8915518b166ade6087a53a485c4654114ee1df3075b02493
  CHECKSUM(SHA256) upstream package : 8f16f893c267b3bf8915518b166ade6087a53a485c4654114ee1df3075b02493


Requires
--------
libsonata (rpmlib, GLIBC filtered):
    libc.so.6()(64bit)
    libgcc_s.so.1()(64bit)
    libgcc_s.so.1(GCC_3.0)(64bit)
    libgcc_s.so.1(GCC_3.3.1)(64bit)
    libhdf5.so.200()(64bit)
    libstdc++.so.6()(64bit)
    libstdc++.so.6(CXXABI_1.3)(64bit)
    libstdc++.so.6(CXXABI_1.3.5)(64bit)
    libstdc++.so.6(CXXABI_1.3.9)(64bit)
    rtld(GNU_HASH)

libsonata-devel (rpmlib, GLIBC filtered):
    libsonata(x86-64)
    libsonata.so.0.1()(64bit)

python3-libsonata (rpmlib, GLIBC filtered):
    python(abi)
    python3.10dist(numpy)
    rtld(GNU_HASH)

libsonata-debuginfo (rpmlib, GLIBC filtered):

libsonata-debugsource (rpmlib, GLIBC filtered):



Provides
--------
libsonata:
    libsonata
    libsonata(x86-64)
    libsonata.so.0.1()(64bit)

libsonata-devel:
    libsonata-devel
    libsonata-devel(x86-64)

python3-libsonata:
    python-libsonata
    python3-libsonata
    python3-libsonata(x86-64)
    python3.10-libsonata
    python3.10dist(libsonata)
    python3dist(libsonata)

libsonata-debuginfo:
    debuginfo(build-id)
    libsonata-debuginfo
    libsonata-debuginfo(x86-64)
    libsonata.so.0.1.11-0.1.11-1.fc37.x86_64.debug()(64bit)

libsonata-debugsource:
    libsonata-debugsource
    libsonata-debugsource(x86-64)



Diff spec file in url and in SRPM
---------------------------------
--- /home/jamesjer/2061077-libsonata/srpm/libsonata.spec	2022-03-08 13:35:43.038230181 -0700
+++ /home/jamesjer/2061077-libsonata/srpm-unpacked/libsonata.spec	2022-03-04 16:43:12.000000000 -0700
@@ -1,2 +1,11 @@
+## START: Set by rpmautospec
+## (rpmautospec version 0.2.5)
+%define autorelease(e:s:pb:) %{?-p:0.}%{lua:
+    release_number = 1;
+    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
+    print(release_number + base_release_number - 1);
+}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{?dist}
+## END: Set by rpmautospec
+
 %bcond_with tests
 
@@ -104,3 +113,10 @@
 
 %changelog
-%autochangelog
+* Fri Mar 04 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur> 0.1.11-1
+- Uncommitted changes
+
+* Sun May 02 2021 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur> 0.1.8-2
+- WIP
+
+* Sun May 02 2021 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur> 0.1.8-1
+- init


Generated by fedora-review 0.7.6 (b083f91) last change: 2020-11-10
Command line :/usr/bin/fedora-review -b 2061077 -m fedora-rawhide-x86_64
Buildroot used: fedora-rawhide-x86_64
Active plugins: C/C++, Generic, Shell-api
Disabled plugins: Ruby, Haskell, SugarActivity, Ocaml, PHP, R, Perl, Python, Java, fonts
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH

Comment 3 Jerry James 2022-03-08 21:45:25 UTC
Incidentally, I thought I would take a quick peek at those test failures.  Running the first failed test by hand generates some interesting output:

```
Filters: ElementReportReader
HDF5-DIAG: Error detected in HDF5 (1.12.1) thread 0:
  #000: ../../src/H5F.c line 620 in H5Fopen(): unable to open file
    major: File accessibility
    minor: Unable to open file
  #001: ../../src/H5VLcallback.c line 3501 in H5VL_file_open(): failed to iterate over available VOL connector plugins
    major: Virtual Object Layer
    minor: Iteration failed
  #002: ../../src/H5PLpath.c line 578 in H5PL__path_table_iterate(): can't iterate over plugins in plugin path '(null)'
    major: Plugin for dynamically loaded library
    minor: Iteration failed
  #003: ../../src/H5PLpath.c line 620 in H5PL__path_table_iterate_process_path(): can't open directory: /usr/local/hdf5/lib/plugin
    major: Plugin for dynamically loaded library
    minor: Can't open directory or file
  #004: ../../src/H5VLcallback.c line 3351 in H5VL__file_open(): open failed
    major: Virtual Object Layer
    minor: Can't open object
  #005: ../../src/H5VLnative_file.c line 97 in H5VL__native_file_open(): unable to open file
    major: File accessibility
    minor: Unable to open file
  #006: ../../src/H5Fint.c line 1834 in H5F_open(): unable to open file: name = './data/elements.h5', tent_flags = 0
    major: File accessibility
    minor: Unable to open file
  #007: ../../src/H5FD.c line 723 in H5FD_open(): open failed
    major: Virtual File Layer
    minor: Unable to initialize object
  #008: ../../src/H5FDsec2.c line 352 in H5FD__sec2_open(): unable to open file: name = './data/elements.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0
    major: File accessibility
    minor: Unable to open file
```

I see the /usr/local path in %{_libdir}/libhdf5.so.200.1.0, so that should be fixed as well:

$ strings /usr/lib64/libhdf5.so.200.1.0 | grep -F /usr/local
/usr/local/hdf5/lib/plugin

Comment 4 Jerry James 2022-03-08 22:05:12 UTC
I was running the test from the wrong directory.  When I used the correct directory, the output in comment 3 disappeared.  Still odd to have a /usr/local path embedded in that library, though.

An abort happens at src/report_reader.cpp, line 463.  Here are lines 462 and 463:

off_t data_offset = (timer_index - index_start) / stride;
auto data_ptr = &data_frame.data[data_offset * n_ids];

GDB says:
(gdb) print data_offset
$1 = <optimized out>
(gdb) print n_ids
$2 = 10
(gdb) print data_frame.data
$3 = std::vector of length 20, capacity 20 = {11, 11.1000004, 11.1999998, 11.3000002, 11.3999996, 0, 0, 0, 0, 0, 0, 0, 
  0, 0, 0, 0, 0, 0, 0, 0}
(gdb) print timer_index
$4 = 1
(gdb) print index_start
$5 = <optimized out>
(gdb) print stride
$6 = <optimized out>

Inspection of times_index_ and tstride shows that index_start should be 2 and stride should be 1, which means that data_offset is -1.  That means an attempt is made to access data_frame.data[-10], which triggers the C++ assert.

Comment 5 Jerry James 2022-03-08 22:31:47 UTC
Nope, that's wrong.  Ignore comment 4.  I inspected times_index badly.  Not sure what is happening there, but somehow the C++ assert is firing for accessing an invalid index.

Comment 6 Jerry James 2022-03-08 23:31:16 UTC
I was annoyed that I didn't figure this out, so I just tried one more time. :-)  The reference to report_reader.cpp line 463 is a red herring.  That's just the optimizer cleverly combining paths to the assertion failure code.  The assertion failure actually happens on line 473:

    std::copy(&buffer[gid_start], &buffer[gid_end], &data_ptr[offset]);

The problem is that gid_end can equal the size of buffer, and &buffer[gid_end] triggers the assertion failure in that case.  The code should look like this instead:

    std::copy(buffer.begin() + gid_start, buffer.begin() + gid_end, &data_ptr[offset]);

With that change, all of the tests pass.

Comment 7 Ankur Sinha (FranciscoD) 2022-03-09 08:45:37 UTC
Thanks very much for the review, Jerry. I've made the code changes to fix the assertion error and opened a PR upstream. I'll go look at the other issues now.

https://github.com/BlueBrain/libsonata/pull/182

Comment 8 Ankur Sinha (FranciscoD) 2022-03-15 18:23:04 UTC
Updated spec/srpm:

Spec: https://ankursinha.fedorapeople.org/libsonata/libsonata.spec
SRPM: https://ankursinha.fedorapeople.org/libsonata/libsonata-0.1.11-4.fc37.src.rpm

I've fixed all the issues. I see that a couple of the Python tests still give the warnings/errors you've noted in comment 3, but I checked upstream's CI and these warnings are there too. The tests seem to pass in spite of them, so hopefully they're OK. I will file an issue with upstream to double-check in the meantime.

Cheers,

Comment 9 Jerry James 2022-03-15 20:56:06 UTC
The license looks good, and the python object also looks correct now.  However, with the latest srpm, I see this test failure:

```
-------------------------------------------------------------------------------
EdgePopulation::writeIndices
-------------------------------------------------------------------------------
/builddir/build/BUILD/libsonata-0.1.11/tests/test_edges.cpp:83
...............................................................................

/builddir/build/BUILD/libsonata-0.1.11/tests/test_edges.cpp:91: FAILED:
  {Unknown expression after the reported line}
due to unexpected exception with message:
  Unable to open file ./data/edges-no-index.h5.tmp (Virtual File Layer) Unable
  to lock file
```

I suspect that means that tests/data has to be copied to %{__cmake_builddir}/tests.  I'm not worried about the hd5 warnings since, as you say, the tests pass anyway.  

A quick experiment showed that adding these lines to the other copies in %build leads to a successful run of the tests:

mkdir -p %{__cmake_builddir}/tests
cp -a tests/data %{__cmake_builddir}/tests

So just add that and everything looks good.  This package is APPROVED.

Comment 10 Ankur Sinha (FranciscoD) 2022-03-16 08:39:36 UTC
Ah, awesome! Thank you. I'll make the tweak now and request SCM.

Comment 11 Tomas Hrcka 2022-03-17 07:33:22 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/libsonata

Comment 12 Fedora Update System 2022-03-18 10:52:32 UTC
FEDORA-2022-134837a442 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-134837a442

Comment 13 Fedora Update System 2022-03-18 10:53:28 UTC
FEDORA-2022-134837a442 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.