Skip to content

Incorrect non-portable path warning. #130

Open
@llamasoft

Description

@llamasoft

I ran into this issue while attempting to build Chromium from source. I can confirm that this issue occurs on at least clang versions 7.0.1-8 (installed via apt) and 10.0.0 (from the Chromium build chain). It should be noted that I was doing this build under the Windows Subsystem for Linux running Ubuntu.

Here are some shell commands to create the file and directory structure needed to reproduce the issue:

mkdir -p "Common"
echo '#include "Thread.hpp"' > "Common/MutexLock.hpp"
echo '' > "Common/Thread.hpp"

mkdir -p "Package/common"
echo '#include "Common/MutexLock.hpp"' > "Package/common/Object.hpp"

# This file being in a subdirectory appears to be important.
# When placed elsewhere, the bug does not occur.
mkdir -p "Package/lib"
echo '
#include "common/Object.hpp"
#include "Common/Thread.hpp"
' > "Package/lib/bug.cpp"

# The order of the include directories is also important.
# When reversed (i.e. -I./Package -I.), the error does not occur.
clang++ -I. -I./Package -Werror -Wall ./Package/lib/bug.cpp

The result will be:

./Package/lib/bug.cpp:3:10: error: non-portable path to file '"common/Thread.hpp"'; specified path differs in case from file name on disk [-Werror,-Wnonportable-include-path]
#include "Common/Thread.hpp"
         ^~~~~~~~~~~~~~~~~~~
         "common/Thread.hpp"
1 error generated.

This is absolutely incorrect. The file common/Thread.hpp doesn't even exist, nor was it ever referenced. It seems to be confusing the directory capitalization of ./Package/common and ./Common

It should be noted that the issue seems to have some rather specific criteria for being triggered. For example, the file being built must be at a different folder depth than the other files. Furthermore, the order of the -I flags matters. When reversed, the issue does not occur.

This seems possibly related to bug 32436, but that one appears to involve symlinks whereas this one only involves actual files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions