You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Initial clang-format target invocation causes many files to be rebuilt #8934
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.
@bryancall thought of using -mmin from find to detect what files are changing:
# Clone, autoreconf, make.
# Wait more than 5 minutes.
# Now, find all the files modified in the last 5 minutes in the repo:
find . -mmin -5
# Should show nothing.
# Now run the clang-format target, followed by the above find command:
make -j5 clang-format && echo -------------------- && find . -mmin -5
# ...
./plugins/certifier/certifier.cc
make[1]: Leaving directory '/home/bneradt/src/ts_asf_master_fix_clang_format_make_target'
--------------------
./.git
./.git/fmt
./.git/fmt/20200514
./.git/fmt/20200514/clang-format-20200514.tar.bz2
./.git/fmt/20200514/sha1
./include
./include/ink_autoconf.h.in
./include/ink_autoconf.h
The .git/fmt directory changes are simply the changes to install clang-format. That's not interesting. But the fact that clang-format is modifying ink_autoconf.h.in and ink_autoconf.h is interesting. I'm not sure why that file is being modified despite making no changes.
These are autoconf generated files, thus they don't show up in my git diff command. We should simply skip running clang-format on these files. I'll create a PR.
Activity
bneradt commentedon Jun 30, 2022
@bryancall thought of using
-mminfrom find to detect what files are changing:The
.git/fmtdirectory changes are simply the changes to install clang-format. That's not interesting. But the fact that clang-format is modifyingink_autoconf.h.inandink_autoconf.his interesting. I'm not sure why that file is being modified despite making no changes.bneradt commentedon Jun 30, 2022
These are autoconf generated files, thus they don't show up in my
git diffcommand. We should simply skip running clang-format on these files. I'll create a PR.Make clang-format not modify files on initial invocation
Make clang-format not modify ink_autoconf.h.in and ink_autoconf.h
Make clang-format not modify ink_autoconf.h.in and ink_autoconf.h (#8935
Make clang-format not modify ink_autoconf.h.in and ink_autoconf.h (#8935
Make clang-format not modify ink_autoconf.h.in and ink_autoconf.h (ap…