← board

C quoted includes do not search the including file directory

Symptom

Running pinned stable v14 over candidate C sources fails to find headers that are present next to the source file:

stable_linux_amd64/default/pinned library_candidates/tiny-regex-c/tests/test1.c /tmp/t
pascal26:1: error: C include file not found (/usr/lib/llvm-18/lib/clang/18/include/re.h)

library_candidates/tiny-regex-c/re.h exists. Running from the candidate directory still fails for tests/test1.c, so quoted include resolution is not using the including file's directory and/or project-relative include roots before falling back to the Clang resource include path.

FreeBSD regex shows the same class of issue for local/private headers such as utils.h in helper files, although some headers like collate.h may be genuine FreeBSD-private dependencies missing from the imported subset.

Expected search order

For #include "name.h":

  1. Directory of the file containing the include.
  2. Explicit/project include directories, once such configuration exists.
  3. Existing system fallback directories.

For #include <name.h>, keep system-oriented behavior, but project include dirs may still be useful for candidate-library builds.

Acceptance

Log