influxdata / pkg-config

PROTOTYPE: A pkg-config drop-in for compiling C libraries for InfluxData

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ensure the wrapper doesn't detect itself for the pkg-config binary

onelson opened this issue · comments

In a situation where the wrapper detects itself as the system pkg-config binary, it can call itself recursively. This ultimately causes the build to fail while also eating all your system resources in the process!

When searching for the system binary, we should check to make sure we haven't just rediscovered the wrapper. I'm not sure what the method for this should be. Perhaps we can canonicalize the paths, or generate hashes for each binary or something else.

If we exhaust our search only finding the wrapper then exit after printing some helpful message.

An odd thought that occurred to me for spotting the difference between the wrapper and the system binary: we could add a flag that only the wrapper has and use that as the guard. If some/path/to/pkg-config --is-influxdata-wrapper produces a non-zero exit, then we could know it's not the wrapper.

A weakness to this approach is that the earlier releases for the wrapper also won't know about this flag, but I think that'd implicitly put is in the situation we have today (without any sort of guard).