Skip to content

Initial clang-format target invocation causes many files to be rebuilt #8934

@bneradt

Description

@bneradt

The initial invocation of clang-format causes make to rebuild many files, despite clang-format not reformatting any files. Future invocations do not cause this, however.

To reproduce:

docker pull ci.trafficserver.apache.org/ats/rockylinux:8
docker run -it  ci.trafficserver.apache.org/ats/rockylinux:8 /bin/bash

# From inside the docker container.
cd /var/tmp
git clone https://github.com/apache/trafficserver.git
cd trafficserver
autoreconf -fi
./configure
make -j8

# Wait for the build to complete.

# Run make again. Nothing should need to be rebuilt:
make -j8

make clang-format

# Verify no files got modified by clang-format.
git status

make -j8
# Many files are rebuilt. This is not expected.

# Re-run clang-format again, even removing the local repo installation.
rm -rf .git/fmt
make clang-format

make -j8
# No files are rebuilt.

It would be good to figure out why the initial invocation of clang-format causes many files to be rebuilt and to investigate whether this can be avoided. Across the many developers who build Traffic Server this wastes a lot of time.

Metadata

Metadata

Assignees

Labels

Buildwork related to build configuration or environment

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions