Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
H
haskell-igraph
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 1
    • Issues 1
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • gargantext
  • haskell-igraph
  • Merge Requests
  • !1

Merged
Opened Feb 08, 2023 by Alfredo Di Napoli@AlfredoDiNapoli
  • Report abuse
Report abuse

Fix segfault in `igraphCommunityInfomap` call

Fixes #1 (closed).

@anoe The bug was a bit subtle and easy to miss: in the call to igraphCommunityInfomap we were passing as the last argument for *codelen the nullPtr. However, by looking at the C implementation of this function, we can see how we need a valid pointer as the function would write at that address the result of the calculation (igraph_real_t) shortestCodeLength / log(2.0).

In terms of "how do I fix this next time", alas I don't have a silver bullet here. First of all, the first step is to make sure we are indeed getting a segfault. Unfortunately neither stack nor cabal would be very helpful in this regards when running the tests via stack test or cabal test. However, more informative logs could be acquired by running directly the test executable (essentially bypassing stack or cabal). I'm a cabal user (but for stack it should be equivalent), so I was able to run something like dist-newstyle/build/x86_64-osx/ghc-8.10.7/haskell-igraph-0.8.5/t/test/build/test (the path would be slightly different on your machine) to be greeted with a segfault message, whereas by running this via cabal v2-test was simply giving me a FAIL test without an indication of why that was (perhaps the segfault is emitted to stderr, albeit I didn't check that was the case).

In theory it should also be possible to throw gdb at this, but at least on my Mac gdb is a bit all over the place and not really working well, but luckily a code review was enough here to spot the problem 😉

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b adinapoli/fix-segfault-infomap origin/adinapoli/fix-segfault-infomap

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout origin/master
git merge --no-ff adinapoli/fix-segfault-infomap

Step 4. Push the result of the merge to GitLab

git push origin master

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

  • Discussion 0
  • Commits 1
  • Changes 1
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
0
Labels
None
Assign labels
  • View project labels
Reference: gargantext/haskell-igraph!1

Revert this commit

This will create a new commit in order to revert the existing changes.

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.

Cherry-pick this commit

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.