Menu

2.11 segfaults with VS-solution upper-/lowercase filename mismatch

2023-06-23
2023-06-30
  • Ole Roeßler

    Ole Roeßler - 2023-06-23

    Hi, thanks for the new release.
    I had two problems so far:

    • CMake has a problem configuring the project because the version in cmake/versions.cmake doesn't contain the patch version (just adding .0 fixed it for me)

    • cppcheck segfaults if there is a upper-/lowercase filename mismatch with visual studio solutions, for example:
      .vcxproj contains filename StdAfx.cpp, actual filename on disk: stdafx.cpp

    relevant stack trace:

    #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140103424513600) at ./nptl/pthread_kill.c:44
    #1  __pthread_kill_internal (signo=6, threadid=140103424513600) at ./nptl/pthread_kill.c:78
    #2  __GI___pthread_kill (threadid=140103424513600, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
    #3  0x00007f6c5ff32476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #4  0x00007f6c5ff187f3 in __GI_abort () at ./stdlib/abort.c:79
    #5  0x00007f6c5ff1871b in __assert_fail_base (fmt=0x7f6c600cd150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55f3614db01e "file != nullptr",
        file=0x55f3614dafa8 "/opt/cppcheck/cppcheck-2.11/externals/simplecpp/simplecpp.cpp", line=382, function=<optimized out>) at ./assert/assert.c:92
    #6  0x00007f6c5ff29e96 in __GI___assert_fail (assertion=0x55f3614db01e "file != nullptr", file=0x55f3614dafa8 "/opt/cppcheck/cppcheck-2.11/externals/simplecpp/simplecpp.cpp", line=382,
        function=0x55f3614daff8 "FileStream::FileStream(const string&)") at ./assert/assert.c:101
    #7  0x000055f3612fa3b8 in FileStream::FileStream (this=0x7f6c5ed94aa0, filename="Tools/ElekonTool/StdAfx.cpp") at /opt/cppcheck/cppcheck-2.11/externals/simplecpp/simplecpp.cpp:382
    #8  0x000055f3612e7caf in simplecpp::TokenList::TokenList (this=0x7f6c5ed95010, filename="Tools/ElekonTool/StdAfx.cpp", filenames=std::__debug::vector of length 0, capacity 0, outputList=0x7f6c5ed94e60)
        at /opt/cppcheck/cppcheck-2.11/externals/simplecpp/simplecpp.cpp:436
    #9  0x000055f360e90bb5 in createTokenList (filename="Tools/ElekonTool/StdAfx.cpp", files=std::__debug::vector of length 0, capacity 0, outputList=0x7f6c5ed94e60, fileStream=0x0) at /opt/cppcheck/cppcheck-2.11/lib/cppcheck.cpp:631
    #10 0x000055f360e914c8 in CppCheck::checkFile (this=0x7f6c5ed95cd0, filename="Tools/ElekonTool/StdAfx.cpp", cfgname="Release|Win32", fileStream=0x0) at /opt/cppcheck/cppcheck-2.11/lib/cppcheck.cpp:678
    #11 0x000055f360e90929 in CppCheck::check (this=0x7f6c5ed97240, fs=...) at /opt/cppcheck/cppcheck-2.11/lib/cppcheck.cpp:621
    #12 0x000055f360bd92b9 in ThreadData::check (this=0x7fffa479bf70, errorLogger=..., file=0x0, fs=0x55f363999420) at /opt/cppcheck/cppcheck-2.11/cli/threadexecutor.cpp:126
    

    this didn't cause a crash in 2.10. After renaming the file to StdAfx.cpp it doesn't crash anymore.

    Cheers
    Ole

     

    Last edit: Ole Roeßler 2023-06-23
  • Daniel Marjamäki

    Thanks! I have created this ticket for the crash: https://trac.cppcheck.net/ticket/11797

    I wonder if you could create a minimal project that reproduce the crash?

     
  • Daniel Marjamäki

    CMake has a problem configuring the project because the version in cmake/versions.cmake doesn't contain the patch version (just adding .0 fixed it for me)

    I have tried to add some comments so that problem can be avoided from now on.

    https://github.com/danmar/cppcheck/pull/5204

     
  • Lieven de Cock

    Lieven de Cock - 2023-06-29

    Can a new release be made, since we are building this in an automated way, and would want to avoid that I need to adjust the build script to 'sed' a solution ;-) (for the version issue)

    This was my analysis, just for reference, since problem is solved in the meantime.
    The problem is cmake/versions.cmake

    SET(VERSION "2.11")
    STRING(REGEX MATCHALL "[0-9]+" VERSION_PARTS "${VERSION}")
    LIST(GET VERSION_PARTS 0 VERSION_MAJOR)
    LIST(GET VERSION_PARTS 1 VERSION_MINOR)
    LIST(GET VERSION_PARTS 2 VERSION_PATCH) <========== there is no 3rd field

    So as suggested above changing to "2.11.0" fixes the problem.

    Cmake error :

    CMake Error at cmake/versions.cmake:6 (LIST):
    LIST index: 2 out of range (-2, 1)
    Call Stack (most recent call first):
    CMakeLists.txt:13 (include)

     
  • Paul Fultz

    Paul Fultz - 2023-06-30

    Yea I think a 2.11.1 release with this fix would be good, since the the 2.11 release is broken.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.