Menu

Double slashes in `(file)` parameter for external application

Zufu Liu
2021-09-21
2021-09-26
  • Zufu Liu

    Zufu Liu - 2021-09-21

    bug exists in both Cppcheck 2.5 and 2.6 dev from https://github.com/danmar/cppcheck/actions/runs/1255663738

     
  • Daniel Marjamäki

    Thanks for reporting this problem!

    I have created this ticket:
    https://trac.cppcheck.net/ticket/10504#ticket

    I fear that this ticket could go unfixed for a while. We do not have the resources to fix all problems quickly enough. So if you have time to fix this then that would be highly appreciated.

     

    Last edit: Daniel Marjamäki 2021-09-24
  • Zufu Liu

    Zufu Liu - 2021-09-25

    If I guessed correct, the double slashes is added by
    https://github.com/danmar/cppcheck/blob/main/gui/resultstree.cpp#L778

            //Replace (file) with filename
            QString file = data[FILENAME].toString();
            file = QDir::toNativeSeparators(file);
    #ifdef Q_OS_WIN
            file.replace(QString("\\"), QString("\\\\"));
    #endif
            qDebug() << "Opening file: " << file;
    
     
  • Daniel Marjamäki

    the code does not look really robust to me. does it work when there are spaces in the filename?

     
  • Zufu Liu

    Zufu Liu - 2021-09-25

    Space in file name works, what passed to Notepad2 is:

    -g 2537 "D:\\notepad2\\scite\\src\\SciTE Base.cxx"
    
     
  • Zufu Liu

    Zufu Liu - 2021-09-26

    Thank, tested https://github.com/danmar/cppcheck/actions/runs/1274040688
    only one backslash: /g 2537 D:\notepad2\scite\src\SciTEBase.cxx, so it's fixed.

     

Log in to post a comment.