Because the data directory may be a symlink, also log the path it resolves to, so debug.log files show the actual location for that run.
This patch would mostly help developers. I've been testing a potential performance PR across different data directories (for example, SSD versus HDD). After each run, I save the debug.log file. It would be nice if the debug.log file showed which data directory was used for that run.
There are two ways to change which data directory to use: -datadir= on the command line, or by making the default path a symlink. If a script starts bitcoind (e.g., on an RPi with a whole infrastructure, like Umbrel or myNode), changing the startup command arguments may be inconvenient or not even possible. It's easy to change the default directory to be a symlink. But in that case, debug.log doesn't show the actual data directory location. This patch changes the existing startup log line to show the resolved data directory path (after following symlinks) if it differs from the nominal path.
I don't think we need a separate test. I haven't tested on all platforms, but this patch uses primitives already used elsewhere, so it should work everywhere.
Here's an example of the changed line during startup (omitting the timestamp prefix):
- Using data directory /home/larry/.bitcoin
+ Using data directory /home/larry/.bitcoin (/sd/.bitcoin)