PlatformLab / NanoLog

Nanolog is an extremely performant nanosecond scale logging system for C++ that exposes a simple printf-like API.
Other
3k stars 343 forks source link

Infinite Loop in Makefile Dependency Generation #60

Open jjenkins278 opened 2 years ago

jjenkins278 commented 2 years ago

In runtime/GNUmakefile, dependency generation uses the following sed script to generate dependencies for sources used in tests:

sed 's|[a-zA-Z0-9_-]*\.o|$(TEST_BUILD_DIR)/&|' ./.depend >> ./.depend

See https://github.com/PlatformLab/NanoLog/blob/2a94d70f9d1db4da416053b1b926387fa068a59b/runtime/GNUmakefile#L76 .

The issue with this script is that ./.depend can be written to before the sed script completes, sending the script into an infinite loop. This behavior is being triggered for me in WSL1 Ubuntu 18.04.

I'll follow up with a PR to break the lib and test dependencies in two.