• Show log

    Commit

  • Hash : 212ae9a7
    Author : lhchavez
    Date : 2020-12-21T06:48:48

    Fix the `-DENABLE_WERROR=ON` build for gcc 10.2
    
    This change makes it possible to build with newer versions of gcc
    without warnings. There were two warnings issued:
    
    * gcc 8 added
      [`-Wstringop-truncation`](https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/),
      which warns if a call to `strncpy(3)` is prone to accidentally
      truncating the destination string, since `strncpy(3)` does NOT add a
      terminating `NULL` if the destination buffer is not large enough to
      hold the input.
    
      This change uses the pattern suggested in
      https://us-cert.cisa.gov/bsi/articles/knowledge/coding-practices/strncpy-and-strncat
      to fix the locations flagged by gcc.
    * There was a potentially uninitialized access of `dest` in `fs_copy`.
    

  • README.md

  • Writing Clar tests for libgit2

    For information on the Clar testing framework and a detailed introduction please visit:

    https://github.com/vmg/clar

    • Write your modules and tests. Use good, meaningful names.

    • Make sure you actually build the tests by setting:

        cmake -DBUILD_CLAR=ON build/
    • Test:

        ./build/libgit2_clar
    • Make sure everything is fine.

    • Send your pull request. That’s it.

    Memory leak checks

    These are automatically run as part of CI, but if you want to check locally:

    Linux

    Uses valgrind:

    $ cmake -DBUILD_CLAR=ON -DVALGRIND=ON ..
    $ cmake --build .
    $ valgrind --leak-check=full --show-reachable=yes --num-callers=50 --suppressions=../libgit2_clar.supp \
      ./libgit2_clar

    macOS

    Uses leaks, which requires XCode installed:

    $ MallocStackLogging=1 MallocScribble=1 MallocLogFile=/dev/null CLAR_AT_EXIT="leaks -quiet \$PPID" \
      ./libgit2_clar