DON'T RUN `clang-tidy` IN YOUR CONTAINER RANDOMLY

DON’T RUN clang-tidy IN YOUR CONTAINER RANDOMLY!!! DON’T RUN clang-tidy IN YOUR CONTAINER RANDOMLY!!! DON’T RUN clang-tidy IN YOUR CONTAINER RANDOMLY!!!

Why? Because if you enable the auto-fix option of clang-tidy, but don’t carefully check the options you pass to it, it can modified your system libraries!!! In my case, because the CUDA include path in my container is somehow not recognized by clang-tidy, it just dumped a lot of auto-fixes to them, which is a disaster.

At the beginning, I thought it must be bugs caused by my conda environment (like mismatch of the gcc version, CUDA version and glibc version, etc), which was quite common before. But after I spent 2 hours to enumerate all the possible combinations of them and started new containers, I soon realized that the root cause is the clang-tidy command I ran in my container.

Because a simplest CUDA program like

#include <cuda_runtime.h>
int main() {
    return 0;
}

cannot pass the compilation! Then I open the cuda_runtime.h. Although I’m not familiar with its entire content, when I see that the name of some familiar APIs are changed, I know it must be destroyed.